Basic Prerequisites: Market Microstructure & Order Types and Queue Position & Fill Probability. (these are the folder-level prerequisites for pages 02–06; page 01 states its own, smaller, entry requirements)
1. Intuition & Practical Objective
A signal backtest asks “if I could trade at the price series, would this rule have made money?” An execution backtest asks the harder question: “given the order I actually sent, into the book that actually existed, with the latency I actually have - did it fill, at what price, and what did that cost?” The two are different sciences. The first needs a price series; the second needs a model of the matching process, because a fill is not a price observation - it is the outcome of a queue, a priority rule, and market impact.
This folder is the execution-backtesting-and-simulation topic-folder for Pillar 2. It is a hub: it gives you (a) the fast formula/decision lookup below (job #1) and (b) routes you to six sub-pages that go from zero-knowledge intuition, through why execution backtests lie, the fill model, market replay vs Monte Carlo, the failure modes that make a simulated edge evaporate in production, and the modern extensions (agent-based LOB simulators, simulator validation).
The one-sentence essence. “An execution backtest is only as honest as its fill model: you must simulate whether an order fills from the outflow ahead of it in the queue - - and you must price the post-fill adverse drift; a backtest that equates a printed trade with your fill, looks past the decision time, or assumes trading at the mid will report an edge that does not exist.”
Scope note (vs the siblings). This folder is the meta view: how to simulate and validate any execution logic. The micro-event mechanics (queue position, fill probability) live in Queue Position & Fill Probability; the scheduling of a block lives in Optimal Execution & Almgren–Chriss; the statistical honesty of a signal backtest lives in Backtesting Hygiene (multiple testing, deflated Sharpe). This folder is where those three meet at the fill assumption.
Primary verified sources: Hasbrouck, Empirical Market Microstructure (2007) Ch 14–15 (implementation shortfall, effective/realized cost, order placement) and Ch 3 (Roll bounce); Almgren & Chriss (2000); Almgren, Thum, Hauptmann & Li (2005); Cont & Kukanov (2017); Cont, Stoikov & Talreja (2010); Gould et al. (2013); Abergel et al., Limit Order Books (2016); López de Prado, Advances in Financial Machine Learning (2018) Ch 11–13. All numbers below were re-executed and reproduced (see §3).
2. Mathematical Ground Truth & Derivations
Notation. = shares ahead of your order in the FIFO queue; = level depth; = your size; = cumulative outflow from the front (trades + cancels ahead) over the quote’s life; = trade-arrival rate; = quoted spread; = round-trip latency; = participation rate; = efficient (mid) price, = trade price.
Quick-Reference Lookup (job #1). All formulas below were re-executed and reproduced numerically (§3); the “Verified check” column carries the exact run output.
| Quantity | Formula | Verified check |
|---|---|---|
| FIFO fill condition | replay: optimistic vs FIFO | |
| Fill probability by (Poisson trades) | , | : closed |
| Expected fill (exponential outflow) | (MC ) | |
| Fill fraction vs queue position | , | |
| Fill time (pure trades) | , mean | mean ticks at |
| Latency pick-off | ms ; ms | |
| Implementation shortfall (Perold) | Hasbrouck Ch 14, eq 14.1 | |
| Effective vs realized cost | impact | |
| AC expected cost / impact | temp. impact : $25,000 → $1,250 | |
| Square-root impact law (idealized) | with | toy ln-ln fit exponent , |
| Realized-impact exponent (empirical, Almgren et al. 2005) | with | the empirical exponent is steeper than the idealized - see Market Impact & Depth |
| Market replay estimate | one path | replay vs MC mean CI |
| Monte Carlo standard error | ; |
Critical caveat. (outflow) and (depth) enter differently. A backtest that fills on ” traded” ignores the queue ahead and is the single most common lie; a backtest that fills on “any print at my price” ignores both queue and size. And cancels ahead are not trades - they are a large, correlated part of (Gould et al. 2013), so ignoring them is the bias in the opposite direction (under-filling a real quote, over-filling a backtest that only counts trades).
3. Computational Implementation - the fill-model engine
Runs on the standard library (plus numpy for one regression). It reproduces every verified number above: the Cont–Kukanov expected-fill closed form matches Monte Carlo, the FIFO binomial fill fraction falls with queue position, and the naive “any print” rule saturates at .
Read it as the whole folder in miniature: the binomial closed form and its Monte Carlo agree to ~3 decimals (the model is simulable); and the naive fill rule is fine when you are at the front of the queue and catastrophic when you are not - exactly the regime a backtest with no queue awareness cannot see.
4. Failure Modes & First-Principles Breakdowns
Hub signposts - the full failure analysis lives in 05 · Failure Modes & Practice. In one line each:
- Optimistic fills (the standing-queue delusion). Treating “a trade printed at my price” as “I filled” books fills that never happened; measured on 05 (F1), the naive rule booked 800 shares where FIFO fills 234 ( overbooking).
- Ignoring the queue. The fill condition is , not ; no-queue fills can overstate edge by nearly an order of magnitude ($16.00 vs $1.86 per order).
- Look-ahead in replay. Deciding the fill from data after the cancellation/decision time inflated from to in the toy replay.
- Latency omission. Your modeled fill assumes you acted instantly; real quotes are stale for and the fraction of adverse fills rises with it ().
- Ignoring your own impact. A backtest that assumes your order does not move the price omits a cost that scales as ($25,000 on a 1-day 100k-share liquidation - not a rounding error).
5. References
- Almgren, Robert; Chriss, Neil - “Optimal execution of portfolio transactions,” Journal of Risk 3(2), 5–40 (2000). The permanent/temporary-impact cost model an execution simulator must calibrate (, , , ).
ADV - Almgren, Thum, Hauptmann & Li - “Direct estimation of equity market impact,” Risk 18(7), 58–62 (2005). The empirical impact parameters a realistic simulator is calibrated to; the square-root/power-law shape.
ADV - Hasbrouck, Joel - Empirical Market Microstructure (OUP, 2007)
- Cont, Rama; Kukanov, Arseniy - “Optimal order placement in limit order markets,” Quantitative Finance 17(4), 553–571 (2017). The fill function and its use as a simulation primitive.
ADV - Cont, Stoikov & Talreja - “A stochastic model for order book dynamics,” Operations Research 58(3), 549–563 (2010). *The tractable queue model fast enough for Monte Carlo fill simulation
- Gould, Porter, Williams, McDonald, Fenn & Howison - “Limit order books,” Quantitative Finance 13(11), 1709–1742 (2013). The survey listing the stylized facts any credible execution simulator must reproduce (and the cancel-to-trade ratios that break naive fills).
ADV - Abergel, Anane, Chakraborti, Jedidi & Toke - Limit Order Books (Cambridge, 2016). Agent-based LOB simulation and order-placement micro-simulation used to test execution logic.
ADV - López de Prado, Marcos - Advances in Financial Machine Learning (Wiley, 2018)
6. Connected Graph Bridges
- Foundational base: Probability & Measure Theory (Poisson processes, first passage) · Numerical Methods (Monte Carlo, standard error) · Econometrics & Time Series (Roll bounce, autocovariance)
- Sibling in-pillar: Queue Position & Fill Probability (the fill model in depth) · Optimal Execution & Almgren–Chriss (the cost model to calibrate) · Execution Algorithms: VWAP, TWAP, POV · Low-Latency Systems Architecture (where latency enters) · Market Microstructure & Order Types
- Cross-pillar: Backtesting Hygiene (the signal-backtest half of the honesty problem) · Market Impact & Depth (the impact an execution simulator must reproduce)