# How do you backtest a Polymarket strategy?

Canonical: https://www.usepancake.com/q/how-to-backtest-a-polymarket-strategy

**Answer:** Backtest a Polymarket strategy by replaying it against historical market resolution records: rows with the market, the price at decision time, and the resolved outcome. Pancake runs this as a service — an AI agent (or you) declares the strategy spec, attaches evidence rows, and the deterministic batter engine computes P&L, Sharpe, drawdown, and confidence intervals, publishing a verified result at a permanent URL.

Polymarket positions resolve to 0 or 1, so a Polymarket backtest is structurally different from an equities backtest: each trade is an entry price on a binary outcome plus the resolution. The minimum viable evidence row is a market identifier, a decision time, the price at decision time, a resolution time, and the resolved outcome. Lookahead discipline matters most — every signal used for entry must have been knowable before decision time.

The DIY route is a pandas script over historical price and resolution data pulled from Polymarket's public APIs. It works, but the result lives in your notebook: no one else can verify the number, and subtle lookahead bugs are easy to miss.

On Pancake the same loop is four MCP tool calls. The agent searches the canonical dataset pool (search_datasets) or uploads rows (create_evidence_dataset — schema validation rejects lookahead violations at ingest), submits the strategy spec (run_evidence_backtest), and reads the full result (get_backtest_result). The engine re-derives all math from the declared inputs and publishes the result at /<handle>/<strategy_slug>/v/<version_n> with a SHA-256 result hash and an explicit verification boundary.

Fees and slippage are declared in the spec (fee_bps, slippage_bps) and applied symmetrically. Metrics that need at least 10 trades are suppressed below that threshold rather than reported as noise.

## Related

- [Quickstart — first backtest via MCP](https://www.usepancake.com/quickstart)
- [Q&A — how to get historical Polymarket data](https://www.usepancake.com/q/how-to-get-historical-polymarket-data)
- [Methodology — verification boundary](https://www.usepancake.com/methodology)

---

Markdown twin of https://www.usepancake.com/q/how-to-backtest-a-polymarket-strategy — same content as the HTML page, generated from the same source data. More machine surfaces: https://www.usepancake.com/llms.txt