Basic Prerequisites: Probability Theory and Market Microstructure & Order Types. (these are the folder-level prerequisites for pages 02–06; page 01 states its own, smaller, entry requirements)
1. Intuition & Practical Objective
A passive limit order does not fill on arrival. It joins a queue and waits for enough order outflow from the front to reach it. Under price-time priority (FIFO) that outflow is trades (market orders) plus cancellations that happen ahead of you. Your fill odds are therefore not a property of the price - they are a property of your queue position.
This folder is the queue-and-fill topic-folder for Pillar 2. It is a hub: it gives you (a) the fast formula lookup below (job #1) and (b) routes you to six sub-pages that go from zero-knowledge intuition, through the mechanics of the book and the matching engine, to analytic fill-probability models, queue-reactive dynamics, the failure modes that bleed a desk dry, and the modern extensions (multi-venue overbooking, OFI price impact, Hawkes arrivals).
The one-sentence essence. “Your fill probability is governed by the outflow process in front of you, not by how attractive your price looks: under FIFO you fill when (cumulative outflow ahead exceeds your queue position ), so the queue position is the single control variable a passive trader actually manages - and it is exactly the variable a naive backtest ignores.”
Scope note (vs the siblings). This folder is the micro-event view - will this order fill, and when. For the aggregate view of price movement see Optimal Execution & Almgren–Chriss (scheduling a block) and Market Impact & Depth (how fills move the price). The three meet at the order-flow-imbalance variable.
Primary verified sources: Cont, Stoikov & Talreja (2010); Cont & Kukanov (2017); Cont, Kukanov & Stoikov (2014); Gould et al. (2013); Lo, MacKinlay & Zhang (2002); Rosu (2009); Foucault, Pagano & Roell, Market Liquidity Ch 4–6; Hasbrouck, Empirical Market Microstructure Ch 6–10. All numbers below were re-executed and reproduced (see §3).
2. Mathematical Ground Truth & Derivations
Notation. = orders (shares) ahead of your order in the FIFO queue at your price; = total depth at that price; = your order size; = market-order (trade) arrival rate at your price; = limit-order arrival rate at your price; = per-order cancellation rate; = cumulative outflow from the front of the queue over ( trades cancels ahead); = per-tick trade-arrival probability (discrete models).
The fill condition (price-time priority). Under strict FIFO, an order of size at queue position receives
You start filling once outflow passes , and you finish once it passes . This is the fill function of Cont & Kukanov (2017) and the object every queue model is trying to predict.
Quick-Reference Lookup - the fast facts of this folder (all reproduced in §3):
| Quantity | Formula | Verified check |
|---|---|---|
| Fill condition (FIFO) | sim: trade-printed coverage vs true (8,000 ahead) | |
| Outflow composition | (trades cancels ahead) | cancels lift from to at |
| Cancel-ahead probability (uniform cancels) | position 25 / depth 200 → | |
| Fill time, pure trades | ; mean | mean ticks |
| Fill probability within (pure trades) | : closed , MC | |
| Mean-field queue position | , | crossing s () |
| Cancel-only crossing | (never reaches 0 in finite mean) | halving time s |
| Mid-move-up probability (CS&T) | for two indep. birth–death queues | : exact , MC |
| OFI price impact (2014) | fitted slope vs , | |
| Adverse selection | fill $0.0119 vs no-fill + $0.0166 per 100 sh |
Critical framing caveat. (queue position) and (depth) are different variables and both matter. Deep total depth is good for spreads but bad for you if is large: your fill odds fall with but the adverse-selection penalty falls with . Calibrating on alone is the single most common modelling error.
3. Computational Implementation - the fill-probability engine
Runs on the standard library only here (pages 04 and 06 additionally use numpy). It reproduces every verified number above: the negative-binomial closed form matches the Monte Carlo fill rate, the mean-field ODE brackets the Gillespie simulation, and the exact Markov-chain mid-move probability matches simulation to ~2 decimals (within ).
4. Failure Modes & First-Principles Breakdowns
Hub signposts - the full failure analysis lives in 05 · Failure Modes & Practice. In one line each:
- The standing-queue delusion - a backtest that treats “a trade printed at my price” as “I was filled” overstates the fill rate ( vs true here) and books P&L on trades that never happened.
- Latency & stale-quote pick-off - the fraction of fills that are adverse grows with your round-trip latency ( goes as latency goes ms in the toy model).
- Adverse selection at the fill - : passive fills are systematically followed by unfavorable moves (fill $0.0119 vs no-fill + $0.0166).
- Cancel-and-reinsert is not free - re-joining the queue after a cancel puts you at the back; every refresh trades queue position for a marginally better price.
5. References
- Cont, Rama; Stoikov, Sasha; Talreja, Rishi - “A stochastic model for order book dynamics,” Operations Research 58(3), 549–563 (2010). *The foundational tractable queue model: independent Poisson queues, birth–death first-passage, Laplace-transform conditional probabilities.
- Cont, Rama; Kukanov, Arseniy - “Optimal order placement in limit order markets,” Quantitative Finance 17(4), 553–571 (2017). *The fill function $(\xi-x)^+
- Cont, Rama; Kukanov, Arseniy; Stoikov, Sasha - “The price impact of order book events,” Journal of Financial Markets 17, 47–88 (2014). *The linear OFI price-impact law
- Lo, Andrew W.; MacKinlay, A. C.; Zhang, June - “Econometric models of limit-order executions,” Journal of Financial Economics 65(1), 31–71 (2002). The classic empirical survival/hazard model of limit-order execution times - “how long until I fill or cancel.”
ADV - Gould, Martin D.; Porter, M. A.; Williams, S.; McDonald, M.; Fenn, D. J.; Howison, S. D. - “Limit order books,” Quantitative Finance 13(11), 1709–1742 (2013). Structured empirical survey: price-time vs pro-rata, cancel-to-trade ratios, latency effects on conditional event studies. arXiv:1012.0349.
ADV - Rosu, Ioanid - “A dynamic model of the limit order book,” Review of Financial Studies 22(11), 4601–4641 (2009). Equilibrium LOB; the “hump” shape in depth vs distance and the trade-off between matching optimism and fill pessimism.
ADV - Foucault, Thierry; Pagano, Marco; Roell, Ailsa - Market Liquidity: Theory, Evidence, and Policy (OUP, 2013)
- Hasbrouck, Joel - Empirical Market Microstructure (OUP, 2007)
6. Connected Graph Bridges
- Foundational base: Probability Theory (Poisson processes, first passage, Laplace transforms) · Stochastic Calculus (CTMC generators)
- Sibling in-pillar: Market Microstructure & Order Types (order-type menu, maker–taker fees) · Low-Latency Systems Architecture (how latency enters the queue) · Optimal Execution & Almgren–Chriss · Hardware Acceleration & FPGA
- Market-making view: Adverse Selection & Glosten–Milgrom · Avellaneda–Stoikov & Optimal Quoting · Market Impact & Depth