# 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.

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.

• Wow! thanks for the effort you put into this answer Serg Aug 15, 2019 at 21:43
• "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." ... Interesting Aug 16, 2019 at 6:22