Basic Prerequisites: 03 · Fill-Probability Models and Probability Theory (continuous-time Markov chains, first passage).
1. Intuition & Practical Objective
A queue is not a passive line waiting for you - it is a self-exciting, self-regulating process. Trades eat the front, cancellations erode it, and new limit orders arrive in response to the queue’s own size. A queue-reactive model makes the arrival rates functions of the current queue sizes: when a queue is thin, more limit orders rush in to refill it (“liquidity begets liquidity”); when it is deep, market orders become more likely (impatient flow). This page builds the canonical tractable version - Cont, Stoikov & Talreja (2010) - and uses it to answer the question a passive trader actually cares about: conditioned on the current book, what is the probability my order fills before the price moves?
The decisive idea: the mid-price moves when one side’s best queue is emptied. So the probability that the mid moves up is the probability that the ask queue is exhausted before the bid queue. Because the two queues evolve (approximately) independently until the first move, this is a first-passage race between two birth–death processes - solvable exactly.
2. Mathematical Ground Truth & Derivations
2.1 The birth–death queue
Track one side’s queue size (orders ahead at the level), . In the Cont–Stoikov–Talreja stylisation:
- limit orders (births) arrive at rate - decreasing in distance from the touch, here a constant at the best quote;
- market orders (deaths) arrive at rate ;
- cancellations occur at rate - i.e. per-order hazard , so a batch of orders cancels at rate (each order is cancelled at an exponential time with parameter ).
The generator on state has birth rate and death rate . The process is ergodic (bounded birth rate, death rate growing linearly), so it has a stationary distribution; the queue is mean-reverting around (set birth = death: ); in the no-birth limit this is the floor . Filling corresponds to first passage to .
2.2 Queue-reactive intensities (the “reactive” part)
The general queue-reactive model lets and depend on the current queue size : (limit-order intensity) and (market-order intensity). Empirically (Huang–Lehalle–Rosenbaum and later work):
- is increasing and concave in - thin queues attract refills, but with saturation;
- is increasing and concave in - deeper queues see relatively more aggressive flow.
The CTST constant-rate model is the tractable special case; the state-dependent version trades closed forms for realism.
2.3 The mid-price-move race (exact)
Let the ask queue have orders ahead and the bid queue have . Let be their first-passage times to . Then
For the symmetric book () this is exactly by exchangeability. For the ask queue is deeper, so the bid empties first and . The probability can be obtained either (i) by a Laplace-transform inversion of the first-passage density (CTST §4, using continued fractions for ), or (ii) by solving the backward equations on the product chain - the method used below, which is exact up to a truncation.
The truncation: cap queue sizes at and treat births beyond as no-ops (the queue cannot grow past the engine’s practical depth). With large relative to the starting sizes, the answer is accurate to several decimals.
2.4 Execution-before-price-move
The same machinery answers “does my order fill before the price moves away?”: it is the probability that my side’s outflow reaches my position before either best queue is exhausted. CTST §4.3 computes this with the Laplace transform of the minimum of independent first-passage times - the rigorous version of the heuristic used in practice.
3. Computational Implementation - exact race vs simulation
We solve the backward equations for on the product chain and validate against a Gillespie simulation of the two independent birth–death queues.
The exact backward-equation solution and the simulation agree to ~2 decimals (within ). The economics is immediate and is the core of queue-reactive price prediction: the side with the thinner queue is more likely to be eaten first, so a thin ask relative to the bid predicts an upward move (probability for ), and a deep ask predicts a downward move ( for ). This conditional-on-book-state probability is exactly what CTST’s Laplace methods compute in closed form and what real market-making systems compute in production.
4. Failure Modes & First-Principles Breakdowns
- Constancy of rates. The tractable model makes constant; real intensities are queue-reactive (state-dependent) and self-exciting (Hawkes clustering). Using constant rates mis-prices the probability of a fast two-sided sweep.
- Independence of the two queues. CTST assumes the bid and ask queues evolve independently until the first move. In reality aggressive buy flow co-moves with aggressive sell flow (common aggression); the independence approximation understates the probability of a rapid move to one side.
- Truncation error. Capping the queue at biases first-passage probabilities once starting sizes approach ; always place the cap well above the relevant range and check convergence.
- Equilibrium drift vs transient. The ergodic distillation describes the stationary regime; intraday non-stationarity (open/close, news) means the calibrated parameters are averages that no single moment respects.
- Forgetting the fill-vs-move race. The price-move probability is not the fill probability. You must compute whether your position clears before the move - a strictly harder first-passage problem.
5. References
- Cont, Stoikov & Talreja (2010), Operations Research 58(3), 549–563
- Huang, Weibing; Lehalle, Charles-Albert; Rosenbaum, Mathieu - “Simulating and analyzing order book data: the queue-reactive model,” J. American Statistical Association 110(509), 107–122 (2015)
- Gould et al. (2013)
- Rosu (2009)
6. Connected Graph Bridges
- Back: 03 · Fill-Probability Models · Index Hub
- Forward: 05 · Failure Modes & Practice · 06 · Advanced Extensions
- Price-impact bridge: Market Impact & Depth (OFI, square-root law)
- Base: Probability Theory · 02 · The Order Queue