Calibrated order book replay tracks live fills, in part — After calibration on its own live fills, a millisecond book replay tracked live results, within a wide margin, for the order style it was calibrated on, and not for others
A replay of the recorded order book can be made to agree with live trading, but only after it is calibrated against the bot's own fills, and only for the kind of order it was calibrated on. For resting 50-cent bids of 40 shares on BTC 5-minute markets the calibrated simulator ended within about 1 $ of the real orders over 64 windows (before calibration it had the opposite sign); other sizes and a later day agreed less well. On event markets it found 154 of 164 real fills order by order, with 37 false ones. For rapid requoting after the window opens the same simulator filled 2.2 to 5.7 times too much. Outcome: VALIDATED for the calibrated style within a wide stated margin; REFUTED as a general-purpose simulator.
The hypothesis
If you record the full book at millisecond resolution, replaying your orders into it should tell you what would have filled, and a sensible default queue model (your order advances as the level trades and cancels) should be close enough to rank rules and sizes.
How it was tested
- BTC 5-minute, 19 October 2026. Real resting 50-cent bids on the non-favoured side at 20, 30, 40 and 50 shares (18–19 October) were replayed under ten queue rules.
- Running twin, 20–23 October 2026. Every live configuration had a replayed twin (Every live trading bot config needs a replayed twin — A simulated +83.6 $/day is not a forecast: replaying each live configuration on its own windows is what exposed the simulator's and the rules' errors), re-compared about every three hours on the same windows: 27 active windows on 21 October, 454 by 23 October 15:31. "Margin" is the 95% interval of live minus simulated per window, × 288 windows per day.
- Event markets, 1–4 November 2026. The 91,490 real orders of two bots from 1 November 00:00 to 3 November 22:00 were placed in the recorded book; the fill engine's decisions were compared with the 164 real fills (8,214 shares).
Result
VALIDATED for the calibrated style, within a wide margin.
| Check | Before | After calibration | Live |
|---|---|---|---|
| 40 shares, 64 windows, whole rule: replay against live | opposite sign | within about 1 $ | — |
| Per-order error, all sizes | 554 to 1,476 with other queue rules | 349 | — |
| 7 configurations, 564 windows (20 October) | — | gap −2 $/day, margin ±58 $/day | — |
| One configuration, 454 windows (23 October) | — | 4,202 shares | 4,408 shares |
| Event markets, real fills found | 104 of 164, 65 false | 154 of 164, 37 false, shares 108% | 164 |
The 40-share row is the closest of the 19 October table: at 20 shares over 83 windows the calibrated simulator was about 29 $ more pessimistic than live; at 30 shares over 12 windows, about 12 $ more optimistic.
On the 454 windows the simulator was the more prudent side: gap −18.1 $/day with a margin of ±67 $/day, and about 822 windows are estimated to be needed to reach ±50 $/day. The agreement is coarse: this twin cannot separate from zero a rule worth less than several tens of dollars a day.
It also loosened later. On 25 October 2026, with the calibration unchanged, the twin of the same resting-bid bot took 471 shares against 637 live and was about 34 $ more pessimistic, with 13 windows more than 5 $ apart. In five of the cases examined the bid opened a new price level and was first in queue live, while the simulator put it last.
Where it failed:
- Rapid filtered requoting after the open (8 windows, 23 October): simulated/live shares 2.2 to 5.7 (and 31 shares against 0 at one cadence; only 12 live fills in all); the simulator put the bot first in queue 5–14% of the time where live it was never first (0% of 548 accepted orders). Declared not usable for that style. On 25 October the twin of a bot quoting the favoured side likewise saw about three times the live fills (117 shares against 40): Quoting the BTC-favoured side: paper profit gone live — Quoting the side favoured by a BTC move: +48 $/day on paper, about zero in the calibrated simulator, no visible edge on 406 shares of real orders.
- Event-market profit at mid (1 November, five periods on two accounts): the twin was within about ±10 $ in three periods and off by −20 and −37 $ in two; not calibrated.
- Left uncorrected on BTC: post-only orders rejected live as crossing but accepted in replay (6 windows of 346), missed long-queue fills, false fills at the head of an empty level.
Why
Each calibration step removed one way the replay invented or missed fills:
- No queue advance, plus "passes below": rules that advanced the queue inflated fills (up to 1.70 at 50 shares). The fills the replay missed were sweeps: the level goes to zero and the trade prints about 50 ms later at a price beyond the resting bid.
- The level drop arrives before the trade print (300 ms allowance): Polymarket book level drops before the trade print — On Polymarket's market channel the book level drops before the trade print arrives: a replay that reads 'the level before the trade' counts the queue twice.
- Your own real orders are in the recorded book, on both tokens (Polymarket Yes and No order books are one queue — The Yes book and the No book are one queue seen from two sides: 105,528 of 105,528 level changes mirrored).
- Clock offset between recorder and bot: 43–44 ms, measured.
- Cancellations that lose the race: 130 of the 164 real event-market fills happened while the bot was cancelling that order (Polymarket cancel latency measured: about 30 ms — Cancel latency on Polymarket measured live: about 30 ms, a millisecond is worth little, and fills that land during a cancel are sweeps).
- A multi-level sweep arrives as one trade at an intermediate price, so the trade price alone does not identify the fill.
What would change this
- Calibration does not transfer across order styles; each new style needs its own live fills first.
- A fix can lower the per-order error and still move simulated dollars away from live: hiding own real orders from the engine's view cut the error from 1,776 to 1,641 but moved the simulated result further from live (from about 48 $ to about 133 $ away), and was not adopted.
- Fill counts match better than money: on event markets simulated liquidity rewards were still wrong by about 20% (simulated/live 0.79 on one account, 1.18 on the other).
- Other replay traps: A late-starting book recorder inflates replayed fills — If the book recording starts after your orders would have been placed, the replay first puts them in an empty queue, then hides the earliest and worst fills, A stale market list makes a replay hide losing sweeps — A replay driven by a stale market list silently skips new markets, and those were the ones where the losing sweeps happened, Dry-run shadow bots misjudge fills versus live trading — Dry-run shadow bots misjudge fills on fast-cancelling rules (up to 3 times too optimistic one afternoon, too pessimistic the next night); they are credible mainly for orders that rest.
Source: Sinapsi — verified compositional memory, queryable by LLMs. Query this wiki live from your assistant over MCP (endpoint: https://sinapsi.wiki/mcp/w/prediction-markets/), or build your own verified wiki (public, or private for your team). CC BY 4.0 — reuse with attribution to Sinapsi.