Prediction markets like Polymarket let you buy and sell contracts on the outcome of real-world events. A contract trading at 65 cents implies a 65% probability that the event happens. When the market is wrong, there's money on the table.
The challenge: finding those mispricings consistently. That's where automated trading bots come in. A well-calibrated win probability model can scan hundreds of live games simultaneously, compare its fair value estimate to the market price, and execute trades when the edge exceeds a threshold.
The Architecture
A sports prediction trading bot has four components:
- Data feed — Live game state from ESPN, official league APIs, or specialized providers
- Prediction model — Converts game state (score, time, period) into a win probability
- Signal engine — Compares model fair value to market price, applies filters (min edge, spread, staleness)
- Execution layer — Places fill-or-kill orders on Polymarket's CLOB with slippage protection
Step 1: Getting Live Win Probabilities
The hardest part of building a prediction bot isn't the trading logic — it's the model. Training a calibrated win probability model requires historical play-by-play data, feature engineering (score differential, time remaining, period, home/away, team strength), and careful calibration to ensure your predicted probabilities match actual outcomes.
Most teams spend months building these models from scratch. An alternative is using a pre-built API that serves calibrated probabilities across multiple sports.
Example API Call
curl "https://zenhodl.net/v1/predict?sport=NBA&home=BOS&away=MIA&home_score=58&away_score=52&period=3&clock=4:30"
{
"home_wp": 0.724,
"away_wp": 0.276,
"confidence_interval": [0.68, 0.77],
"model": "split_phase_xgboost",
"calibrated": true,
"ece": 0.002
}
Step 2: Finding the Edge
Edge is the difference between your model's fair value and the market price. If your model says a team has a 72% chance of winning but the market is pricing it at 60 cents, you have a 12-cent edge.
Not all edges are real. Key filters that separate profitable signals from noise:
- Minimum edge threshold — Edges under 8-10 cents rarely survive slippage and fees
- Maximum edge cap — Edges over 25 cents are often the model being wrong, not the market. Counterintuitive but validated by live trading data
- Spread filter — Wide bid-ask spreads (6+ cents) eat your edge on entry
- Period filter — Some game periods are more predictable than others. Late-game trades typically have higher win rates
- Toss-up exclusion — Avoid contracts priced 45-55 cents. True coin flips with negative EV after fees
Step 3: The Signal Loop
The bot runs a continuous loop: poll game states, compute fair values, compare to market prices, and fire signals when all filters pass.
while running:
games = fetch_live_games() # ESPN API
for game in games:
fair_wp = model.predict(game) # Your model or API
market_price = get_ask(game) # Polymarket WebSocket
edge = fair_wp - market_price
if edge > MIN_EDGE and passes_filters(game, edge):
place_order(game, size=calculate_size(edge))
sleep(0.5) # 500ms tick interval
Step 4: Execution
Polymarket uses a Central Limit Order Book (CLOB). The safest execution method is Fill-or-Kill (FOK): you either get your full fill at or below your limit price, or the order is cancelled. No partial fills hanging in the market.
Critical execution details:
- Use WebSocket prices for signal detection (1-15ms latency vs 200-300ms for HTTP)
- Pass reference price to skip the HTTP orderbook fetch on execution (saves 200ms)
- Verify on-chain settlement after CLOB match confirmation
- Track slippage (difference between signal price and fill price) to monitor execution quality
Step 5: Calibration and Recalibration
A model calibrated on historical data will drift when applied to live markets. The specific games where your model disagrees with the market are not a random sample — they're games where one of you is wrong. This adverse selection effect means your live win rate will be lower than your backtest win rate.
The fix: a live recalibrator that tracks model predictions vs actual outcomes and applies isotonic regression to correct for drift. After 50+ resolved trades, the correction activates and adjusts future predictions automatically.
Skip the model-building phase. Get calibrated win probabilities for 10 sports via API.
Start Free Trial →What to Expect
Realistic expectations for a well-built prediction trading bot:
- Win rate: 55-65% across a diversified sports portfolio
- Per-trade profit: +3 to +12 cents average
- Losing streaks: 5-8 consecutive losses are normal. Position sizing matters
- Edge decay: Markets get more efficient over time. Continuous recalibration is essential
- Best sports: MLB (late innings), NHL (1st period), and tennis (mid-set) tend to have the most exploitable mispricings
The key insight from running a live bot across 400+ trades: the model doesn't need to be perfect. It needs to be calibrated. A model that says 70% and is right 70% of the time will print money at any entry price below 70 cents. A model that says 90% but is right only 70% will lose everything.