Skip to content

Order book

An order book lists resting bids, offers and sizes. Walk a 150-share purchase through visible depth, separate spread from walking cost, and see why a quote cannot guarantee a fill.

An order book is the set of resting buy and sell orders maintained by a trading venue. A displayed limit order book shows prices and quantities available to other participants: bids are offers to buy, and asks, also called offers, are offers to sell. It answers a more useful execution question than “What is the price?”: how much can I trade, on which side, at which prices?

For a buyer who needs 150 shares, an ask of USD 100.02 is incomplete information. If only 60 shares are offered there, the remaining shares must find other sellers, wait, or remain unfilled. That is where the book becomes a cost calculation.

Read the sides before the sizes

In a conventional continuous limit order book, the best bid is the highest displayed buying price and the best ask is the lowest displayed selling price. Bids are ranked from high to low; asks from low to high. A marketable buyer trades against asks. A marketable seller trades against bids.
The bid–ask spread is the best ask minus the best bid. With bid 99.98 and ask 100.02, it is USD 0.04 per share. Their midpoint is USD 100.00. The midpoint is a reference value, not an offer to transact at 100.00.
Size states the quantity at a price, in the instrument's units. Here it means shares; elsewhere it might mean futures contracts or units of cryptocurrency. A size of 60 does not necessarily mean 60 separate orders. A price-level display may aggregate several participants' orders.

Top-of-book data show the best prices and associated sizes. Market-by-price data add aggregate depth at further prices. Market-by-order data distinguish individual displayed orders and updates, subject to the feed's contract. These are different views of the same mechanism; none should be silently treated as the complete market.

A 150-share purchase that walks three levels

Imagine a desk buying 150 shares to reduce an existing short position. The following is an original synthetic book, not an observed stock or a simulator preset. The bid is 99.98. Assume one venue, price priority, a frozen book and no fees or hidden liquidity.
Ask price, USD/shareDisplayed sharesCumulative sharesShares bought
100.02606060
100.058014080
100.1010024010
Total240—150

The order exhausts the first two levels and takes ten shares from the third. Its cash purchase amount is

60(100.02)+80(100.05)+10(100.10)=15,006.20.60(100.02)+80(100.05)+10(100.10)=15{,}006.20.

The fill-weighted average execution price, or execution VWAP, is

pˉ=15,006.20150=100.041333…\bar p=\frac{15{,}006.20}{150}=100.041333\ldots
This is the average of this order's fills, rather than a market-wide session VWAP benchmark. The last share costs 100.10; charging that price for all 150 shares would overstate the actual purchase amount. Conversely, charging the initial ask for every share would understate it. After the trade, the best ask is 100.10 for 90 shares under the frozen-book assumptions.
Buying 150 shares consumes 60 at 100.02, 80 at 100.05 and 10 at 100.10. Ninety shares remain at 100.10. The USD 6.20 cost against the initial midpoint splits into USD 3.00 to cross to the first ask and USD 3.20 from walking the book.
Buying 150 shares consumes 60 at 100.02, 80 at 100.05 and 10 at 100.10. Ninety shares remain at 100.10. The USD 6.20 cost against the initial midpoint splits into USD 3.00 to cross to the first ask and USD 3.20 from walking the book.
Original static, single-venue example. Prices are USD per share; sizes are shares. No fees, hidden orders, competing trades or cancellations. The benchmark is the initial midpoint of USD 100.
Against that initial midpoint, the execution cost is USD 6.20. Against the initial ask, it is USD 3.20. The two measurements answer different questions:
150(pˉ−100.00)⏟6.20=150(100.02−100.00)⏟3.00+150(pˉ−100.02)⏟3.20.\underbrace{150(\bar p-100.00)}_{6.20} =\underbrace{150(100.02-100.00)}_{3.00} +\underbrace{150(\bar p-100.02)}_{3.20}.
The first component is the half-spread cost of reaching the initial ask. The second is the additional cost of consuming worse asks. Neither includes commissions or other transaction costs. Declare the benchmark when reporting slippage, and avoid counting the spread twice.

For a general fully filled buy, let xjx_j be the quantity actually taken at ask aja_j. Then

pˉ=∑jajxj∑jxj.\bar p=\frac{\sum_j a_jx_j}{\sum_j x_j}.
If only part of a requested order fills, the denominator is the filled quantity, not the original request. A snapshot with insufficient depth does not support a full-order average without an additional assumption about further liquidity.

A limit can take liquidity too

A marketable limit order combines an executable price with a price cap. In the same frozen book, a buy limit for 150 shares at 100.05 takes 60 at 100.02 and 80 at 100.05. It fills 140 shares, leaving ten unfilled because 100.10 exceeds the cap. A buy limit at 100.10 could fill all 150 at the three prices above; it would not pay 100.10 for every share.
What happens to an unfilled remainder depends on time-in-force, venue rules and market state: it may rest or be cancelled. “Limit” therefore does not mean “passive,” and price protection does not guarantee completion. Investor.gov explains the directional price protection of buy and sell limits.
To explore the mechanism, open the public order-book simulator. Its quantity control accepts 1–200 shares and it offers Thin, Normal and Deep books. For a separate reproducible starting point, reset to Deep and choose a market buy for 150 before advancing events. Select Trades now, enter your predicted average and submit: that preset supplies 80 at 100.02 and 70 at 100.04, an average of 100.029333…, leaving 20 at 100.04. The displayed average rounds to 100.03. Its book differs from the article's three-level toy.

Then explore the event controls or change the market scenario. The events and queue handling are illustrative models, not a reconstruction of a particular exchange. Repeating a static calculation teaches allocation; letting the book change exposes the assumptions behind it.

Spread is a gap; depth is a schedule

Two books can have identical best prices and radically different quantities behind them. Their spread is the same, but a larger order can have very different execution costs. Depth is the displayed quantity available at individual prices or cumulatively through a stated price range. “Deep” only has meaning with that range and the order size specified.

Nor is displayed depth a firm promise about the future. Another participant may trade first. A seller may cancel before your order arrives. New orders may replenish a depleted level. A mechanical book walk describes the snapshot conditional on those changes being absent; it does not estimate the complete causal market impact of trading.

Being at the price does not put you first

For a resting order, the allocation rule matters as much as price. Under a stated price-time rule, suppose 80 shares have priority ahead of your 40-share bid. An incoming sell for 100 shares fills the 80 ahead and 20 of yours, assuming no other changes. A smaller sell can trade at your price without filling you at all.
The rule is venue- and product-specific. CME documents FIFO, pro-rata and hybrid matching algorithms. Do not translate a price-time example into a universal queue rule. Display status, order modifications and other priority provisions can affect allocation.
Aggregate depth adds another uncertainty: a cancellation at your price may remove quantity ahead of you or behind you. A fall in total size alone need not identify which. Likewise, a cancellation request for your own order is not confirmation that the order can no longer fill; an execution can race the request.
Passive fills also have economic selection. Your bid may remain untouched while the market rises, then fill just before the market falls. A market maker must evaluate the value of filled inventory, not just the apparent saving against the ask.

The screen has boundaries

A visible book covers a specified feed and venue. Other exchanges, off-exchange trading interest and hidden or reserve orders can supply liquidity absent from that display. Nasdaq describes TotalView's depth as orders on the Nasdaq Market Center, even for securities listed elsewhere; its ITCH specification separately reports trades involving non-displayed orders. “Full depth” does not mean every potential counterparty in every market. Nasdaq's depth white paper makes the venue scope explicit.

Finally, a book is an evolving state reconstructed from messages. Missing updates, stale timestamps and the delay from observation to order arrival can separate the displayed opportunity from the executable one. For a strategy, preserve that timing and reconcile actual execution reports. The book helps decide what to request; confirmed fills determine what position you own.

For a fuller treatment, Order Books develops queue and snapshot models, while Market, Limit and Conditional Orders follows partial fills and cancellation states. Both have public previews; full lessons require membership.

Sources

  • Rishi K. Narang, Inside the Black Box: A Simple Guide to Quantitative and High-Frequency Trading, 2nd edition (2013), Chapter 7, “Aggressive versus Passive,” pp. 120–124, and “Other Order Types,” pp. 124–125. Grounding for execution choices, priority and hidden orders; all numerical examples and the figure are original.
  • Investor.gov: Types of Orders — market and limit order distinctions and directional limit-price protection.
  • CME Group: Supported Matching Algorithms — FIFO, pro-rata and hybrid rules; exact allocation depends on the product's algorithm.
  • Nasdaq: TotalView-ITCH 5.0 specification, §§1.3–1.5 — displayed-order updates and separate trade messages for non-displayed executions.
  • Nasdaq: Finding Depth to Inform Markets of the Future, p. 8 — displayed depth on the Nasdaq Market Center, distinguished from the wider market.
Last updated
  • market microstructure
  • execution
  • liquidity
  • limit orders
  • depth
← Back to the glossaryBack to top ↑