Backtest your Polymarket bot
on data you can't get anywhere else.
Lookahead-safe backtests across 4,900+ resolved markets, scored by Brier and calibration, live today. Plus a tick-level order-book archive we capture live that no API will sell you back. Your agent writes the Python and calls our MCP. You read the result.
Free to try, no card. One plan when you're ready: $59/mo.
Driven from the agent you already use
The moat is the data
Any agent can write the loop. None of them can record the book.
The reason a generic coding agent tells you to “just backtest it locally” is that for stocks and crypto the data is everywhere. For Polymarket it isn't. The order book is not a download. It exists only in the moment it streams, and then it is gone. We keep it.
Captured live, right now
A persistent collector holds an open connection to the CLOB market feed and writes full L2 snapshots, every placement and cancellation, and every trade print to cold storage. The archive deepens every hour it runs, which is the one asset a competitor can't clone after the fact.
Order-book archive: live since 21 May 2026.
Resolved, on-chain
Every outcome is stitched to its Polygon ConditionalTokens settlement, with disputed UMA resolutions flagged so your strategy can exclude them. No guessing which side paid out.
Honest fills
Taker fees applied per category with Polymarket's own formula. As the book archive matures, fills walk the real ladder at that timestamp instead of assuming the midpoint. Your backtested edge survives contact with the spread.
How it works
Describe the bot. Read the calibration. Decide.
Tell your agent the idea
It calls Bagtester
[mcp:bagtester] polymarket_submit_bot
You read the result
What comes back
A calibration curve, not a vibe.
Every backtest returns a structured result your agent can act on directly: Brier score, log-loss, the 10-bucket calibration curve, edge captured in basis points, by-tag PnL, the equity curve, and 11 prediction-market quality flags that tell you when not to trust the number.
- Brier, log-loss and calibration on every run
- PnL split by tag: politics is efficient, sports is fadeable
- Quality flags for small samples and single-market dependence
- One shared cash pool across every market
equity, net of fees + spread
Plain Python
Ten lines. Your agent writes them.
A strategy is a class. The engine runs it across the filtered universe and hands back the structured result. Hand-write it or let the agent draft it from a sentence.
from bagtester.polymarket import PolymarketStrategy
class TimeDecayCarry(PolymarketStrategy):
"""Buy cheap YES on long-dated markets, hold to resolution."""
def on_market_update(self, ctx):
yes = 0
if ctx.portfolio.has_position(ctx.market.condition_id, yes):
return
price = ctx.current_price(yes)
if price is None or price >= 0.20:
return
days = (ctx.market.effective_resolution_ts_ns
- ctx.now_ns) / 86_400e9
if days > 30:
ctx.buy(yes, size_usdc=20.0)> claude-code: backtest time-decay carry on
2024 politics markets
[mcp:bagtester] polymarket_submit_bot
✓ ran 612 markets in 0.9s (vectorized)
result:
total_return: +19.9%
brier_score: 0.187
log_loss: 0.51
edge_captured: +214 bps
markets: 612
next_steps:
→ polymarket_optimize_bot {threshold, days}
→ polymarket_walk_forward for out-of-sampleCorrectness, not a config knob
A bot can't peek at the outcome. There is no flag to let it.
Lookahead bias is the way prediction-market backtests lie to you. We block it three ways, and none of them can be turned off.
No reading the future outcome
Touching market.final_outcome before the effective resolution timestamp raises LookaheadError. The result is not visible until time has passed it.
No trading after resolution
ctx.buy or ctx.sell after the effective resolution raises LookaheadError. You cannot fill an order in a market that has already settled.
No future prices
ctx.current_price(ts=future) raises LookaheadError. A strategy only ever sees the price as of now, never a bar that hasn't happened.
One plan
Free to see the data. $59 to ship on it.
The free tier exists so you can confirm the data is real before you pay. One paid plan, because real-money bot builders need the whole thing, not a feature ladder.
Free
$0
Confirm the data is real.
- 12-hour price-series backtests
- Up to 50 markets per backtest
- Brier, calibration, quality flags
- Midpoint fills
- 1 API key
Recommended
Pro
$59/mo
The whole archive, full scale.
- Full resolved universe, no per-backtest cap
- Tick and L2 order-book data as it lands
- Order-book fills, real spread
- Parameter sweeps + walk-forward
- Concurrent backtests
- Spot cross-market data for crypto bots
- Persistent strategy library
Common questions