A buy limit order rests at the best bid behind four units of earlier orders. Will it have filled two minutes from now? The displayed depth at its price cannot answer that, because the answer depends on which events move the order forward, how fast they arrive and whether the order and its price level stay in place. This lesson builds a pure queue-depletion model in which the fill probability is an exact Poisson tail and the fill time has an Erlang distribution, and then shows how births ahead of the order and an absorbing fill state change the equations.
Key terms
Limit order book
Definition A limit order book is the record, at a given time, of the resting limit orders for one instrument on one trading venue, grouped by side and price level, with prices in currency units. A buy limit order names the highest price it accepts and a sell limit order the lowest. The best bid is the highest price with resting buy orders and the best ask is the lowest price with resting sell orders. In a continuous book, orders that cross execute at once, so the best bid stays below the best ask. A marketable order, such as a market order or a limit order priced to cross, executes against resting orders on the opposite side, starting at the best price. Queue priority is the rule that decides which resting units at a price level execute first. Under price-time priority better prices execute first, and at one price level orders execute first-in-first-out (FIFO), in order of arrival. The queue position of an order is the number of eligible units ahead of it under the venue’s rule, which need not equal the displayed depth at its level. Other allocation rules such as pro-rata matching, hidden orders, amendments that lose priority and cancellations all change which units are effectively ahead. Under FIFO a new limit order at the same price joins the back of the queue, and a cancellation behind an order leaves its position unchanged.
In plain words The book shows how much is offered at each price, but a resting order is served only after the units ahead of it are gone. For a waiting order the useful number is its place in line, not the size of the crowd at its price.
Example In a constructed book, the bids are units at and units at , and the asks are units at and units at . The best bid is , the best ask is , the spread is and the midpoint is . Our one-unit buy order rests at with units ahead and units behind, so the displayed depth at our level is units while our queue position is . A market sell of units executes against the first units at and leaves one unit ahead of us. A cancellation behind us changes nothing, while a cancellation of that last unit ahead puts us at the front. A new buy order at would become the best bid, and incoming sells would trade against it before reaching our level.
Arrival intensity
Definition Let count a specified class of book events up to time , for example the units removed from the front of our queue, and let be the information available at time , such as the past of the book. An arrival intensity of is a nonnegative process , known just before , such that is a local martingale with respect to , and a martingale when is bounded. It is measured in events per unit of time. Under mild regularity, for example when is bounded with continuous paths,
so the intensity is the conditional expected number of events per unit time, and is the expected count over a short window. A counting process with jumps of size one and a constant intensity is a Poisson process, the subject of the next card. A state-dependent intensity is a function of the current book state , such as the sizes of the best queues, as in queue-reactive models. The class of events has to be fixed before its rate means anything. For an order waiting in a queue, executions at its level and cancellations ahead of it move it forward, cancellations behind it and new orders at its price do not, and a cancellation of the order itself ends its chance to fill and is not an execution.
In plain words The intensity is the speed at which the counted events arrive, given what is known now. Multiplied by a short interval it gives the expected number of events in that interval, which for a short enough interval is also close to the probability of an event. It is a rate, so over a long interval the product can exceed one and is then not a probability at all.
Example Suppose market sells of one unit hit our level at the constant intensity per minute. Over minutes, which is seconds, the expected count is , and under the Poisson model the probability of at least one event is , close to the first-order value . Over one minute the expected count is , while the probability of at least one event is . If cancellations ahead also counted, their rate would shrink as the units ahead disappear and would be zero once we reach the front, so the intensity of our progress would depend on the queue state.
Poisson process
Definition A Poisson process with rate is a counting process with and independent increments such that, for all and , the count has the Poisson distribution with mean ,
for every integer . Equivalently, the times between consecutive events are independent and exponentially distributed with rate , so each has mean . The intensity of a Poisson process with respect to its own history is the constant , all its jumps have size one, and is the dimensionless expected count over a window of length . The sum of two independent Poisson processes with rates and is a Poisson process with rate . A single event that removes several units at once is not a jump of size one, so it needs a different counting model.
In plain words Events arrive at a steady rate with no memory. How many arrived in the last minute says nothing about the next minute, and in every window the count has one fixed law that depends only on the window’s length.
Example With eligible removals per minute and a horizon of minutes, the expected count is . The probabilities of exactly , , , and events are times , , , and , which are about , , , and . At most four events therefore occur with probability .
Fill probability
Definition The fill probability of a resting order over a horizon is the probability , under the model’s probability measure , that the order is completely executed within time , where is its fill time and if it never fills. The pure queue-depletion model makes these assumptions. The order is one unit with eligible units ahead of it under FIFO priority. Each counted service event removes exactly one unit from the front of the queue, first the units ahead and then ours. The service events form a Poisson process with rate . No unit ever enters ahead of ours, the price level stays available, and we do not cancel. The order then fills at the -th service event, so , and the complement collects the counts through ,
The probability depends on and only through . Writing it as , the sum telescopes when differentiated, and
which is positive for . So the fill probability is at , strictly increases with the rate and the horizon, and tends to as . For it strictly decreases with the number of units ahead, because one more unit ahead subtracts . A fill probability says nothing about the quality of the fill. A passive buy order is more likely to fill when sellers are active, and sellers may be trading on information that the price will fall. Expected profit given a fill therefore depends on the joint law of fills and later prices, together with fees and inventory, and simulating fills independently of adverse price moves can overstate the value of a strategy even when the average fill rate is right.
In plain words In the pure model the order fills by the deadline exactly when the number of service events before the deadline exceeds the number of units ahead. Displayed liquidity at our price is not a promise of a fill, and even a likely fill can be a bad trade.
Example Take the constructed inputs , per minute and minutes. The order needs five service events where six are expected, and the previous card gives the complement , so
With per minute the expected count is , the complement is , and the fill probability falls to about . At , one more unit ahead lowers it to about , and a horizon of minutes raises it to about .
Erlang distribution
Definition For an integer and a rate , the Erlang distribution with shape and rate is the law of the sum of independent exponential random variables with rate . It is the gamma distribution with integer shape , with density
mean and variance . In a Poisson process with rate , the time of the -th event is the sum of interarrival times, so it has this law. The events and coincide, which gives the distribution function
In the pure queue-depletion model the fill time is , which is Erlang with shape and rate , so
The count threshold and the sum of waiting times describe the same restricted queue. If a price change can end the queue, if the service rate changes over time or with the state, or if one event can remove several units, the fill time is in general no longer Erlang.
In plain words Each unit ahead takes an exponential time to clear, with mean , and our own unit takes one more. The average wait is the number of units to be served divided by the service rate, but the wait is random, and against a deadline its spread matters as much as its mean.
Example With and per minute, the fill time has mean minutes, standard deviation minutes and median about minutes. The mean is below the two-minute horizon, yet the order misses that horizon with probability about . Integrating the density with from to returns , the fill probability of the previous card. With the mean fill time is minutes.
Birth-death process
Definition A birth-death process is a continuous-time Markov chain on the nonnegative integers whose jumps are , called births, or , called deaths. In a fill model with births, let be the number of units still to be served including ours, so . In every state , a unit is placed ahead of ours at rate , which raises by one, and a service event at rate lowers by one. State means that our order has filled, and it is absorbing, because no unit can be placed ahead of an order that has already traded. The probabilities solve the Kolmogorov forward equations
with and for , and the fill probability by time is . Each equation adds the probability flow into state , at the rates of the states it comes from, and subtracts the flow out of . State receives no births, because state produces none. With rates and that depend on the state, the interior equation becomes
Setting recovers the pure queue-depletion model. Births ahead need a stated mechanism, such as a loss of priority or a rule for hidden liquidity, because under FIFO a new order at our price joins behind us. Trades that remove several units at once, cancellations ahead whose rate depends on how many units are ahead, and price changes that end the queue before a fill call for a different generator and possibly a larger state space, for example a second absorbing state for an order that can no longer fill. None of them is captured by refitting a constant .
In plain words Births push the order back in line and services move it forward. The order fills when the number of units still to be served reaches zero, and once it is there nothing can undo the fill.
Example Keep and per minute and add births ahead at the constructed rate per minute. Solving the forward equations numerically from gives , against without births, and . With the same equations return , the Poisson tail of the fill probability card.
Check yourself
- A one-unit buy order rests behind units, and eligible removals form a Poisson process with rate per minute. Under the pure queue-depletion assumptions, find the probability that the order fills within one minute and its expected fill time.
Show the answer
The expected count over one minute is , and the order needs at least service events. The fill probability is
The fill time is Erlang with shape and rate , so its mean is minutes. The order fills within one minute only about percent of the time.
- New buy orders at our price arrive at per minute. A colleague treats them as births ahead of the order of the examples, with and per minute and , solves the forward equations and reports a two-minute fill probability of about . What is wrong, and what does the pure model give?
Show the answer
Under FIFO priority a new order at our price joins the back of the queue, behind our order, so it does not change the number of units ahead and is not a birth in the fill model. A birth needs a mechanism that really puts a unit ahead of ours, such as a loss of priority or a hidden-liquidity rule. If the other pure-depletion assumptions hold, the fill probability stays
The colleague’s chain also has the wrong qualitative behavior. With the order still fills eventually with probability , but the expected fill time is infinite, while the actual model has the finite mean minutes. Counting every book update as a step for or against the order confuses the events that move its position with those that do not.
- In the birth-death model with and per minute, show that per minute gives an expected fill time of minutes. Then take per minute and find the probability that the order ever fills.
Show the answer
Let be the expected time for the number of units still to be served to fall by one. It is the same in every state , because the rates do not depend on . The first event comes after a mean time . With probability it is a service and the step is done, and with probability it is a birth, after which the count must fall by two, which takes on average. Hence
When the time is finite and the equation gives minute. The order needs five such steps, so minutes, against minutes without births.
For let be the probability that the count ever falls by one. The same first-step argument gives , that is , with roots and . The hitting probability is the smallest nonnegative root, so . By the strong Markov property the five steps down are independent, which gives
With probability about the order never fills, so its expected fill time is infinite. Births faster than services make the queue drift away from the fill.