DEV Community

Benjamin-Cup
Benjamin-Cup

Posted on

How Quant Traders Extracted Nearly $40M in Risk-Free Arbitrage from Polymarket

Understanding the mathematics, optimization algorithms, and execution systems behind prediction market arbitrage.


Introduction

Most traders think arbitrage on prediction markets is simple.

If a market has:

  • YES = $0.62
  • NO = $0.33

the total is only $0.95.

Since one of the two outcomes must happen, there appears to be a guaranteed $0.05 profit.

Unfortunately, this isn't where professional arbitrageurs make their money.

While retail traders manually check whether YES + NO = $1, quantitative trading systems continuously solve optimization problems across thousands of related contracts simultaneously.

A 2025 research paper, "Unravelling the Probabilistic Forest: Arbitrage in Prediction Markets," documented approximately $39.7 million in guaranteed arbitrage profits extracted from Polymarket between April 2024 and April 2025.

The largest wallet alone earned more than $2 million through over 4,000 arbitrage trades.

This wasn't prediction.

It wasn't speculation.

It was mathematics.


Why Simple Arbitrage Detection Doesn't Scale

Single-market arbitrage is straightforward.

YES = $0.48
NO  = $0.52
Enter fullscreen mode Exit fullscreen mode

Everything sums correctly.

No opportunity.

But prediction markets become much more interesting once multiple logically related markets exist.

Imagine two contracts:

  • Will Trump win Pennsylvania?
  • Will Republicans win Pennsylvania by 5+ points?

These aren't independent.

If Republicans win by five points, Trump must also win Pennsylvania.

This logical dependency creates constraints that prices often violate.

Detecting these inconsistencies becomes a combinatorial optimization problem rather than simple arithmetic.


The Marginal Polytope Problem

Suppose a tournament contains 63 games.

The total number of possible outcomes is

2^63
Enter fullscreen mode Exit fullscreen mode

which equals

9,223,372,036,854,775,808
Enter fullscreen mode Exit fullscreen mode

possible worlds.

Brute-force enumeration is impossible.

Instead, quantitative systems represent logical relationships as linear constraints.

Rather than evaluating every possible outcome, optimization algorithms search only the feasible region defined by those constraints.

The paper analyzed over 17,000 market conditions, finding arbitrage opportunities in approximately 41% of them.


Bregman Projection: Finding the Correct Market Prices

Finding arbitrage is only half of the problem.

The harder question is:

What should the prices actually be?

This becomes a projection problem.

Instead of averaging prices, researchers project the observed market onto the nearest arbitrage-free probability distribution using Bregman divergence.

This preserves the information structure implied by logarithmic market makers while removing impossible probability assignments.

The guaranteed arbitrage profit equals the divergence between:

  • the observed market
  • the nearest arbitrage-free market

This provides both:

  • the optimal correction
  • the maximum guaranteed profit

Making the Optimization Tractable with Frank-Wolfe

Direct optimization over the arbitrage-free polytope is computationally infeasible.

Instead, the researchers used the Frank-Wolfe algorithm.

Rather than solving one enormous optimization problem, Frank-Wolfe repeatedly solves smaller linear programs while gradually expanding an active set of feasible outcomes.

A simplified workflow looks like this:

  1. Start with a small feasible solution.
  2. Solve a convex optimization problem.
  3. Find another promising feasible vertex.
  4. Add it to the active set.
  5. Repeat until convergence.

Instead of considering billions (or trillions) of outcomes, the optimizer often converges after only a few hundred active states.


Execution Is Harder Than Detection

Even after identifying arbitrage, execution remains difficult.

Polymarket uses a Central Limit Order Book (CLOB).

Orders are not atomic.

Suppose you plan to buy:

YES @ $0.30
NO  @ $0.30
Enter fullscreen mode Exit fullscreen mode

Expected payout:

$1
Enter fullscreen mode Exit fullscreen mode

Expected profit:

$0.40
Enter fullscreen mode Exit fullscreen mode

Reality:

YES fills βœ”
Enter fullscreen mode Exit fullscreen mode

Before the second order executes:

NO jumps to $0.78
Enter fullscreen mode Exit fullscreen mode

The arbitrage disappears.

Execution risk becomes the dominant problem.


Latency Matters More Than Block Time

Polygon blocks are roughly two seconds apart.

Many assume the blockchain creates the latency advantage.

It doesn't.

The advantage comes before the transaction reaches the chain.

Professional systems:

  • detect opportunities via WebSocket feeds
  • compute optimal positions immediately
  • submit every leg before slower traders react

By the time an arbitrage transaction appears on-chain, it has already been captured.

This is also why simple wallet copy-trading generally fails.


Architecture of a Quantitative Arbitrage System

A production-grade system typically contains several components.

Real-Time Data Layer

  • WebSocket market feeds
  • Order book updates
  • On-chain settlement monitoring

Dependency Detection

Logical relationships between markets are identified automatically.

Large language models can assist in classifying relationships, although mathematical verification remains essential.

Optimization Engine

Multiple optimization layers handle increasing complexity:

  • Linear programming
  • Frank-Wolfe optimization
  • Integer programming
  • Execution validation

Position Sizing

Trade sizes depend on:

  • order book depth
  • execution probability
  • portfolio exposure

Many systems adapt Kelly Criterion methods to account for execution risk.


Results from the Research

The paper reports approximately:

  • $39.7M total arbitrage extracted
  • $10.6M from single-market arbitrage
  • $29.0M from multi-market rebalancing

The top trader:

  • 4,049 trades
  • roughly $2 million profit
  • approximately $496 average guaranteed profit per trade

Key Takeaways

Prediction market arbitrage is far more sophisticated than checking whether:

YES + NO = $1
Enter fullscreen mode Exit fullscreen mode

Modern quantitative systems combine:

  • combinatorial optimization
  • convex optimization
  • integer programming
  • real-time infrastructure
  • execution engineering

The mathematics behind these methods has been publicly available for years.

What differentiates successful participants today is not the algorithms themselves, but the engineering required to execute them at production scale.


References

  • Unravelling the Probabilistic Forest: Arbitrage in Prediction Markets (2025)
  • Bregman Projection Methods for Market Making
  • Frank-Wolfe Optimization Literature
  • Polymarket CLOB Documentation

🀝 Collaboration & Contact
If you’re interested in building trading bots, buy trading bots, collaborating, exploring strategy improvements, or discussing about this system, feel free to reach out.

I’m especially open to connecting with:

Quant traders
Engineers building trading infrastructure
Researchers in prediction markets
Investors interested in market inefficiencies

πŸ“Œ GitHub Repository
This repo has some Polymarket several bots in this system.
You can explore the full implementation, strategy logic, and ongoing updates about 5 min crypto market here:

https://github.com/Benjam1nCup/Polymarket-trading-bot-python-V2

πŸ’¬ Get in Touch
If you have ideas, questions, or would like to collaborate or want these trading bots, don’t hesitate to reach out directly.

Feedback on your repo (based on your description & strategy)

Contact Info
Telegram
https://t.me/BenjaminCup

Top comments (0)