Skip to content
All option guides
Market microstructure9 min read

Order Flow Imbalance (OFI): Formula, Order-Book Events, and Limits

Learn how order flow imbalance combines best-bid and best-ask changes, how OFI differs from static queue imbalance and trade volume, and what the measure can and cannot say about short-term prices.

In this guideWhat question does order flow imbalance answer?

Short summary

Order flow imbalance (OFI) is a signed measure of changes in supply and demand at the best bid and ask. It counts changes to the displayed queues, including additions, cancellations, executions, and price moves. Researchers use it to study short-interval price formation; OFI alone is not a directional guarantee or a profitable trading signal.

What question does order flow imbalance answer?

A limit order book is not static between trades. Buyers and sellers add orders, cancel them, trade against resting orders, and replace the best prices. A last-trade tape records executions, but misses many quote changes that alter the available supply and demand. Order flow imbalance (OFI) compresses selected changes at the best bid and ask into one signed quantity.

Positive OFI means that the measured best-quote events, taken together, shifted toward stronger bid-side demand or weaker ask-side supply. Negative OFI means the reverse. The sign describes the net change in the measured book events over a chosen interval. It does not describe the intentions of participants, the full supply-demand curve, or what the price must do next.

OFI is useful for a specific market-microstructure question: how does the net flow of displayed interest at the top of the book line up with a short-interval change in the midpoint? It is different from asking how much traded, how deep the whole book is, whether an asset is undervalued, or whether an order will receive a good fill. Futures bid size and ask size explains the simpler snapshot question: how much quantity is currently displayed at the best quotes.

The basic OFI formula follows changes at the best quotes

Let Pᵇ and qᵇ be the best bid price and displayed bid size, and let Pᵃ and qᵃ be the best ask price and displayed ask size. Compare the previous book observation, indexed n−1, with the new observation, indexed n. One common best-quote event contribution is:

eₙ = 1(Pᵇₙ ≥ Pᵇₙ₋₁)qᵇₙ − 1(Pᵇₙ ≤ Pᵇₙ₋₁)qᵇₙ₋₁ − 1(Pᵃₙ ≤ Pᵃₙ₋₁)qᵃₙ + 1(Pᵃₙ ≥ Pᵃₙ₋₁)qᵃₙ₋₁

Here 1(condition) equals one when the condition is true and zero otherwise. The formula gives positive contributions when the best bid improves or grows, or when the best ask retreats or shrinks. It gives negative contributions when the bid weakens or the ask improves or grows. At an unchanged price, it reduces to the change in displayed size with the ask side’s sign reversed.

For a time interval k, add the signed contribution from every eligible best-quote update in that interval:

OFIₖ = Σₙ eₙ

The units are the displayed quantity units in the data, such as shares or contracts. If an event affects several price levels but only the best quote is observed, the resulting top-of-book OFI does not describe every change deeper in the book. Different feeds, venue combinations, event filters, and interval boundaries can therefore produce different series called OFI. A study or implementation should state its exact convention.

Each kind of event gets a sign from its effect on the queue

When the best bid price stays fixed and its size rises from 10 to 13 shares, the event contributes +3. A new buyer has added displayed demand at that quote. If instead a market sell or a cancellation reduces the bid queue from 13 to 9, the contribution is −4. The top-of-book size change alone does not say which of those two causes removed the shares.

At an unchanged best ask, reducing displayed ask size from 8 to 6 contributes +2: less displayed supply remains at the best ask. Adding two shares to that same ask queue contributes −2. This sign convention treats a market buy that consumes ask size and a cancellation of ask size as equivalent if both change the observed queue by the same amount.

A price move also matters. If the best bid rises, the new bid price is an improvement in demand, so the event contributes the new best-bid size. If the best bid falls, the previous best-bid size leaves the top quote, creating a negative contribution. On the ask side the signs reverse: a higher best ask is a positive contribution because the nearest displayed supply moved away, while a lower best ask is negative. These rules account for quote-price changes as well as queue-size changes.

The sign is about book state, not the trader initiating the event. A cancellation can raise OFI even though no execution occurred; an execution can lower it when sell orders remove bid size. For order-by-order feeds such as Nasdaq TotalView-ITCH, add, execute, cancel, delete, and replace messages can help reconstruct displayed queues (Nasdaq’s 5.0 interface specification). An aggregated quote feed may reveal that the queue changed without identifying each underlying order action.

A four-event example shows how OFI can differ from trade volume

Assume the best bid is 100.00 with 10 shares and the best ask is 100.02 with 8 shares. The midpoint is (100.00 + 100.02) / 2 = 100.01. During one hypothetical interval, four events occur:

  1. Three shares are added to the unchanged best bid: OFI contribution +3.
  2. Two shares are canceled at the unchanged best ask, reducing its size from 8 to 6: contribution +2.
  3. A market sell executes four shares at the bid, reducing displayed bid size from 13 to 9: contribution −4.
  4. The old best ask at 100.02 disappears and the new best ask is 100.03. The old ask queue had 6 shares: contribution +6 under the price-move rule.

Total OFI is +3 + 2 − 4 + 6 = +7 shares. If the bid remains 100.00 and the new ask is 100.03, the ending midpoint is 100.015, a hypothetical increase of 0.005. The interval’s trade-only signed volume could tell a different story: it records the sell execution in event 3 but not the bid addition, ask cancellation, or ask-price move.

This example is arithmetic, not a claim that +7 shares generally move a midpoint by half a cent. The size units are not prices, and the relationship between OFI and price change depends on the instrument, current depth, spread, event timing, aggregation window, and market regime. A one-unit OFI change cannot be translated into a universal tick move.

Text-free conceptual illustration of blue bid-side and coral ask-side order blocks before and after queue changes, with a modest midpoint shift.
Abstract view of changes to displayed quantities at the best quotes; it is not an observed market sequence or a prediction.

OFI is not the same as static queue imbalance or signed volume

A static queue imbalance uses a snapshot of bid and ask sizes. A common version is (bid size − ask size) / (bid size + ask size), which is bounded between −1 and +1 for nonnegative displayed sizes. If a quote shows 12 shares bid and 8 shares ask, this snapshot ratio is (12 − 8) / 20 = 0.20. It says the displayed bid queue is larger at that instant. It does not say how the queues changed to reach that state.

OFI is dynamic: it sums signed changes over time. A book can have a large bid queue but negative OFI if bid size is being removed faster than the ask is shrinking. Conversely, a small bid queue can have positive OFI if new bid interest arrives while ask interest recedes. Static imbalance and dynamic flow may complement each other, but they answer different questions.

Signed trade volume counts executed buy-initiated and sell-initiated quantity according to a classification rule. It leaves out limit orders and cancellations unless the method adds them separately. OFI incorporates quote changes, including changes that did not trade. The classification of aggressor side also has ambiguity for some trades, while an order-level message feed can identify specific book events. That does not make OFI universally better: a quote update may be noisy, hidden liquidity is not fully represented, and trades remain essential for measuring actual execution.

The microprice is another distinct measure. It adjusts the midpoint using a current queue-imbalance snapshot to estimate a near-term fair-price-like quantity under a model. OFI instead measures a sequence of signed event changes over an interval. Neither measure should be treated as a standalone forecast without specifying its horizon, inputs, and evaluation design.

Research finds a conditional relationship with short-interval price changes

Cont, Kukanov, and Stoikov study order-book events using quote and trade data for 50 U.S. stocks over April 2010 (their 2014 paper). They define OFI from changes in supply and demand at the best bid and ask, then examine its relation to midpoint changes over short time intervals. Their paper reports a roughly linear empirical relationship in their sample and a price-impact slope that varies inversely with market depth. When the book is thinner, the same signed queue change can be associated with a larger price movement; with more depth, the estimated impact is smaller.

That result is conditional evidence about a particular sample and measurement design, not a universal law for stocks, futures, options, or crypto venues. The paper also notes a measurement issue: price-changing quote events contribute directly to OFI, so part of the relationship is mechanical. In a subsample that excluded such events, the reported fit fell but remained between 35% and 60%. That check makes the interpretation more careful; it does not turn the remaining association into a causal effect or an executable prediction.

Gould and Bonart study static queue imbalance and next midpoint direction for 10 Nasdaq stocks (their 2016 paper). They report stronger classification improvements for large-tick stocks than for small-tick stocks in their sample. This is useful context for the snapshot measure, but it is not evidence that OFI has the same predictive performance. Stoikov’s microprice is also a distinct queue-state measure (2018 paper). These studies underline that tick size, displayed depth, venue, and the exact prediction horizon affect what an imbalance statistic captures.

Market-data choices determine what an OFI series means

A calculation needs a sequence of valid book states. At minimum, record the best bid and ask prices, displayed sizes, event timestamps, symbol, venue or consolidated-market convention, and the size unit. A price-only snapshot without queue sizes cannot reproduce a size-based OFI series. A delayed or sampled feed can miss cancellations and executions between snapshots, so OFI computed from it is not equivalent to an event-by-event measure.

With order-by-order messages, reconstruct the book in sequence and apply adds, partial executions, cancellations, deletes, and replacements according to that feed’s specification. Do not count a replace as a fresh addition without also accounting for the old order removal. With aggregated market-by-price quotes, calculate changes in the displayed queue but avoid claiming to know whether a reduction came from a trade, cancel, or refresh unless another data source supports that classification. Exchange feeds cover their own venue; consolidated quotes combine venues under their own rules.

Choose a consistent interval, such as a fixed number of milliseconds or seconds, and sum all event contributions assigned to it. Compute the midpoint change across the same start and end times, while defining what happens to crossed, locked, stale, or missing quotes. One-second buckets and ten-second buckets can produce different estimates because they aggregate events and price changes differently. The interval length is part of the research design, not a harmless display setting.

A measured association is not a trade instruction

To evaluate whether OFI adds information, define the market, event feed, interval, price outcome, and baseline before tuning thresholds. Estimate any relationship on one period, then evaluate it on a later chronological period. If many windows, instruments, thresholds, and model variants are tried, the best in-sample result is selected from a larger search and needs an appropriate multiple-testing treatment. White’s Reality Check and Hansen’s SPA test explain the separate problem of evaluating a searched family of trading rules.

A model that explains a midpoint change may not tell a trader whether a passive order will fill, how much adverse selection it will face, or whether a marketable order can trade at the displayed quote. Test execution prices, spread crossing, fees, rebates, queue position, latency, hidden liquidity, and market impact. Compare an OFI-informed decision with a realistic baseline after those costs and report the sample, venue, and out-of-sample design. Implementation shortfall connects a decision price to realized trading costs, while futures order book versus time and sales explains how quote and execution records differ.

OFI is best treated as a compact description of top-of-book event flow. Its value is that it includes additions and cancellations alongside trades. Its limit is that it compresses a complex, changing market into one number. It does not reveal hidden orders, guarantee that displayed size will remain, identify a trader’s motive, or promise the next price move.

Common questions

Q1Does positive OFI mean the price will rise?

No. Positive OFI means the measured top-of-book events net toward stronger bid demand or weaker ask supply during the interval. It does not guarantee a later price increase.

Q2Does OFI include cancellations?

Yes, when the data and calculation capture changes in the displayed best queues. A cancellation that reduces the ask queue contributes positively under the sign convention here; one that reduces the bid queue contributes negatively.

Q3Is OFI the same as a buy-minus-sell volume indicator?

No. A trade-volume imbalance counts executions under a side-classification rule. OFI also includes limit-order additions, cancellations, and best-price changes. Primary research and data specification - Cont, Kukanov, and Stoikov, “The Price Impact of Order Book Events” (2014) - Gould and Bonart, “Queue Imbalance as a One-Tick-Ahead Price Predictor in a Limit Order Book” (2016) - Stoikov, “The Micro-Price: A High-Frequency Estimator of Future Prices” (2018) - Nasdaq TotalView-ITCH 5.0 Interface Specification

Sources and further reading

Report an issue

We’ll prepare an email with this article link. Mark receives the report only after you send it

Quick check

Read the guide? Check yourself with 3 questions

Question 1 / 3

Question 01

At an unchanged best ask, displayed size falls from 12 to 9 shares. What is the event's OFI contribution under the convention used here?

Choose an answer to see the explanation

Options glossary

Clear definitions of essential option terms, from calls, puts, and option chains to IV, Greeks, open interest, and max pain

Browse the options glossary