Backtesting

Why Mid-Price Backtests Lie: The Polymarket Depth Data Problem

Mid-price Polymarket backtests miss spread, depth, slippage, and partial fills. Learn why historical order book depth is required for realistic execution testing.

Mid-price backtests lie when they treat the displayed midpoint as an executable price. In Polymarket and other prediction markets, the gap between the midpoint and the price you can actually fill can erase the entire strategy edge.

The Depth Data Problem

The free live APIs are useful for current markets, top-of-book checks, and signal logic. They do not give you a complete historical record of every bid and ask level at every point in the past. Without that depth history, a backtest cannot answer the execution question: what would my order have actually filled at?

What Mid-Price Backtests Miss

  • Spread cost: buying at the ask and selling at the bid is not the same as trading at the midpoint.
  • Depth: the first level may not be large enough for your order size.
  • Partial fills: thin markets often fill only part of the requested quantity.
  • Price impact: larger orders walk the book and change the average execution price.
  • Market-close liquidity: depth can disappear exactly when a strategy wants to exit.

How Full Order Book History Fixes It

PolyHistorical stores 300ms snapshots of the full UP and DOWN order books. A realistic simulator can replay each historical book, cross the bid/ask ladder, calculate volume-weighted fill price, and mark unfilled quantity instead of pretending every order filled at the midpoint.

Execution-Aware Backtest Checklist

  1. Use the bid for sells and the ask for buys.
  2. Walk multiple price levels for orders larger than top-of-book size.
  3. Track partial fills separately from fully executed trades.
  4. Subtract fees and spread costs from PnL.
  5. Reject signals that only work before slippage.

Related Resources

Core Polymarket Data Resources