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 Me gusta

Where would they link to?

Interesante…

Lo mejor sería simplemente Yahoo Finance.

¿Quizás finfiz.com o barchart.com?

Me encantaría un plugin con esta funcionalidad.

2 Me gusta

¿Existe alguna forma de agregar un precio en tiempo real después de escribir un símbolo? Posiblemente con formato condicional en verde o rojo según su movimiento.

Por ejemplo:

$APPL $148.70

Sería posible con un componente de tema personalizado usando decorateCookedElement de la API de Discourse. Tendrías que hacer una solicitud a un servicio de terceros para obtener la información de las acciones y luego incorporarla.

4 Me gusta

Gracias @awesomerobot, haré algunas investigaciones sobre esto.

1 me gusta

Echa un vistazo a: Menciones personalizadas - plugin - Discourse Meta como punto de partida (aunque tendrías que crear el conjunto de datos).

2 Me gusta