Guide

Choosing a sample size for Polymarket backtests

A backtest over ten trades tells you almost nothing; over a thousand it tells you something. This page covers how the archive's sample parameters work and how many observations a result actually needs before you believe it.

What this guide covers

  • Backtest AI defaults to sampleSize 25 and accepts a larger sample
  • The days parameter bounds the lookback (1 to 30 depending on plan)
  • 5,005 crypto markets are archived, split 3,467 5m / 1,436 15m / 102 4h
  • A win rate measured on a small sample has a wide confidence interval

The parameters

Backtest AI samples 25 markets by default, which is a starting point, not a study. You can raise sampleSize and set days to control the lookback window. The report then summarizes results across the sampled markets.

Plan limits matter here: the free Starter plan bounds days to roughly one day of history, while paid plans reach the full 30. A wide sample over many short-horizon markets is often more informative than a narrow sample over a long window.

How many is enough

The confidence interval on a win rate narrows with the square root of the sample. Roughly, a rate measured on 25 trades has a standard error near 10 percentage points - enough to make a 55% and a 45% strategy indistinguishable. You need hundreds of observations before small edges separate from noise.

Because the archive holds thousands of 5-minute markets, that many observations is reachable in days of history. Using 25 markets is a smoke test; use it to reject clearly broken ideas, not to confirm good ones.

Rough standard error on a win rate by sample size
SampleApprox. standard error
25~10%
100~5%
400~2.5%
1000~1.6%

Correlation shrinks effective sample

Markets in the same window move together, so a thousand trades taken across a few correlated windows are not a thousand independent observations. The effective sample size is smaller than the trade count, sometimes much smaller.

Spread trades across assets and across time rather than clustering them in one volatile window. The backtester's days window and max_trades_per_market both push toward this by spreading observations over history.

Sample size and overfitting

More data does not prevent overfitting by itself - tuning many parameters on a large sample can still fit noise. The right use of a larger sample is to split it: fit on part, score on the rest, which is what walk-forward testing does.

So treat sample size as the raw material, not the answer. Pull enough markets that a holdout is meaningful, then reserve part of the sample for out-of-sample scoring rather than spending all of it on the fit.

Code examples

import requests

BASE = "https://api.polyorderbooks.com/v1"
HEADERS = {"X-API-Key": "your-key", "Content-Type": "application/json"}

# Same strategy, two sample sizes: does the result hold up?
for n in (25, 200):
    body = {"prompt": "buy sol 5m up on a 0.1% reference tick",
            "sampleSize": n, "days": 7}
    r = requests.post(f"{BASE}/ai/backtest", headers=HEADERS, json=body)
    r.raise_for_status()
    rep = r.json()["report"]
    print(f"n={n}: win_rate={rep['win_rate']} pnl={rep['total_pnl']}")

Free tier

The Starter plan is free, includes order books, prices, and metrics at 250ms resolution, with 3 days of history, 60 requests/min, 1,000/day, 1 free AI backtest, and 3 strategy backtests. No credit card required.

Paid data windows from $19/mo extend history to 30–120 days at higher throughput. Backtest AI add-on is +$19/mo or standalone at $29/mo.

FAQ

What is the default sample size?

25 markets. That is a smoke test, not a study - it cannot separate small edges from noise.

How many trades do I need to trust a win rate?

Hundreds. The standard error on a win rate falls with the square root of the sample, so 25 trades give roughly a 10-point error and 1,000 give about 1.6.

Does a big sample prevent overfitting?

No. Large samples still overfit if you tune many parameters. Split the sample: fit on part, score on a holdout, as walk-forward testing does.

What does the days parameter do?

It bounds the lookback window - roughly 1 day on the free Starter plan and up to 30 on paid plans - which controls how much history the sample draws from.