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 « J'aime »

Where would they link to?

Intéressant…

Le mieux serait simplement Yahoo Finance ?

Peut-être finviz.com ou barchart.com ?

J’aimerais beaucoup avoir un plugin avec cette fonctionnalité.

2 « J'aime »

Existe-t-il un moyen d’afficher un prix en temps réel après la saisie d’un symbole ? Éventuellement avec une mise en forme conditionnelle en vert ou en rouge selon son évolution.

Par exemple :

$APPL $148,70

Cela serait possible avec un composant de thème personnalisé utilisant decorateCookedElement de l’API Discourse. Vous devriez effectuer une requête vers un service tiers pour obtenir les informations boursières, puis les intégrer.

4 « J'aime »

Merci @awesomerobot, je vais faire quelques recherches à ce sujet.

1 « J'aime »

Jetez un coup d’œil à : Custom Mentionables - plugin - Discourse Meta comme point de départ (vous devrez cependant créer le jeu de données).

2 « J'aime »