Modelling Fill Probability for a Resting Order
A passive order is a race between two clocks — the queue in front of you draining, and the price walking away. Estimating who wins is what decides whether you post or cross.
Prerequisites: Queue Position and Priority, Order Book Mechanics
You want to buy 500 shares. The book is 100.00 bid / 100.01 ask, and there are 4,000 shares already resting at the bid ahead of you. Cross the spread and you pay half a cent per share, guaranteed. Post at the bid and you might earn half a cent instead — if you fill. Everything hangs on that "if", and "if" is a number you can estimate.
The clean way to think about it is a race between two clocks:
- The depletion clock. Shares in front of you disappear, either traded away by incoming market sells or cancelled by their owners. When the count reaches zero, you are at the front.
- The adverse clock. The price leaves. The bid ticks down, or the level is swept — and either way, your order either never fills or fills at exactly the wrong moment.
You fill if and only if clock 1 finishes first.
Putting numbers on the race
Measure the flow at your price level over a normal hour. Market sells hit this bid at about 1,200 shares per minute, and orders ahead of you cancel at about 800 shares per minute. Together the queue in front of you drains at
With shares ahead, clearing the queue takes about minutes, or 120 seconds.
Now the other clock. Suppose the time until the bid moves away is roughly exponential with a mean of seconds — a memoryless waiting time, which is the standard first approximation for "when will something happen that I can't predict". The chance it holds out past 120 seconds is
In English: you need the price to sit still for two minutes, and it typically only manages ninety seconds, so you fill about a quarter of the time. The same formula sweeps out the whole curve, with shares being the "distance" the queue typically drains before the price moves:
| Shares ahead | 0 | 1,000 | 2,000 | 4,000 | 8,000 |
|---|---|---|---|---|---|
| 1.00 | 0.72 | 0.51 | 0.26 | 0.07 |
The decision this number is for
Fill probability is not interesting on its own. It is an input to post or cross, and the trap is forgetting what happens when you don't fill.
Buy 500 shares, mid $100.005. Cross now: pay the $100.01 ask, a cost of +0.005 versus mid.
Post at $100.00 instead. With probability 0.26 you fill at 100.00, a gain of 0.005 versus the mid. With probability 0.74 you don't — and non-fills are not random. You fail to fill precisely when buyers took over, so conditional on missing, the mid has drifted up by an average of, say, 0.008 and you now cross at 100.018, a cost of +0.013 versus your original mid. Expected cost of posting:
Crossing costs 0.005; posting costs 0.0083. Cross. Set the two equal and the break-even fill probability is — you need better than a coin flip here before patience pays.
Never optimise fill probability itself. Optimise against . A passive order that always fills is usually a passive order that is always on the wrong side.
How it is actually estimated
- Discrete-choice models. Fit a logistic regression or gradient-boosted model of fill-within-horizon on features: shares ahead, queue imbalance, spread in ticks, short-horizon volatility, own order size, time of day, and recent trade intensity. Cheap, and usually the production model.
- Survival analysis. A resting order has three exits — fill, cancel, price move — so the right frame is competing risks, with a hazard rate for each. Cox or Kaplan–Meier handles the censoring that a plain classifier silently gets wrong.
- Structural queue models. Cont–Stoikov–Talreja treat each level as a birth–death process (limit orders add, market orders and cancels subtract) and compute the first-passage probability that your side empties first. The queue-reactive model of Huang, Lehalle & Rosenbaum makes the arrival intensities depend on the book state, which matters because they very much do.
Always pair a fill-probability model with a markout model. Bucket historical fills by predicted probability and look at the mid five seconds later: the high-probability buckets frequently show the worst markouts, because the easiest fills come from queues being swept.
Fitting on your own order history is selection-biased twice over. Your algo only posted when conditions already looked favourable, so the sample is not representative; and your own order changes the queue it is measuring, especially in size. Validate against a full order-by-order book replay where you can place hypothetical orders, not just against the fills you happened to get.
In interviews
Expect "you're 4,000 deep in the queue — do you fill?" Do not answer with a number, answer with the race: quote a depletion rate, quote a horizon over which the price stays put, and divide. Then pivot unprompted to the economics — the break-even fill probability calculation above is the answer that separates candidates, because it shows you know that missed fills are adversely selected too. See Queue Position and Priority for what determines and Adverse Selection for why some fills are worth less than they look.
Related concepts
Practice in interviews
Further reading
- Cont, Stoikov & Talreja (2010), A Stochastic Model for Order Book Dynamics
- Moallemi & Yuan (2016), The Value of Queue Position in a Limit Order Book
- Huang, Lehalle & Rosenbaum (2015), Simulating and Analyzing Order Book Data: The Queue-Reactive Model