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?

흥미롭네요..

가장 좋은 건 야후 파이낸스만 사용하는 거겠죠?

아니면 finviz.com이나 barchart.com도 괜찮을까요?

이런 기능이 있는 플러그인이 있으면 좋겠습니다.

2개의 좋아요

상징(심볼)을 입력한 후에 실시간 가격을 추가하는 방법이 있을까요? 가격 변동에 따라 녹색 또는 빨간색으로 표시되는 조건부 서식이 포함될 수도 있습니다.

예를 들어

$APPL $148.70

Discourse API의 decorateCookedElement를 사용하는 커스텀 테마 컴포넌트를 통해 이를 구현할 수 있습니다. 주가 정보를 가져오기 위해 서드파티 서비스에 요청을 보내야 하고, 가져온 데이터를 화면에 표시해야 합니다.

4개의 좋아요

고마워요 @awesomerobot. 이 부분에 대해 좀 조사해 볼게요

1개의 좋아요

시작점으로 Custom Mentionables - plugin - Discourse Meta를 참고해 보세요. (다만 데이터셋은 직접 만들어야 합니다.)

2개의 좋아요