Skip to content
All library documents

Estimating Limit Order Queue Position from Market Data

Article Quant Q&A · Author: Sam Hayen

Summary

The document describes how to estimate the volume ahead of and behind a limit order when exchange acknowledgements and public market data arrive asynchronously. With an order-by-order feed such as ITCH, a system can identify its own order directly, though it must reconstruct the book. Otherwise, the proposed method estimates the delay between private order messages and public feed updates using observed fills, then uses that delay to locate the order’s added quantity at its price level.

After initialization, the estimator tracks displayed volume at that price. Increases are assigned to orders behind the trader; decreases are allocated between volume ahead and behind under either a conservative assumption or a probability rule based on their relative sizes. The answer identifies hidden orders, venue-specific priority, internalization, synchronization error, and occasional inconsistencies as limitations. It presents a practical model, not measured accuracy or a guarantee of exact queue rank.

Key ideas

  • An order-by-order feed can reveal queue rank if the trader can identify its own order and reconstruct the book.
  • Without that feed, estimate the delay between private order messages and public market data using observed fills.
  • Use the delayed public book update to estimate displayed volume ahead of the new order.
  • Treat subsequent volume increases as behind the order and allocate decreases using a conservative or probabilistic rule.
  • Hidden liquidity, venue rules, internalization, and feed synchronization can make the estimate inaccurate.

Tags

Full text
# how do we estimate position of our order in order book queue?


# how do we estimate position of our order in order book queue?












The order of order events and acks is not deterministic or guaranteed. Note that when we send an order to exchange, we get acknowledgement back from exchange, followed by market data add order event for our order. At the same time, we will receive order events for other orders. The order of these is not guaranteed.

## Answer by lehalle (score 13)

https://quant.stackexchange.com/a/3810

You have two ways to estimate your position in an order book:

- first if you have access to an ITCH feed, you can recognize your order into the ITCH updates, and know exactly where you are, but you will have to build an engine to translate an order-by-order ITCH feed to a limit order book;

- or you have to use estimates; the easiest way to build one is to follow this process:

- you are right on the fact that the synchronisation of the messages you have back from the market on your own orderbook and the feed describing the state of the market (the public orderbook) is often far from perfect. You can nevertheless build an estimate of the delay $\hat \delta$ between these two feeds. You can do this when you obtain a fill or partial fill, you know when you have it back via a direct message from the market (say, at time $t_1$) and when you can see it on the public feed (say, at time $t_2$), you know at such events that for your $n$th event like that $\delta(n)=t_2-t_1$. Any smoothing of the $\delta(n)$ (like a exponential moving average) can be used to obtain $\hat \delta$.

- when you insert an order of size $Q_i$ at price $P_i$ (or modify, but in general modifications are slower than inserts), just note the time of acknowledging it, $t_i$, and look for an increase of the volume $Q_i$ at your price $P_i$ around $t_i+\hat\delta$: once it is done (say that you found it at time ${\hat t}_i$) you now have an estimate ${\hat V}_-(0)$ of the volume before you in the queue (by the way you also obtained one more $\delta(n)$ to adjust your $\hat\delta$). Of course you miss the hidden orders if any, but in general they will not disturb you that much: the non-disclosed part icebergs do not have in general more priority than visible orders fully hidden orders like instance LiS (Large in Scale) orders integrated in European Lit books have a different priority anyway the only issue you will have is that some trading venues provide internalisation services, meaning that if a broker pay specific fees, he will be able to obtain a match between a sell market order and a buy limit orders he owns even if the buy order is not the first in the queue (you can see that as a cheap broker crossing service provided by the venue)

- now you just need to update the quantity $\hat V_-(0)$, that for you need to monitor the quantity ${\cal Q}$ on the queue of price $P_i$: at ${\hat t}_i$, it was ${\cal Q}(0)=\hat V_-(0)+Q_i$ you will have to maintain a quantity $\hat V_+$, the quantity at the same price $P_i$ but with a lower priority than your order let say that you just saw the $n$th event on ${\cal Q}$, which value is now ${\cal Q}(n)$, few milliseconds later you observe that now its value is ${\cal Q}(n+1)$ for an increase of the quantity: ${\cal Q}(n+1)>{\cal Q}(n)$, you have to assume that it has a lower rank in the queue than your order: increase $\hat V_+(n)$ by the increase: $$\hat V_+(n+1)=\hat V_+(n)+({\cal Q}(n+1) - {\cal Q}(n) )$$ * for a decrease of the quantity: ${\cal Q}(n+1)<{\cal Q}(n)$, you have to make an assumption on the probability that affects $\hat V_+$ rather than $\hat V_-$; you have two ways to do this, choose one ($[\cdot]_{-/+}$ means the negative or positive part): $$\Delta V = {\cal Q}(n) - {\cal Q}(n+1)$$ 1. a risk-averse version, put all that you can on $\hat V_+$ $$\left\{\begin{array}{lcl} \hat V_+(n+1)&=& [ \hat V_+(n)-\Delta V]_+\\ \hat V_-(n+1)&=& \hat V_-(n) + [ \hat V_+(n)-\Delta V]_- \end{array}\right.$$ 2. a neutral version: you first compute the probability that the decrease is on $\hat V_+$ or $\hat V_-$ according the their relative size: $$\mathbb{P}_+(n) =\frac{f(\hat V_+(n))}{f(\hat V_+(n))+f(\hat V_-(n))}$$ where $f$ is any increasing function (you can take the identity to make it simple): $$\left\{\begin{array}{lcl} \hat V_+(n+1)&=& [ \hat V_+(n)- \mathbb{P}_+(n) \Delta V]_+\\ \hat V_-(n+1)&=& \hat V_-(n) - (1-\mathbb{P}_+(n)) \Delta V + [ \hat V_+(n)-\mathbb{P}_+(n) \Delta V]_- \end{array}\right.$$ Of course from time to time you have have small inconsistencies, take some simple assumptions and adjust $\hat\delta$ when it is the case. Thanks to this procedure you will have an estimate of the quantity before you $\hat V_-$ and after you $\hat V_+$ at any time.

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.