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 « 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 »