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 إعجابات

Where would they link to?

مثير للاهتمام..

هل الأفضل هو ياهو فاينانس فقط؟

ربما finfiz.com أو barchart.com؟

أود جداً الحصول على إضافة بهذه الوظيفة.

إعجابَين (2)

هل توجد طريقة لإضافة سعر مباشر بعد كتابة الرمز؟ ربما مع تنسيق شرطي باللون الأخضر أو الأحمر حسب اتجاه تحركه.

مثال:

$APPL $148.70

سيكون ذلك ممكنًا باستخدام مكون سمة مخصص باستخدام decorateCookedElement من واجهة برمجة تطبيقات Discourse. سيتعين عليك إرسال طلب إلى خدمة تابعة لجهة خارجية للحصول على معلومات الأسهم، ثم جلبها.

4 إعجابات

شكرًا لك @awesomerobot، سأقوم ببعض البحث في هذا الشأن.

إعجاب واحد (1)

تفقد: Custom Mentionables - plugin - Discourse Meta كنقطة انطلاق (مع ذلك، ستحتاج إلى إنشاء مجموعة البيانات).

إعجابَين (2)