Queue-Position Inference Under Partial Observability: Slippage Modeling Playbook
Date: 2026-03-07
Category: research (execution microstructure)
1) Why this matters
In FIFO markets, passive execution quality is largely a queue-position problem. If your queue estimate is too optimistic, you over-wait, miss fills, and panic-cross later. If it is too pessimistic, you cross too early and pay unnecessary spread/impact.
For many venues, we do not have perfect market-by-order visibility. We often run with market-by-price (aggregated depth), meaning queue rank is latent. This creates a structural slippage leak unless queue uncertainty is modeled explicitly.
Core idea:
Treat queue position as a hidden state with uncertainty, not a single deterministic number.
2) Scope and assumptions
This playbook focuses on passive child orders at best bid/ask (extendable to deeper levels):
- Venue: FIFO or mostly FIFO behavior
- Data: top-of-book or MBP depth updates + trades + own order lifecycle
- Objective: reduce implementation shortfall tails (p95/p99), not just average bps
Out of scope:
- Pure pro-rata matching venues
- Hidden/iceberg queue inference from full MBO-only logic
- Options complex books with package matching specifics
3) Data contract (minimum viable)
You need event-time aligned records:
Market data
ts_event,ts_recv- best bid/ask price+size
- level size deltas at our working price level
- prints/trades at our working price level
Own order events
- send/ack/replace/cancel/fill timestamps
- working price/size
- venue/order-id linkage
Latency telemetry
- send→ack, ack→book-appearance (if observable), market-data delay distribution
Without this, queue calibration becomes guesswork.
4) Hidden-state queue model
Let:
Q_t: visible total queue at our price level at timetS: our resting sizeV_t: latent size ahead of our order (front queue)B_t = max(Q_t - S - V_t, 0): size behind
4.1 Initial estimate at insert/ack
Use a conservative initialization around order acknowledgment:
- baseline:
V_t0 = Q_t0 - optional correction: blend send-time and ack-time queue snapshots
This follows practical guidance from queue-estimation literature and practitioner notes (e.g., Rigtorp method family).
4.2 Event updates
When queue size at our level decreases by ΔQ < 0, we split that decrease into:
- executions that definitely reduce front queue
- ambiguous decreases (likely cancels/modifies) that only probabilistically reduce front queue
A common parametric form:
p_front = f(V_t) / ( f(V_t) + f(B_t) )
with monotone f such as:
- identity:
f(x)=x - log:
f(x)=log(1+x) - power:
f(x)=x^n
Then expected front reduction from ambiguous shrinkage:
E[ΔV_amb] = p_front * |ΔQ_amb|
and we update:
V_{t+1} = max(V_t - ΔV_exec - E[ΔV_amb], 0)
4.3 Distribution, not point estimate
Track uncertainty around V_t (e.g., particles or quantile bands).
Useful outputs per order:
q10/q50/q90of queue-ahead- fill probability in horizon
H:P(fill <= H)
5) Slippage decomposition with queue uncertainty
For each decision point (keep / reprice / cross):
E[cost] = P_fill * C_fill + (1 - P_fill) * C_no_fill
Where:
C_fill: spread capture/fees + expected adverse markout after fillC_no_fill: delay cost + chase cost + possible queue-reset tax from cancel/replace
Critical: P_fill must come from the queue posterior, not naive depth heuristics.
6) Practical control state machine
Define execution states from queue uncertainty + calibration drift:
TRACKED
- queue uncertainty low
- live calibration healthy
- normal passive logic
UNCERTAIN
- uncertainty medium OR mild calibration drift
- reduce passive dwell time, tighten cancel thresholds
BLIND
- uncertainty high OR stale/missing feed episodes
- cap passive exposure, favor smaller clips or safer aggression
SAFE
- severe drift or repeated tail breaches
- fallback to conservative baseline execution policy
Use hysteresis to avoid state flapping.
7) Calibration and monitoring
7.1 Offline calibration targets
For horizon buckets (e.g., 100ms/500ms/1s/5s):
- Brier score for fill probability
- reliability curves (predicted vs realized fill rates)
- quantile calibration for queue-ahead posterior
Tune:
- function family
f(identity/log/power) - power exponent
n - latency compensation parameters
7.2 Live monitors (must-have)
- Fill Calibration Error (FCE): predicted fill rate minus realized
- Queue Rank Error (QRE): posterior queue-ahead vs realized time-to-fill proxy
- No-Fill Regret (NFR): missed fill opportunity + chase penalty
- Queue Reset Tax (QRT): incremental cost from cancel/replace cycles
Alert on p95 deterioration first; mean bps can look fine while tails degrade.
8) Backtest/live alignment traps
Trade-first optimism
- Assuming only prints move your rank underestimates queue advancement uncertainty.
Cancel attribution errors
- Treating all depth shrinkage as front-queue removal overestimates fill odds.
Latency blindness
- Ignoring send/ack/feed lag shifts queue rank materially in fast books.
Regime pooling
- One global parameter set across open/close/news windows often fails calibration.
Selection bias
- Evaluating only filled orders hides no-fill opportunity cost.
9) Rollout plan (safe path)
Shadow mode
- compute queue posterior and action recommendations, but do not trade on them.
Canary lanes
- small symbol/venue subset with strict kill-switch on calibration drift.
Dual policy comparison
- baseline vs queue-aware policy with matched market regimes.
Promotion gates
- require improvements in p95 slippage and no-fill regret, not only mean IS.
Automatic fallback
- if FCE/QRE breach thresholds for sustained interval, revert to baseline.
10) Minimal pseudo-implementation
for each resting order o:
init posterior V ~ P0(queue_ahead | Q_ack, latency)
on market event e at order price:
if trade at level:
update V with deterministic front reduction component
if depth decrease ambiguous:
compute p_front = f(V)/(f(V)+f(B))
update posterior with probabilistic front reduction
derive fill_prob(H), queue_ahead_quantiles
compute keep/cancel/cross expected costs
pick action under current state constraints
periodically:
calibrate predicted fill probs vs realized
update state TRACKED/UNCERTAIN/BLIND/SAFE
11) What “good” looks like
- Fill-probability calibration stable across intraday regimes
- Lower p95 implementation shortfall with no completion collapse
- Reduced panic-cross episodes caused by late queue realization
- Explicit, measurable queue-model drift alarms
If your desk treats queue rank as exact when data is partial, slippage is mostly a delayed accounting issue. If your desk treats queue rank as uncertain but measurable, it becomes a controllable execution risk.
References (starting points)
Erik Rigtorp, Estimating Order Queue Position
https://rigtorp.se/2013/06/08/estimating-order-queue-position.htmlhftbacktest docs, Queue Models
https://hftbacktest.readthedocs.io/en/v1.8.4/reference/queue_models.htmlYu et al., Fill Probabilities in a Limit Order Book with State-Dependent Stochastic Order Flows (arXiv:2403.02572)
https://arxiv.org/abs/2403.02572