Backtester
Backtester replays historical CLOB snapshots and the full report archive through the live execution path at tick resolution.
What it does
Backtester replays historical CLOB snapshots and the full report archive through the live execution path at tick resolution. It runs in replay mode (mode=replay), consuming archived ObservationReport, DecisionReport, RiskVote, ExecutionReport, and SettlementReport envelopes and re-executing the strategy under test against them. It emits replay-tagged OperationsReport records (and replay-tagged copies of every simulated report kind) to polytraders.reports.operations, partitioned by bot_slug+epoch, retained for 1 year. Backtester is used by the governance team to validate parameter changes, A/B test strategies, and produce audit-quality evidence before any strategy is promoted to live. Backtester never signs orders or touches the live CLOB.
Pipeline placement
Applies to: All strategy bots configured for replay; any historical OrderIntent window specified via start_ts/end_ts
Why it matters
| If this fails | Consequence |
|---|---|
| Strategy promoted to live without backtesting | Untested parameter changes or new strategy logic may produce runaway losses or adverse fills on live capital. Backtesting is a mandatory gate before promotion. |
| Backtester uses different execution path than live | Results are not comparable to live performance. Governance audit evidence is invalid and cannot be used to justify promotion decisions. |
| Replay-tagged reports not emitted | Backtesting runs are not auditable. Governance cannot produce the required evidence trail for strategy promotion gates. |
| Parameter sweep runs with non-deterministic inputs | Results are not reproducible. Successive backtests on the same window may produce different outputs, making comparison and audit impossible. |
Inputs
Polymarket inputs
| Input | Source | Required | Use |
|---|---|---|---|
| Historical CLOB snapshots (order book + trades, tick-level) | internal | required | Primary replay data source. Backtester reconstructs the order book state at each tick from the archived snapshot stream. |
| Archived ObservationReport envelopes | internal | required | Replay pre-trade intelligence signals as they existed at the original observation time. |
| Archived DecisionReport envelopes | internal | required | Reconstruct the original strategy decisions for comparison against replayed decisions. |
| Archived RiskVote envelopes | internal | required | Reconstruct risk guardrail votes that were in effect during the replay window. |
| Archived ExecutionReport envelopes | internal | optional | Compare simulated fill outcomes against actual historical fills for slippage and fill-quality analysis. |
| Archived SettlementReport envelopes | internal | optional | Replay post-trade P&L settlement to reconstruct the full governance evidence trail. |
Internal inputs
| Input | Source | Required | Use |
|---|---|---|---|
| Strategy configuration under test | Config store | required | Parameters (or parameter sweep grid) for the strategy being backtested. |
| KillSwitch active flag | KillSwitch | optional | When KillSwitch is active, suppress new backtesting run launches. Runs already in progress may continue. |
Authority
What this bot is permitted to do
State
Readiness
Limited live
Status
beta
Class
Governance Service
Default mode
limited_live
Developer owner
Polytraders core — Governance pod
Capital impact
Indirect
Reason codes emitted
| Code | Severity | Meaning | Action |
|---|---|---|---|
| BACKTESTER_REPLAY_COMPLETE | INFO | A replay run completed successfully; aggregate OperationsReport emitted. | No action — routine completion. |
| BACKTESTER_TICK_PROCESSED | INFO | A single tick was processed during replay; per-tick OperationsReport emitted. | No action — operational heartbeat. |
| BACKTESTER_INVALID_WINDOW | HARD_REJECT | start_ts >= end_ts; the replay window is invalid. | Reject the run configuration; emit alert. |
| BACKTESTER_UNKNOWN_STRATEGY | HARD_REJECT | The strategy slug specified in the config is not in the strategy registry. | Reject the run; emit alert. |
| BACKTESTER_WINDOW_CLAMPED | WARN | end_ts was in the future; clamped to now(). | Clamp end_ts; emit WARN; continue replay. |
| BACKTESTER_TICK_SKIPPED | WARN | A tick was missing from the archive; the replay skipped that tick. | Log WARN; skip tick; continue from next available tick. |
| BACKTESTER_ARCHIVE_UNAVAILABLE | HARD_REJECT | The report archive is entirely unavailable; the replay cannot start or has stalled. | Abort the run; emit alert. |
| BACKTESTER_LARGE_SWEEP | WARN | Parameter sweep has more than 50 variants; resource throttle applied. | Emit WARN; apply run throttle; continue sweep. |
| KILL_SWITCH_ACTIVE | WARN | KillSwitch is active; new backtesting run launches are suppressed. | Suppress new run; emit WARN; in-progress runs continue. |
Related bots in Governance & Ops
Used by
Reverse index — strategies that currently reference gov.backtester. If you change this bot's authority or reason codes, these strategies must re-pass shadow.
| Strategy | State | Activity |
|---|---|---|
| NBA H2H — moneyline market-make | demo-wired | last triggered 31m ago |
| US Elections — sentiment fade | demo-wired | last triggered 38m ago |
| BTC weekly — close-aware quotes | demo-wired | last triggered 45m ago |
Showing 3 of 3 · demo-wired ≠ production-live
Why this matters
Governance & Ops bots does NOT propose, approve, or block trades; only observes and reports. Understanding the authority boundary prevents misuse and makes promotion-gate reviews faster and more reliable. View raw spec JSON →