Polymarket Historical Data

Polymarket Historical Data API for Backtesting Trading Strategies

Use the Polymarket historical data API from PolyHistorical to backtest prediction market trading strategies with real order book data — completely free.

Want to backtest trading strategies on Polymarket? The Polymarket historical data API from PolyHistorical gives you the real order book data you need — for free.

Why Backtest with Real Polymarket Historical Data?

Backtesting against synthetic or simulated data gives you false confidence. Real historical order book data reveals how your strategy would have actually performed, including:

  • Realistic fill simulation — see if your orders would have been filled at the depth available
  • Slippage estimation — understand how order book depth affects your execution price
  • Spread dynamics — factor in real bid-ask spreads, not theoretical midpoints
  • Liquidity patterns — identify when markets are thick or thin

API-Powered Backtesting Workflow

  1. List markets via GET /v1/markets to find BTC 5m markets in your target date range
  2. Fetch snapshots for each market via GET /v1/markets/{slug}/snapshots?include_orderbook=true
  3. Replay the order book snapshot by snapshot in your backtesting engine
  4. Simulate order execution against real depth at each timestamp
  5. Calculate performance metrics — PnL, Sharpe ratio, max drawdown

Python Example

import requests

API_KEY = "your_free_api_key"
headers = {"X-API-Key": API_KEY}

# Get a resolved BTC 5m market
markets = requests.get(
    "https://api.polyhistorical.com/v1/markets",
    params={"coin": "BTC", "market_type": "5m", "resolved": True, "limit": 1},
    headers=headers
).json()

slug = markets["markets"][0]["slug"]

# Fetch all snapshots with order book
data = requests.get(
    f"https://api.polyhistorical.com/v1/markets/{slug}/snapshots",
    params={"include_orderbook": True, "limit": 1000},
    headers=headers
).json()

# Replay and backtest
for snap in data["snapshots"]:
    price_up = snap["price_up"]
    price_down = snap["price_down"]
    # Your strategy logic here

Free Tier for Backtesting

The Starter plan includes recent BTC market history — enough to build and validate strategies before committing to Pro. No credit card, no trial expiration. Just sign up and start backtesting with real Polymarket historical data.

Related Resources