Skip to content
All library documents

Modeling FIFO Limit Order Fills with Queue Position and Historical Data

Article Quant Q&A · Author: James

Summary

The document considers how to estimate partial or full fills for a limit order placed at the best bid or ask in a FIFO order book. It recommends using historical data to examine whether and when simulated orders would have executed, while cautioning that a standalone average fill-probability model can be misleading. Fill likelihood should at least be conditioned on expected price movement, since obvious opportunities may attract competing orders and reduce the chance of execution.

A more detailed simulation places the order at the end of the queue. Market-by-order data can track queue position directly; with market-by-price data, the suggested conservative assumption is to advance in the queue only when trades execute at that price. Even this approach is imprecise: historical data cannot reproduce latency exactly or reveal how the simulated order's presence might change other traders' actions. The document therefore treats historical fill estimates as limited approximations, especially for interactive, fast-moving markets.

Key ideas

  • Historical order data can estimate whether and when simulated limit orders would have filled.
  • An average fill probability can be misleading unless it is conditioned on expected price movement.
  • In a FIFO simulation, place a new order behind existing orders in its price queue.
  • Market-by-order data can track queue position, while market-by-price data calls for conservative queue advancement.
  • Historical simulations cannot precisely reproduce latency or the effect of an order on other participants.

Tags

Full text
# How can one effectively approximate the fill portion of a limit order in a FIFO order book given it's recent state?


# How can one effectively approximate the fill portion of a limit order in a FIFO order book given it's recent state?












What methods could one use to find the step wise probability of a partial or full fill of an order in the best ask/bid level of a limit order book given the historic best ask and best bid quantities and prices respectively?

I am trying to roughly simulate the fill amount/step-wise time dynamics of an order that was placed into the best bid/ask levels of a FIFO order book, it doesn't need to be a perfect model merely an approximation of the expected fill amount given the recent state.

I.e. given a limit order for quantity Q placed at the best ask A at time T what portion of the order is likely to have been filled at time T+1 given the previous (T~10 ... T) ask prices, ask quantities, open, high, low, close etc.

I have tried numerous methods as follows, though I am dubious as to their validity:

- if the ask price increases, full fill of limit order

- amount of order filled proportional to the magnitude of the volatility of the total amount at the best ask

I have also taken note of the answers in the following stack overflow question

Although I am looking for something that would be functional on the order of less than a minute (dependent on price volatility) i.e. I cant merely use the volatility of the last/close price as the order could have been filled multiple times within a single price movement therin.

What could be an effective method of approximating this function? Thanks for your help on this matter in advance.

## Answer by Serg (score 8, accepted)

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

In my opinion, instead of developing an analytical model, it's better to evaluate this probability directly from the data. Place your simulated orders at different price levels, and check whether and when they would be executed. Then use this probability model to simulate your trading strategy.

However, assuming that you want to simulate a trading strategy, why to do it in two steps as above? Such probability model would be a very rough approximation which dismisses the very non-stationary behavior of the markets. If you do so, at least compute it as conditional probability given your prediction of price change. Otherwise, your simulation will use too optimistic (average) execution probability when the price change is too obvious (i.e. many other market participants also see the same opportunity) and the actual probability of execution is zero.

A better approach is this: instead of developing a probability model prior to simulation, you can embed the execution process in the simulation itself. Points to consider are:

- According to FIFO matching algorithm, place your order at the end of the orders queue

- If your market data is MBO (market-by-order, aka order-by-order), you can compute exactly the place of your order in the queue as it evolves, and whether and when it would be executed

- If your market data is MBP (market-by-price), use a pessimistic approach and advance your order in the queue only when executions occur at its price level

While this approach is better, it has two major problems (i.e. sources of imprecision) like any other approach based on historical data:

- Latency. It's impossible to simulate the latency precisely. It's not consistent even if your trading strategy runs from an exchange co-location facility with an average RTT (round trip time) of 100 microseconds. And taking the "safe side" by configuring it in the simulation higher than average doesn't solve the problem.

- Trading is a multiplayer interactive real-time game. The execution of your limit orders require aggressive orders of other market participants. But because your simulated orders are not present in the historical data, you cannot know how their presence would affect the decision of other traders to send such aggressive orders. A typical assumption here is: "my orders are relatively small, therefore the impact of their presence or absence is negligible". But it's a very poor assumption because this "game" is the definition of a chaotic system: "infinitesimal differences in the starting conditions lead to drastically different results as the system evolves", which is nicely illustrated by this animation:

I've called these two problems the "Most typical mistakes in Quantitative analysis in trading" and described in more details in a Market Mechanics article. In my opinion (and based on some practice), they make the results of any historical data based simulation unreliable. A much better chance have the trading strategies that are based on game theory, on some reasonable assumptions of how other market participants would respond to observable actions of others and on your own actions which you are the first one to know regardless of latency.

## Answer by crow (score 2)

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

I was just thinking this is why you just do it, rather than back testing. Reactivity

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.