# Modelling queue position

Is there any viable way for me to know the dynamics of my LOB position? Lets suppose the LOB is order based LOB, and i send a order to this level, can i know if the qty in front of me cancelled vs whether the qty was from behind my order.

Lets suppose no trade has happened and this total qty at this level decreases.

Thanks

No, you have to build your model empirically with data.

Suppose $$p(x)$$ denotes the probability of cancel in front of you when your order is positioned $$0 \leq x \leq 1$$ through the queue, there are a few trivial cases:

• If you just joined the queue, any reduction in depth at the level must come from in front, i.e. $$p(x=1)=1$$
• If you are at the front of the queue, $$p(x=0)=0$$, all cancels must be from behind.

and this becomes a matter of fitting a function between those two points. A naive guess is that the cancels arrive uniformly through the queue, i.e. $$p(x)=x$$. You could just use this as your prior and then penalize it online (Bayesian or q-learning) as your orders get filled early or late.

A better guess, with some practical trading experience, is that cancels are unconditionally more likely to come from behind than in front of you than if they arrived uniformly, since orders in front of you have more value and can scratch out. Once you get better at this, you'll want to model the conditional distribution. During high dislocation risk, it could be more likely that orders are pulled from in front of you than behind.

Side note: Some data feeds do key each event by order ID, i.e. market-by-order (MBO), which provides you with explicit knowledge of the queue composition and your order's position at a level. For example, CME MDP 3.0, Eurex EOBI and Nasdaq TotalView-ITCH. Then, this becomes purely an exercise of maintaining an order book structure.

You'll rarely see this granularity with retail tier data feeds. Sometimes, this is due to poor normalization design. Other times, it's because the retail tier data feed is sourcing the data from another lossy third party provider or an aggregated feed, say in US equities, the SIPs (CTA/UTP) rather than prop feeds (such as TotalView-ITCH). If you use a market-by-order feed from providers like Redline, MayStreet or Databento, you should be able to get your queue position explicitly. (Disclosure: I am one of the developers of Databento.)

• You're welcome. :) Would appreciate if you marked it as correct unless someone comes along with a better solution. Jun 26, 2021 at 9:10