DEV Community

Cover image for Polymarket Trading Bot Strategies - Bayesian Updating for Real Edge
Blockchain Rust Engineer
Blockchain Rust Engineer

Posted on • Originally published at casatrick.substack.com

Polymarket Trading Bot Strategies - Bayesian Updating for Real Edge

Polymarket Trading Bot Strategies: Turning Stale Probabilities into Edge with Bayes

A prediction-market price is not a price.

It is a probability the crowd agreed on a moment ago.

The second real news arrives, that number is wrong - not forever, just for the few minutes it takes everyone else to finish the same math a Polymarket trading bot can run in milliseconds.

Especially on low-liquidity markets.

That math has a name. It was written down in 1763 by a dead man, and it remains the single most important tool for anyone (or any bot) that trades a number meant to represent a chance.

Most traders think their job is to predict what happens.

It is not.

Your job - and the job of any serious Polymarket trading bot - is to figure out what the price should be after new information and get there before the crowd does.

Prediction is guessing the future.

This is measuring a probability, watching evidence hit it, and updating that probability correctly and fast.

There is one formula for updating a probability correctly. There has only ever been one. This article is that formula, where it came from, the fast version quant desks actually use, and exactly how to turn it into a trade (or into code for a Polymarket trading bot).

The price is already a probability

When a market says an outcome trades at 38 cents, it is telling you the crowd’s probability for that outcome is about 38 %. On Polymarket the price and the probability are the same object.

A contract at 0.38 is a crowd standing on “roughly a 38 % chance.” That is not a metaphor. It is literally what the number means.

Every price on your screen (or in your bot’s websocket feed) is a snapshot of a belief. And a belief has a property that a stock chart hides: the correct way to change it when new information shows up is not a matter of opinion. It is a matter of math.

This is the part retail gets wrong on instinct. News drops and the untrained reaction is a feeling: “This is big, it should go way up.” How much is way up? From 38 to 45? 60? 80? The feeling has no number, so the trade has no edge.

Retail asks: is this news good or bad?

A quant (or a well-written Polymarket trading bot) asks: given this news, what is the new probability, exactly, and how far is it from the price still sitting on the order book?

The gap between those two numbers is the entire trade. And there is one formula that produces the new number.

The 1763 formula

In 1763 the Royal Society published An Essay Towards Solving a Problem in the Doctrine of Chances.

The author, Reverend Thomas Bayes, had been dead for two years. His friend Richard Price found the essay, cleaned it up, and submitted it.

Ten years later Pierre-Simon Laplace rediscovered the same idea and turned it into the foundation of modern statistical inference.

What they found is the only correct rule for updating a belief when evidence arrives:

P(HE)=P(EH)×P(H)P(E) P(H \mid E) = \frac{P(E \mid H) \times P(H)}{P(E)}

Four pieces, each plain once named:

  • P(H)P(H) - your prior. The probability of the outcome before the news. On a market this is handed to you for free: the current price.
  • P(EH)P(E \mid H) - the likelihood. If the outcome really were going to happen, how likely was this particular piece of news?
  • P(E)P(E) - how likely the news was in general.
  • P(HE)P(H \mid E) - the posterior. The updated probability after the news. This is the number your Polymarket trading bot is trying to find - the price the market should move to.

In words: your new belief is your old belief, tilted by how much more the evidence fits the world where the outcome happens than the world where it does not.

Evidence is only worth something if it would happen more in one world than the other. A headline equally likely whether or not the event occurs tells you nothing, and the formula correctly leaves the probability unchanged. Strong evidence is not loud evidence. It is evidence that separates the two worlds.

That is the whole engine. Everyone can see the news. The edge is turning it into the right number instead of a feeling - and a bot can do it in the time it takes a human to open Twitter.

The fast version desks (and bots) actually use

The classic formula is correct but clumsy because of the (P(E)) denominator. Nobody who does this for a living uses that form. They use odds:

posterior odds=prior odds×likelihood ratio \text{posterior odds} = \text{prior odds} \times \text{likelihood ratio}

The likelihood ratio (Bayes factor) is simply how much more likely the news is if the outcome happens versus if it does not: (P(E \mid H) / P(E \mid \neg H)).

A ratio of 3 means the news is three times more consistent with the outcome happening. A ratio of 1 means it is noise.

Example: market at 30 ¢. Prior odds ≈ 0.43. Likelihood ratio = 3.

posterior odds=0.43×3=1.29probability0.56 \text{posterior odds} = 0.43 \times 3 = 1.29 \quad \Rightarrow \quad \text{probability} \approx 0.56

Market is at 30. Math says 56. That is a 26-point gap that appeared the instant the news did. A Polymarket trading bot does not need the price to prove it right; it only needs to be holding (or have the limit order resting) before the crowd finishes the same calculation.

Even faster: work in log-odds. Multiplication becomes addition:

log-odds(posterior)=log-odds(prior)+log(likelihood ratio) \log\text{-odds(posterior)} = \log\text{-odds(prior)} + \log(\text{likelihood ratio})

Each new independent headline is just a number you add to a running total. Alan Turing and I.J. Good used exactly this at Bletchley Park to break Enigma. The same accumulation logic powers a modern trading model that ingests headline after headline and keeps a live posterior.

You are not predicting the event. You are computing where the price should sit after the news and trading the gap before the crowd finishes the same math.

How to turn this into a Polymarket trading bot

The theory is clean. Turning it into money comes down to four disciplined steps and a short list of ways it can blow up.

Step 1 - Let the market price be your prior

Do not invent a prior out of thin air. The current price is the crowd’s aggregated belief. Start from the price, then move it only with genuinely new evidence. Your bot should never throw out the market’s number and substitute a gut feeling.

Step 2 - Price the evidence, not the emotion

For every new piece of news ask one question: how much more likely is this if the outcome happens than if it does not? That is your likelihood ratio. Be honest and conservative - most news is weaker evidence than it feels.

Step 3 - Update, compare, and only trade a real gap

Multiply prior odds by the likelihood ratio, convert back to a probability, and compare it to the live price. If your posterior is 56 and the market is 30, that is a live edge. If the numbers are 33 vs 30, there is nothing left after fees. The formula does not just find trades; it tells the bot when to sit still - which is most of the time.

Step 4 - Respect that the edge decays as the crowd catches up

Bayesian updating tells you where the price is going, not that it will get there slowly. The entire edge lives in the window between the news landing and the crowd finishing the reprice. A well-tuned Polymarket trading bot moves inside that window or does not move at all.

Ways the formula kills people (and bots)

  • Do not double-count evidence. If the news is already in the price, its likelihood ratio for you is 1, not 3.
  • Correlated headlines are one piece of evidence. Five outlets reporting the same leak is one fact. Multiply five ratios and you will size into a gap that does not exist.
  • Garbage likelihoods produce garbage posteriors - confidently. Calibrate honestly or the math’s precision works against you.

Ready-to-run implementation

If you want a production-ready starting point that already handles multiple arbitrage and statistical strategies on Polymarket (including crypto Up/Down markets), the open-source Python bot below implements five parallel strategies with proper risk controls, signal ranking, and position sizing:

👉 https://github.com/casatrick/polymarket-arbitrage-bot-python

It is MIT-licensed, modular, and designed so you can plug Bayesian likelihood updates into the signal engine with only a few extra lines.

Essential reading

  • An Essay Towards Solving a Problem in the Doctrine of Chances - Thomas Bayes & Richard Price, 1763
  • Probability and the Weighing of Evidence - I.J. Good, 1950
  • The Theory That Would Not Die - Sharon McGrayne

Conclusion

A Polymarket price is a probability the crowd settled on a moment ago. The instant new information arrives, that probability is stale, and there is exactly one correct way to compute what it should become.

A dead reverend wrote it down in 1763. Codebreakers used it to beat Enigma. Today a Polymarket trading bot can use it to beat the crowd by a few hundred milliseconds.

You do not need to predict the future.

You need to start from the market’s own number, weigh each new piece of evidence by how strongly it separates the two worlds, update once, and act inside the short window before everyone else finishes the same calculation.

The formula was never hidden.

The edge is that most people (and most bots) still trade on a feeling about the news, while the price is quietly waiting to become a number you could have computed the second it broke.

Build the bot. Run the math. Capture the gap.

Top comments (0)