Datastudy

Arbitrage on Polymarket: Theory, Practice, and Code

Oct. 31, 2025

Lars Datastudy
Lars Cornelissen • Follow
Data Science Engineer, Owner
AI Researcher
Datastudy AI • Follow
AI Researcher

6 min read

Arbitrage on Polymarket: Theory, Practice, and Code
Polymarket is a decentralized prediction market where people trade “Yes” or “No” shares on real-world events using USDC. Each share pays $1 if the event happens, $0 otherwise - so its price is the implied probability.

If markets were perfectly efficient, all outcomes of one event would sum to $1. In reality, they don’t.

That’s where arbitrage lives - the art of locking in risk-free profit from price inconsistencies.

Over the last year, researchers found thousands of inefficiencies across Polymarket, worth tens of millions in guaranteed profit.

Let’s unpack the science and code behind this.

1. Single-Market Arbitrage

The simplest setup: a binary market should obey
Price(Yes) + Price(No) = 1.00.

If it doesn’t, you can lock in free money.

Example

Outcome   Price   
Yes        0.52   
No         0.47

They sum to 0.99 → you buy both for $0.99 and get $1 back no matter who wins.

That’s a 1% profit - risk-free.

It’s even juicier in multi-option markets.

During the 2024 election, “Biden wins”, “Trump wins”, and “Other wins” once summed to $0.98.

Buying one of each guaranteed a 2% gain.

Quick Detection Code

# Detect single-market arbitrage
markets = [
    {
        "name": "2024 US Election",
        "outcomes": [
            {"name": "Biden", "price": 0.49},
            {"name": "Trump", "price": 0.48},
            {"name": "Other", "price": 0.01},
        ],
    }
]

for m in markets:
    total = sum(o["price"] for o in m["outcomes"])
    if total < 1:
        print(f"[+] Buy all outcomes in '{m['name']}' for {total:.2f} → risk-free profit")
    elif total > 1:
        print(f"[-] Short all outcomes in '{m['name']}' for {total:.2f} → overvalued market")
[+] Buy all outcomes in '2024 US Election' for 0.98 → risk-free profit

2. Cross-Market Arbitrage

Now it gets more interesting.
Imagine two related markets:

  • “Will Trump win the presidency?”
  • “Will a Republican win the presidency?”

Logic says:

P(Trump wins) ≤ P(Republican wins)

because Trump is one specific Republican.

If the market violates that - e.g., Trump 0.30, Republican 0.25 - you can do this:

  • Buy No on “Trump wins” (0.70)
  • Buy Yes on “Republican wins” (0.25)

No matter what happens, one of them pays $1, and the combo costs $0.95.

That’s a 5% arbitrage.

Simple Detector

# Detect logical mispricing across markets
markets = {
    "Trump wins presidency": 0.65,
    "Trump wins GOP primary": 0.60
}

if markets["Trump wins presidency"] > markets["Trump wins GOP primary"]:
    print("Logic violation detected!")
    print("Buy 'No' on presidency and 'Yes' on primary.")
Logic violation detected!
Buy 'No' on presidency and 'Yes' on primary.

3. Bayesian Reasoning for Arbitrage

Pure arbitrage is rare; statistical arbitrage is scalable.

You build a model that continuously updates probabilities from new data.

Example:

If you model that “Fed rate cut” is 80% likely given a recession, and only 20% otherwise:

P(FedCut) = 0.8 * P(Recession) + 0.2 * (1 - P(Recession))

If Polymarket says recession = 30% and FedCut = 50%, then:

expected = 0.8*0.3 + 0.2*0.7
expected
0.38


The market overprices rate cuts - a shorting signal.

Such conditional logic can be encoded in Python:

def conditional_prob(p_recession, p_cut_given_rec, p_cut_given_no_rec):
    return p_cut_given_rec * p_recession + p_cut_given_no_rec * (1 - p_recession)

p_market = 0.50
p_model = conditional_prob(0.3, 0.8, 0.2)

if p_market > p_model:
    print("Fed cut overpriced, consider shorting.")

4. Bet Sizing with the Kelly Criterion

Finding edges is one thing; sizing them is another.

The Kelly fraction tells you what percentage of your bankroll to risk:

f∗=1−qp−q​

p = your estimated probability

q = market probability (price)

Example:

p, q = 0.5, 0.4
f = (p - q) / (1 - q)
print(f"Optimal fraction to bet: {f*100:.1f}%")
Optimal fraction to bet: 16.7%

This maximizes long-term growth - but beware of correlation between bets.

Many traders use “half-Kelly” to stay conservative.

5. Automation: Turning Theory Into Code

Manual trading can’t keep up.

Bots use Polymarket’s API or WebSocket streams to read prices and act instantly.

Core loop:

from time import sleep

def monitor_and_trade(api):
    while True:
        markets = api.get_markets()
        for m in markets:
            total = sum(o['price'] for o in m['outcomes'])
            if total < 0.99:
                api.buy_all(m['id'])
            elif total > 1.01:
                api.short_all(m['id'])
        sleep(1)  # rate limit

Advanced bots also:

  • Track related markets (like primaries → presidency)
  • Watch news APIs and auto-update probabilities
  • Execute via signed wallet transactions within milliseconds

Traders often deploy these bots on low-latency servers and connect to blockchain mempools to anticipate big trades - similar to MEV bots in DeFi.

6. The Game Theory Behind It All

Polymarket arbitrage is a speed game.

The first bot to detect and execute gets the profit.

Everyone else just restores equilibrium.

That competition makes Polymarket gradually more efficient - yet small inefficiencies persist, especially in illiquid or slow-updating markets.

It’s a live example of markets acting as self-correcting probabilistic machines.

7. Key Takeaways

  • Mispricings are measurable and automatable.
  • Bayesian logic lets you model interdependent events.
  • Kelly sizing optimizes growth from repeated small edges.
  • Automation is non-negotiable if you want to compete.

In Short

Polymarket arbitrage is not inherently gambling - it’s quantitative engineering.

You’re building a pipeline that senses inconsistencies, calculates probability logic, and executes trades faster than human reaction time.

Prediction markets are the perfect playground for developers who think in math, data, and code - and who enjoy turning theory into guaranteed profit.