Automatically link stock symbols in posts

I’d like to customize the way posts are rendered on my hosted Discourse instance. For example, if I wanted to link stock symbols that start with a dollar sign (“cashtags”) like $AAPL, how would I do this?

You would need to write a plugin that would scan the post content for /\$(\w+)\b/ and replace it with a link to the corresponding stock.

Note: if you are hosted with us, we only allow custom plugin on the enterprise data plan.

5 Likes

Where would they link to?

Interesting…

Best would be just yahoo finance?

Perhaps finfiz.com or barchart.com?

I would love a plugin with this functionality.

2 Likes

Is there a way of adding a live price after a symbol has been typed? Possibly with conditional formatting for green or red depending on its movement.

ie

$APPL $148.70

It would be possible with a custom theme component using decorateCookedElement from the Discourse API. You’d have to make a request to a third-party service to get the stock information, and then pull that in.

4 Likes

Thanks @awesomerobot will do some research into this

1 Like

Take a look at: Custom Mentionables - plugin - Discourse Meta as a starting point (you’d have to create the dataset though).

2 Likes