Stocksent 如何把 Reddit 股票討論轉化為數據,以及為何一則爆紅貼文不能淹沒其他討論
How we turn Reddit's stock talk into numbers (and why one viral post can't drown the rest)
Stocksent 透過語言模型分析 Reddit 貼文和留言中的股票討論,並以加權方式計算討論熱度與市場情緒,避免單一爆紅貼文主導結果。權重會考慮發言類型、判斷明確程度、按平方根縮放的 upvotes,以及反諷、娛樂性貼文和同一作者提及多隻股票等因素。各項數據可連結至相關貼文,工具衡量的是羣眾看法,而非股票走勢。
I built Stocksent, a free tool that reads the big stock subreddits a few times a day and turns the talk into numbers you can compare: how much each stock is discussed, whether the crowd is bullish or bearish, and what is suddenly being talked about. This post is about the part that took the longest to get right: deciding how much one Reddit comment should count.
Counting mentions is not enough
The naive version counts tickers: if $NVDA appears 2,000 times this week, it is "hot". But a headline that names a company, a question ("is NVDA a buy?") and a confident call ("loading up before earnings") are very different evidence. So every (post or comment, ticker) pair goes to a language model, which returns three things:
- Direction: bullish, bearish or neutral on that stock.
- Kind: what the author is doing. A recommendation counts 1.0, an analysis 0.7, describing a position or reporting news 0.3, a question 0.1.
- Conviction: how clear the read is, from 0 to 1.
Upvotes, but under a square root
Upvotes are a signal of agreement, but a single post with 20,000 upvotes would otherwise outweigh a week of organic discussion. So upvotes enter under a square root, scaled by the median for posts or comments (the median post earns about four times the median comment just from being in the feed):
w = sqrt(upvotes / type_median * 5) * kind_weight * share * theater * (1 - sarcasm) + 0.3
A few details that mattered more than I expected:
- Neutral verdicts skip the upvote term. A 2,400-upvote "priced in, lol" is a room enjoying a joke, not a room taking a view.
- Sarcasm is scored, and pulls a verdict toward neutral.
- Spectacle posts (stunts, public bets) get a tiny weight, because their upvotes measure entertainment. You can only tell from the replies, so threads that pass 1,000 upvotes are re-read whole, in order.
- One author listing fourteen picks is not fourteen people: an item naming n tickers is worth sqrt(n) items, split between them.
What comes out
From those weights come a few numbers per ticker over 24 hours, 7 days and 30 days: mentions, sentiment, a "heat" score (loved and talked about lately), and a trend score (talk far above its own usual level). Every number links back to the posts behind it, because a sentiment score you can't inspect is hard to trust.
The full method, limits included, is public: https://stocksent.fly.dev/methodology. There is also a weekly report (https://stocksent.fly.dev/reports/latest) and an Android app.
It measures what a crowd is saying, not what a stock will do, and the crowd is often wrong. Questions about the weighting are very welcome in the comments.
來源:DEV Community · dev.to