Cancel-Ahead and Queue Decay Models
Just because 1,000 shares are queued ahead of your resting order doesn't mean 1,000 shares of trading is needed before you fill — plenty of that size will cancel before ever being hit, and a simulator that ignores this understates how fast a passive order actually reaches the front of the line.
Prerequisites: Price-Time Priority Matching Rules
A resting order with 1,000 shares queued ahead of it will not, in practice, wait for a full 1,000 shares of trades to pass through before filling. A meaningful chunk of that ahead-queue size belongs to other participants who will simply cancel — pulling a stale quote, reacting to news, adjusting a hedge — long before their order is ever hit by an incoming trade. A simulator that only advances queue position on trades, and treats every unit of ahead-queue size as permanent until traded through, systematically underestimates how quickly a passive order climbs the queue and gets filled.
Modeling cancellation as its own process
The fix is to model cancel-ahead explicitly: alongside trades reducing the queue, treat cancellations of orders ahead of yours as a separate random process that also reduces your position in line, calibrated from historical cancel rates observed in the message feed. A simple version models the ahead-queue size as decaying via two independent effects — trades that remove size uniformly at random from the queue, and cancellations that occur at some empirically estimated rate per unit time, applied to whatever ahead-queue size currently remains. In plain English: your effective wait time is shorter than "shares ahead ÷ trading rate" would suggest, because the queue is leaking from cancellations the whole time you're waiting, not just being consumed by trades.
Worked example: two ways to estimate time-to-fill
An order joins the queue with 1,000 shares resting ahead of it. The stock trades at roughly 200 shares per minute at this price level, and historical data shows resting orders at this level cancel at a rate of about 15% of remaining ahead-queue size per minute.
- Trade-only model (ignores cancellations): time to clear 1,000 shares at 200 shares/minute minutes.
- Trade + cancel-ahead model: each minute, roughly 200 shares clear via trades and about 15% of what's left cancels. Minute 1: trades remove 200, leaving 800, then cancellations remove , leaving 680. Minute 2: trades remove 200 (480 left), cancels remove (408 left). Continuing this way, the ahead-queue clears to zero in roughly 3 minutes rather than 5 — cancellations alone account for a large share of the reduction.
The gap between these two estimates — 5 minutes versus roughly 3 — is exactly the kind of overstatement of wait time that ignoring cancel-ahead produces, which for a market-making strategy directly translates into understated fill rates and understated realized spread capture.
What this means in practice
Cancel-ahead modeling is essential for realistically simulating passive, liquidity-providing strategies — market making, passive execution algorithms — where fill rate and time-to-fill are central to the economics. It requires calibrating cancellation rates from the actual message feed (L2 or L3 data, since cancellations aren't visible in trade prints alone) rather than assuming a fixed rate, since cancel behavior varies significantly by symbol, time of day, and market regime.
Orders queued ahead of yours don't just clear via trades — they also cancel, and ignoring that makes a simulator understate how quickly a passive order reaches the front of the queue and fills. A cancel-ahead model estimates queue decay from both trading volume and an empirically calibrated cancellation rate, not trading volume alone.
Related concepts
Practice in interviews
Further reading
- Cont, Stoikov & Talreja, 'A Stochastic Model for Order Book Dynamics'