Automatically link stock symbols in posts

AI-generated summary

The discussion revolves around automatically linking stock symbols in posts on a Discourse instance. ide proposes customizing post rendering to link “cashtags” like $AAPL. zogstrip suggests creating a plugin to scan and replace these cashtags with links to a corresponding stock page.

Possible link destinations include Yahoo Finance, finviz.com, or barchart.com, as suggested by MarcP. Neildb further proposes adding live prices with conditional formatting for green or red depending on the stock’s movement.

awesomerobot explains that this is possible using a custom theme component with the Discourse API. merefield recommends the Custom Mentionables plugin as a starting point, requiring the creation of a dataset.

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 curtidas

Where would they link to?

Interessante…

O ideal seria apenas o Yahoo Finance?

Talvez o finviz.com ou o barchart.com?

Adoraria um plugin com essa funcionalidade.

2 curtidas

Existe alguma maneira de adicionar um preço em tempo real após digitar um símbolo? Possivelmente com formatação condicional em verde ou vermelho, dependendo da variação.

Por exemplo:

$APPL $148.70

Seria possível com um componente de tema personalizado usando decorateCookedElement da API do Discourse. Você precisaria fazer uma solicitação a um serviço de terceiros para obter as informações de ações e, em seguida, incorporá-las.

4 curtidas

Obrigado, @awesomerobot, vou fazer uma pesquisa sobre isso.

1 curtida

Dê uma olhada em: Custom Mentionables - plugin - Discourse Meta como ponto de partida (você teria que criar o conjunto de dados, no entanto).

2 curtidas