Skip to content
EDUCATION

Bitcoin Tweet Sentiment with Naive Bayes: The Math and the Traps

A Bernoulli Naive Bayes classifier turns which words appear in a tweet into a probability that bitcoin rises. The maths is simple and the break-even hit rate looks low, but double-counted words, reactive tweets, bots and fees decide whether the signal survives.

Sumit PandePUBLISHED UPDATED 10 MIN READ

Here is a trade that only needs to be right 45.5% of the time. A classifier reads tweets about bitcoin, decides the mood is bullish, and buys $10,000 of BTC for 24 hours. If the mood was misread (bots, sarcasm), bitcoin falls 10% and the trade loses $1,000. If the mood was real, bitcoin rises 12% and the trade makes $1,200. Because the win is larger than the loss, being wrong slightly more often than right still pays.

That arithmetic is the easy part, and it hides the hard part: whether the classifier's "bullish" means anything about the next 24 hours. This post builds the model from the ground up with a worked example, then tests each assumption it rests on. Every number below is either from a linked source or our own illustration, labelled as such.

The hypothetical trade, before any question of whether the signal works

−$1,000

Loss if sentiment was misread (−10%)

+$1,200

Gain if sentiment was genuine (+12%)

45.5%

Hit rate needed to break even

1,000 ÷ (1,000 + 1,200)

46.4%

Break-even after a $20 round-trip cost

Assumed 0.2% total fees and spread

Source: Author's illustration. Payoffs are assumed, not forecasts. Break-even ignores the flat case.

The idea in plain terms

Suppose that, over many days, you noticed some words turn up more often in bitcoin tweets before the price rose, and others before it fell. A Naive Bayes classifier formalises that hunch. It learns, from history, how common each word is on days that were followed by a rise and on days followed by a fall. Given a new tweet, it asks: is this pattern of words more typical of the "up" pile or the "down" pile, and by how much?

The "Bernoulli" part means the model only records whether each word in its vocabulary appears, yes or no. It ignores how many times. "Moon moon moon" counts the same as "moon". The "naive" part means it treats every word as independent evidence, as though seeing "moon" told you nothing about whether you would also see "bullish". That assumption is almost always false, and we will come back to what it costs.

What the model computes

Bayes' rule says the probability of a class given the evidence is proportional to the prior probability of the class times the likelihood of the evidence under that class. For two classes, up and down, it is cleaner to work in log-odds, the logarithm of P(up) ÷ P(down), because the products become sums:

  1. Start with the prior. If 52% of training tweets were followed by a rise, the prior log-odds is ln(0.52 ÷ 0.48) = 0.080.
  2. For each vocabulary word that is present, add ln(P(word | up) ÷ P(word | down)). A word twice as common before rises adds ln 2, about 0.69.
  3. For each vocabulary word that is absent, add ln((1 − P(word | up)) ÷ (1 − P(word | down))). This is the step that distinguishes the Bernoulli model: not seeing a bearish word is itself weak bullish evidence.
  4. Convert back: probability of up = 1 ÷ (1 + e^(−score)).

Two details matter in practice. First, a word that never appeared in one class in training would get a probability of zero and veto every other word. The standard fix, Laplace smoothing, adds one to every count: P(word | up) = (tweets in the up class containing the word + 1) ÷ (tweets in the up class + 2). Second, the Bernoulli model differs from its better-known sibling, the multinomial model, which counts word frequencies and ignores absent words. McCallum and Nigam (1998) compared the two on text classification and found the multinomial model generally better with large vocabularies, while the Bernoulli model held up with small ones. Tweets are short, so a word appearing at all is most of the information, which is why the Bernoulli version is a reasonable choice here.

A worked example with six words

To make the mechanics concrete, here is an invented training set: 1,000 tweets, each labelled by whether bitcoin rose over the following 24 hours. 520 were followed by a rise and 480 by a fall. The vocabulary has six words. The counts are made up for illustration; the arithmetic on them is exact.

Table 1: Toy training set and the weights the model learns

WordIn up tweets (of 520)In down tweets (of 480)Weight if presentWeight if absent
moon13060+0.685−0.154
bullish10448+0.682−0.117
hodl7872−0.001+0.000
dump2672−1.074+0.111
scam2148−0.881+0.064
rekt1653−1.235+0.086

Source: author's illustration. Probabilities use Laplace smoothing; weights are natural-log likelihood ratios, up versus down.

Bearish words carry more weight than bullish ones in this example

Log-odds weight added when each word is present, toy six-word model

  • moon+0.685
  • bullish+0.682
  • hodl0.000 (no signal)
  • scam−0.881
  • dump−1.074
  • rekt−1.235
Bearish words carry more weight than bullish ones in this example
moon+0.685
bullish+0.682
hodl0.000 (no signal)
scam−0.881
dump−1.074
rekt−1.235

Author's illustration on invented counts. Positive weights push toward "up", negative toward "down". "hodl" is near zero because it is equally common in both classes.

Source: Author's calculation, Table 1

Three things stand out. "hodl" is the word most people would call bullish, yet the model gives it no weight, because in this data it was just as common before falls; loyal holders tweet in both directions. The bearish words are rarer but more lopsided, so each one moves the score further. And the absence weights are small: not seeing "rekt" is mild evidence for up, worth about an eighth of seeing "moon".

Now score a new tweet: "BTC heading to the moon. Still bullish. hodl." Three words are present and three absent:

TermContribution
Prior, ln(520 ÷ 480)+0.080
moon present+0.685
bullish present+0.682
hodl present−0.001
dump absent+0.111
scam absent+0.064
rekt absent+0.086
Total log-odds+1.707
Probability of up, 1 ÷ (1 + e^−1.707)84.6%

Source: author's calculation from Table 1.

For comparison, a tweet containing only "dump" and "rekt" scores 8.0% up, and a tweet with "moon" and "scam" together scores 49.1%, almost a coin toss: the model nets one against the other. A tweet with none of the six words scores 51.8%, slightly below the 52.0% prior, because missing out on "moon" and "bullish" costs a little more than missing the bearish words gains.

From tweets to a trade

A single tweet is not a trading signal. Thousands are posted a day, and how you combine them matters as much as the classifier.

The tempting move is to add every tweet's log-odds together, as if each were an independent witness. It produces nonsense quickly. One tweet like the example scores 84.6%. Ten identical tweets, summed, score 99.99996%. A hundred round to certainty. Tweets about the same price move are not independent witnesses; they are an echo. The usual alternatives are the share of tweets classified bullish in a window, or the average log-odds, compared against its own history.

That daily figure then needs its own test. The question is not "is the average tweet bullish?" but "when the bullish share is in its top fifth, how did the next 24 hours go, out of sample?" Two rules keep that test honest. Every tweet used must be timestamped before the return window starts, and the model must be trained only on data before the period it is tested on (walk-forward), never on a random shuffle of all dates. Shuffling lets the model learn from the future, and is one of the most common reasons sentiment backtests look better than live results.

The label also needs care. "Up" over 24 hours includes moves of 0.05%, which are noise next to trading costs. Many practitioners label only moves beyond a band, say ±1%, and drop the rest, which gives cleaner classes at the price of fewer training examples.

The arithmetic of the trade

Return to the trade at the top. Assume, as the illustration does, that every signal ends in either −10% or +12%, and charge $20 per round trip for fees and spread. The expected profit per $10,000 trade at different hit rates is:

Small changes in hit rate swing the trade from losing to winning

Expected profit per $10,000 trade by classifier hit rate, assumed −10% / +12% payoff and $20 cost

  • 40% hit rate−$140
  • 45% hit rate−$30
  • 50% hit rate+$80
  • 55% hit rate+$190
  • 60% hit rate+$300
Small changes in hit rate swing the trade from losing to winning
40% hit rate−$140
45% hit rate−$30
50% hit rate+$80
55% hit rate+$190
60% hit rate+$300

Author's illustration, not a forecast or a result. Expected profit = hit rate × $1,200 − (1 − hit rate) × $1,000 − $20.

Source: Author's calculation

The payoff assumption does a lot of work here, and it deserves suspicion on three counts.

  1. The 12-to-10 asymmetry is assumed, not observed. If genuine signals and misreads both produce moves of similar size, break-even rises to just over 50%, and the classifier needs a real edge rather than a lucky payoff shape.
  2. The worst case is not a worst case. Without a stop, nothing caps a 24-hour loss at 10%. Bitcoin fell by more than a third on 12 March 2020. A strategy sized on "−10% worst case" is sized on a number the market has already broken.
  3. The flat case is not free. A day that ends flat still pays the round-trip cost, and a signal that fires daily pays it 365 times a year.

Where the naive assumption bites

The independence assumption is the reason the model is fast and needs little data: it only ever estimates one probability per word per class. It is also why its probabilities are overconfident. Words in bitcoin tweets travel in packs. "Moon" and "bullish" are posted by the same people in the same mood about the same price move. When they appear together, the model adds both weights as if they were two separate pieces of evidence.

Counting the same mood twice inflates confidence

Model probability that bitcoin rises, toy six-word model

  • Prior (no tweet)52.0%
  • "moon" only71.3%
  • "moon" + "bullish", as the model scores it84.7%
  • Same tweet, if "bullish" only echoes "moon"71.3%
Counting the same mood twice inflates confidence
Prior (no tweet)52.0%
"moon" only71.3%
"moon" + "bullish", as the model scores it84.7%
Same tweet, if "bullish" only echoes "moon"71.3%

Author's illustration. The last bar assumes "bullish" adds no information beyond "moon", the extreme case of correlated words; the truth usually lies between the last two bars.

Source: Author's calculation, Table 1

There is a well-known saving grace. Domingos and Pazzani (1997) showed that Naive Bayes can classify correctly even when its independence assumption is badly violated, because classification only needs the right side of 50%, not the right probability. In trading terms: the ranking of days from most to least bullish can be useful even when the stated probabilities are not. The practical consequence is to treat the raw output as a score, not a probability, and to recalibrate it against realised outcomes (with isotonic regression or a simple logistic fit on a held-out period) before it is used to decide position size.

Where the signal itself breaks

Even a perfectly calibrated classifier can only find information that is in the tweets. Four problems sit outside the maths.

Tweets often describe the past

Much crypto chatter is reaction. A 6% rally produces a burst of "moon" tweets after it has happened. A classifier trained carelessly learns that "moon" is associated with up days, which is true, without learning that the association runs backwards in time. This is the timestamp rule again: if the tweet window overlaps the return window by even an hour, the backtest measures description, not prediction.

Bots and coordinated accounts

Varol and co-authors (2017) estimated that between 9% and 15% of active Twitter accounts were bots. Crypto is a topic where automated and coordinated promotion is common, and a burst of bullish-sounding posts from new accounts is a different signal from the same words from long-standing ones. Filtering by account age, follower patterns or posting frequency helps, and is often worth more than tuning the classifier.

Sarcasm and negation

A bag of words cannot read tone. "Great, another to-the-moon call from the guy who was wrong last week" contains "moon". "Not bullish here" contains "bullish". Adding two-word phrases (bigrams such as "not bullish") as extra features catches some negation; sarcasm mostly survives. This is the "misread sentiment" in the illustration's worst case, and it is not a rare edge case in crypto discussion.

The vocabulary drifts

Slang turns over. A word that carried weight in one cycle can become filler in the next, as "hodl" did in our example. A model trained once and left running will slowly lose its edge without announcing it. Periodic retraining on a rolling window, and tracking each word's weight over time, are the minimum.

What the published evidence says

The best-known study in this area, Bollen, Mao and Zeng (2011), reported that a Twitter mood measure improved forecasts of daily up and down moves in the Dow Jones Industrial Average, with 87.6% directional accuracy in their test period. It used a different method from the one described here and tested a short window. Lachanski and Pav (2017) revisited the result and argued it did not hold up under re-examination. Our reading: the idea that aggregate mood carries some information is plausible and has been tested many times; the claim that a simple word-counting classifier delivers a durable trading edge after costs has not been settled, and any single high-accuracy figure from a short test period deserves scepticism.

Naive Bayes is a strong, honest baseline in text classification: Pang, Lee and Vaithyanathan (2002) found it competitive with more complex methods on movie-review sentiment. A baseline is where a research process should start. It is the yardstick a more complex model has to beat, out of sample and after costs, to justify its complexity.

What could make this analysis wrong

The worked example uses invented counts and six words; real vocabularies run to thousands, and the size of the double-counting problem depends on how correlated the real words are, which we have not measured here. The payoff illustration assumes two outcomes; real 24-hour bitcoin returns form a continuous, fat-tailed distribution, and a full test would use the actual return on each signal day. And the bot estimate is from 2017, before the platform changed ownership and access rules; the share today could be meaningfully different in either direction.

If someone showed a walk-forward test, with strictly earlier tweets, bot filtering and realistic costs, in which a Bernoulli Naive Bayes signal held its edge across several years, the conclusion here would shift from "unsettled" toward "useful". That is the test worth asking for.

The model itself is sound arithmetic. What decides whether it is useful is everything the arithmetic takes for granted: that the words came before the move, that the people writing them were people, that they meant what they wrote, and that the payoff is what you assumed. Check those four before trusting the 45.5%.

This post is for education and illustration only. The trade, payoffs, counts and probabilities are hypothetical and are not a forecast, a recommendation to buy or sell bitcoin or any other asset, or a description of any Shipra strategy or result. Crypto-assets are highly volatile and can lose most or all of their value.

Why is it called "naive" Bayes?

Because it assumes every word is independent evidence once you know the class: seeing "moon" is assumed to tell you nothing about whether "bullish" also appears. That is rarely true, and it makes the model's probabilities overconfident when correlated words appear together. The assumption is what makes the model fast and data-efficient, and its rankings are often still useful.

What is the difference between Bernoulli and multinomial Naive Bayes?

Bernoulli Naive Bayes records only whether each vocabulary word appears, and treats a missing word as evidence too. Multinomial Naive Bayes counts how often words appear and ignores absent ones. For short texts such as tweets, where a word rarely repeats, the Bernoulli version is a natural fit; for longer documents the multinomial version usually does better.

Can tweet sentiment predict bitcoin prices?

The evidence is mixed. Aggregate mood may carry some information, but many tweets react to moves that already happened, bots distort the sample, and sarcasm defeats word counting. Any claim should be judged on a walk-forward test using only tweets posted before each return window, with realistic trading costs.

What hit rate does a sentiment trading signal need?

It depends on the payoff, not the model. If winners average +12% and losers −10%, break-even is 1,000 ÷ 2,200, about 45.5%, before costs. If winners and losers are the same size, break-even is just over 50% once costs are included. Always compute it from realised returns, not assumed ones.

Sources & references

  1. A Comparison of Event Models for Naive Bayes Text Classification, Andrew McCallum and Kamal Nigam, AAAI-98 Workshop on Learning for Text Categorization (1998-07-01)
  2. On the Optimality of the Simple Bayesian Classifier under Zero-One Loss, Pedro Domingos and Michael Pazzani, Machine Learning 29, 103–130 (1997-11-01)
  3. Twitter mood predicts the stock market, Johan Bollen, Huina Mao and Xiaojun Zeng, Journal of Computational Science 2(1) (2011-03-01)
  4. Shy of the Character Limit: "Twitter Mood Predicts the Stock Market" Revisited, Michael Lachanski and Steven Pav, Econ Journal Watch 14(3) (2017-09-01)
  5. Online Human-Bot Interactions: Detection, Estimation, and Characterization, Onur Varol et al., ICWSM 2017 (2017-03-09)
  6. Thumbs up? Sentiment Classification using Machine Learning Techniques, Bo Pang, Lillian Lee and Shivakumar Vaithyanathan, EMNLP 2002 (2002-05-28)

The materials on this website are for illustration and discussion purposes only and do not constitute an offering. An offering may be made only by delivery of a confidential offering memorandum to appropriate investors. PAST PERFORMANCE IS NO GUARANTEE OF FUTURE RESULTS. Disclosures

Visualisations use simulated data from stated models. They are not actual or hypothetical performance. Simulated and illustrative visuals

Quantitative and machine-learning models can fail; hedging reduces but does not eliminate losses. Model and hedging risk

SHARELINKEDINXEMAIL

More in Education

View all →

Education · Nov 24, 2026 · 8 MIN

The IPO Base-and-Breakout Pattern, Tested on 18 Listings

Waiting for an IPO to fall, base and break out avoided the worst early losses in 18 well-known listings. But once the rule signalled, only 7 of 14 stocks beat the Nasdaq-100 over the next year, and 4 of 11 without the three famous examples.

Parth Patel

Education · Nov 14, 2026 · 7 MIN

Compounding Builds Roots Before It Shows

Twenty years of the Nifty 50 turned ₹1 lakh into about ₹6.7 lakh, yet less than a quarter of the gain came in the first decade. That is the arithmetic of compounding, not bad luck. It needs nothing complex, only a long time without interruption, and the same shape shows up well beyond money.

Parth Patel

Education · Nov 11, 2026 · 7 MIN

Howard Marks on AI: 11 Questions Before You Invest

Howard Marks's memo "A Layman Thinks About AI" makes no forecast. It asks eleven questions instead. The odds math says a six-link AI thesis rarely holds in full, concentration and credit exposure are already high, and price, not conviction, is the protection.

Parth Patel

Want to discuss this research?

Talk to us