Market Data Replay Versus Resimulation
The simplest way to backtest is to replay recorded market data exactly as it happened and check whether your orders would have filled against it — but that silently assumes your own trading changes nothing, which breaks down fast for anything that trades enough size to move the market it's testing against.
Prerequisites: The Simulation Clock and Event Loop
Replay a recorded order book exactly as it happened, feed your strategy's orders into it, and check what would have filled — this is market data replay, and it's the default architecture for most backtest engines because it's simple and fast: the data never changes no matter what the strategy does. It's also quietly wrong for any strategy that trades enough size, or trades in a market thin enough, that its own orders would have actually moved the book. The recorded data has no memory of your hypothetical trades in it, because they never happened; replay just assumes the world would have unfolded identically regardless.
Resimulation: closing the feedback loop
Resimulation fixes this by modeling the strategy's own trades as perturbations to the simulated order book — an aggressive buy order doesn't just "fill against" the recorded book, it also consumes liquidity and nudges the simulated book state, so subsequent simulated fills reflect a book that's been altered by the strategy's own activity. This requires a model of market impact (how much a trade of a given size moves the book) layered on top of the raw data, since the underlying feed still only records what actually happened without you in it. Resimulation is strictly harder to build and calibrate than replay, and it introduces new modeling risk (a bad impact model can be just as misleading as no impact model), but it's the only approach that can honestly answer "what would have happened if I'd traded this much" for a strategy whose size matters.
Worked example: when the gap matters
A strategy backtested via replay trades a $2 million order against a stock whose average daily traded volume is $500 million — about 0.4% of ADV. Replay's assumption that this trade wouldn't have moved the recorded book is reasonable: the true market impact of such a small clip is likely within the noise the backtest is already ignoring elsewhere. Now take the same strategy scaled to trade $40 million in the same name, roughly 8% of ADV. Replay would still show the order filling at the recorded historical prices, but in reality a trade that size walks the book and moves the price against itself — replay would overstate the strategy's edge substantially, and only resimulation with a calibrated impact model would catch it.
What this means in practice
Replay is the right tool for small, price-taking strategies where the trader's own footprint is genuinely negligible relative to the market's turnover — most retail and modest-AUM systematic strategies fall here. Resimulation becomes necessary once a strategy's size approaches a meaningful fraction of the liquidity it trades against, which is exactly the regime where naive backtests are most likely to look artificially good, because they're silently assuming a market that doesn't react to the trader at all.
Market data replay assumes your own trading has zero effect on the market you're backtesting against — fine for small orders, misleading for large ones. Resimulation closes that loop by feeding a strategy's own fills back through a market impact model, at the cost of needing a calibrated impact model the plain replay never required.
A backtest that looks robust to strategy size — Sharpe barely changes as you scale up notional — is a red flag if it's built on plain replay rather than resimulation, since replay by construction can't show the capacity constraints that would show up in live trading.
Related concepts
Practice in interviews
Further reading
- Cont, Kukanov & Stoikov, 'The Price Impact of Order Book Events'