Backtesting

Polymarket Bot Backtesting with Full Order Book Snapshots

A practical workflow for testing Polymarket trading bots against historical full-depth snapshots before connecting them to live markets.

A Polymarket bot should be tested against the liquidity it would have faced, not only against a midpoint series. Full order book snapshots provide the bid and ask levels needed to evaluate order size, spread cost, slippage, and partial fills.

What the Backtest Should Reproduce

  • The bot's signal and decision timestamp.
  • The available bid and ask depth at that timestamp.
  • Order size, price limits, and whether the order crosses the spread.
  • Partial fills, remaining quantity, and cancellation rules.
  • Market resolution and the resulting settled outcome.

Why Midpoint-Only Results Mislead

A midpoint can look tradable even when the best quote has insufficient size. A depth-aware replay shows whether a bot would have paid multiple price levels, waited for liquidity, or failed to fill. That distinction is especially important for short-horizon BTC, ETH, and SOL Up/Down markets.

Suggested Bot Test Loop

  1. Choose a set of resolved markets and define the test period before inspecting results.
  2. Load chronological snapshots and reference-price context for each market.
  3. Generate signals using only data available at each timestamp.
  4. Simulate fills by consuming the historical book, including spread and partial-fill rules.
  5. Report PnL, drawdown, fill rate, turnover, and slippage separately.

From Replay to Live Monitoring

Once a strategy passes historical replay, compare its live implementation against current market data and monitor differences in latency, available size, and execution quality. Historical results validate the logic; they do not guarantee future returns.

Related Resources

Core Polymarket Data Resources