How do I backtest a prediction market strategy without look-ahead bias?
Replay each decision using only records whose availability timestamp precedes the simulated order time. Store raw venue payloads with receive time, version market rules and fee schedules by effective date, and never join the final outcome or later-corrected metadata into features. Run a deliberately contaminated comparison to quantify leakage.
Define availability time, not event time
Start with an event-time table and a separate availability-time table. Event time is when a price, rule change, or resolution happened; availability time is when your process could first have known it. For Kalshi, the REST order book is a point-in-time read, while changes require the orderbook WebSocket channel. Timestamp the payload you actually received, not the market's nominal update time. Store the raw JSON and the receipt clock; do not overwrite it with a normalized timestamp later.
Caching and transport break naive timestamps. Kalshi market and event GETs can be served from a shared cache for up to five seconds, so a fresh local receipt may contain stale venue data. Polymarket's CLOB Market Channel is the public stream for book, price, and lifecycle updates. Keep both receive time and any venue-provided timestamp; when they disagree, use the later availability bound for conservative replay. If only a venue timestamp exists, add a conservative ingestion lag rather than assuming instant visibility.
Version rules, fees, and resolution state
A backtest must replay the contract as it existed at decision time. Polymarket resolution rules define the source, end date, and edge cases; those rules are the contract, not the title. For UMA-resolved markets, the proposal and challenge process can extend resolution: the published timeline shows a two-hour challenge period and four to six days when disputed. Never expose a winning outcome before that path completes; Chainlink TWAP up-down markets are non-UMA and resolve deterministically from the same stream.
Fees also need effective dating. Polymarket US sets the fee coefficient when an order is inserted, and an order placed during its onboarding window keeps that coefficient if it fills later. Use the schedule version effective at insertion, not at fill or run; the published US schedule starts 12:00 AM ET, November 14, 2026. On a Polymarket US standard taker fill, fee is Θ × C × p × (1 − p); applying today's tier to an old order is a classic contamination.
Build the replay and a contaminated control
Construct two feature stores from the same raw archive. The clean store uses an as-of join: each feature must have availability time at or before the simulated decision. The contaminated store deliberately joins later metadata, final fee tiers, end-of-day books, or the resolution outcome. Run both through identical order logic. The difference is your leakage estimate; if the contaminated Sharpe is much higher, investigate joins before believing the strategy. Pre-register the join keys and lag assumptions so the clean and contaminated runs differ only in leakage.
Worked example, all numbers hypothetical: at T1 a clean replay sees a $0.60 YES ask for 100 contracts and a Polymarket US Tier 4 coefficient of 0.0695. Fee = 0.0695 × 100 × 0.60 × 0.40 = $1.668, rounded to $1.67. The contaminated run uses the later $0.66 ask and the eventual winning outcome as a feature. The clean run books the order at $0.60 plus $1.67 fee and carries unresolved exposure separately.
Separate locked capital, exposure, and leakage
Report three ledgers: realized P&L, locked capital, and unresolved outcome exposure. A resting bid locks cash but creates no outcome exposure until filled; a filled position creates exposure until resolution. A backtest that nets these into one equity curve hides liquidity and settlement risk. Keep cash reservation, mark-to-market, and final settlement as distinct timestamps and fields. This prevents a high-turnover strategy from looking profitable merely because it never reserves cash for open orders.
Audit failure cases explicitly. Reject rows timestamped by event date when ingestion was later; reject metadata with no version; reject fee schedules applied by run date; and reject any resolution label available before the venue's resolution timestamp. Treat cached Kalshi responses as stale for at least their cache window. Never generalize Polymarket US fee rules to Polymarket International or to Kalshi; venue and contract scope are separate. Log the exclusion reason for every rejected row so sample shrinkage is visible.
| Timeline stamp | Clean replay uses | Contaminated shortcut |
|---|---|---|
| T0 market metadata | Version available at T0; retain raw payload | Final corrected rules and ticker metadata |
| T1 book snapshot | Snapshot received at T1; flag cache age | Later best bid or end-of-day book |
| T2 order inserted | Fee coefficient effective at T2 | Final fee tier or fill-date coefficient |
| T3 resolution | Outcome exposed only after resolution time | Winning outcome joined to pre-T3 features |
Assumptions and scope
- Historical raw payloads include receive timestamps and venue timestamps; otherwise reconstruct only a conservative upper bound.
- The backtest handles one venue and contract family at a time; cross-venue equivalence needs separate rule matching.
- Fee examples use the Polymarket US standard taker formula and Tier 4 coefficient; other venues and tiers need their own schedules.
- Resolution timing follows each venue's published process; actual disputes can vary. This is not a forecast of dispute frequency.
Sources and verification
- Kalshi order book conventions
Source checked Nov 15, 2026. - Kalshi API changelog
Source checked Nov 15, 2026. - Polymarket API surfaces
Source checked Nov 15, 2026. - Polymarket resolution mechanisms
Source checked Nov 15, 2026. - Polymarket US fee schedule
Source checked Nov 15, 2026.
Prepared by Skybit Research with AI assistance and automated source checks. Examples and assumptions are identified in the article. No human reviewer is implied. Check the exact contract and current venue documentation before applying a method.