Market microstructure & order books

The limit order book

structural
Reviewed 4 June 2026. As of 2026: a permanent feature of the market, not an edge that decays.

A live, sorted record of every resting bid and ask. The best bid and offer form the touch; the gap between them is the spread. Market orders consume liquidity from the top down. It is the central data structure of every order-driven market.

See it move

The limit order booktrade against itIX-LOB
Best bid99.99
Best ask100.01
Mid100.000
Spread0.02
pricedepthsize
100.01
898
100.02
1,008
100.03
911
100.04
985
100.05
619
100.06
270
100.07
394
100.08
427
spread0.02mid 100.000
99.99
1,128
99.98
1,167
99.97
860
99.96
855
99.95
461
99.94
907
99.93
568
99.92
525
Order size900

What to notice. A market order doesn't trade at “the price”. It walks the book, consuming each level in turn, and the more you take the worse your average fill. That walk is market impact.

What is a limit order book?

A limit order book (LOB) is a venue's live, ordered record of every unexecuted limit order for one instrument. One side holds bids (buy orders), ranked highest-price-first; the other holds asks (sell orders), ranked lowest-price-first. The book is the market: the best bid and best ask define the price, and the resting orders behind them define how much you can trade and at what cost.

Think of two queues meeting at a counter. Everyone who wants to buy writes down the most they will pay and joins the bid queue; everyone who wants to sell writes the least they will accept and joins the ask queue. The two queues face each other across the spread, the gap between the highest bid and the lowest ask. Nothing trades until someone is willing to cross that gap.

There are two order primitives, and the whole venue is built on the difference between them:

A limit order says "buy or sell up to NN at price PP or better". It rests in the book if it cannot execute immediately, adding liquidity (a maker). It never trades at a worse price than PP, but it carries fill uncertainty: it may never trade at all. A market order says "buy or sell NN now, at whatever price the book offers". It removes liquidity (a taker) and is guaranteed to fill if there is depth, but not at a guaranteed price.

The "central" in CLOB means a single shared book per instrument per venue that all participants post into and match against, as opposed to bilateral dealer quotes (see quote-driven vs order-driven markets).

How is the book structured (levels, depth and the spread)?

The book is organised into price levels. Each level aggregates all orders resting at one price. The best bid and best ask are level 1 (the top of book, or "the touch"); behind them sit levels 2, 3, … at successively worse prices. Depth is how much volume rests at each level. The spread and the depth profile together describe the cost of trading any size.

The best bid / best ask are the highest price a buyer will pay and the lowest a seller will accept. The midpoint is the mid price; the gap is the bid-ask spread. In a liquid name the spread is one tick (the minimum price increment) while in thin names it is many ticks.

The mid price is the average of the best bid and best ask; the spread is the gap between them.
mid=12(p1bid+p1ask),spread=p1askp1bid\text{mid} = \tfrac{1}{2}\,(p^{\text{bid}}_1 + p^{\text{ask}}_1), \qquad \text{spread} = p^{\text{ask}}_1 - p^{\text{bid}}_1

Depth is the total resting size at each level. A book can have a one-tick spread but still be thin (little size at the touch) so even a modest order walks through several levels. The depth chart, cumulative volume plotted against price, is the standard picture of this.

The tick size is set by the venue or regulator and matters enormously: it floors the spread and shapes queueing behaviour (see price-time priority and queue value). Under MiFID II the EU runs a harmonised tick-size regime by price and liquidity band; US equities are governed by Reg NMS Rule 612, the sub-penny rule. Tick regimes change, so always cite the venue's own spec for the exact table.

How does a market order sweep the book?

A market order matches against the best resting orders first, then the next level, then the next, until it is filled. If it is larger than the size at the touch, it walks the book: each successive fill is at a worse price. A market buy is "I'll take whatever you're selling, cheapest first": it eats the lowest ask, then the next, climbing the ask ladder until satisfied. A market sell does the mirror, descending the bid ladder.

The volume-weighted average fill price (VWAP) minus the mid is your slippage, the implicit cost of demanding immediacy.

Your realised price for a sweep is each level's price weighted by the size you took there; slippage is that price minus the pre-trade mid.
VWAP=ipiviivi,slippage=VWAPmid\text{VWAP} = \frac{\sum_i p_i\, v_i}{\sum_i v_i}, \qquad \text{slippage} = \text{VWAP} - \text{mid}

Suppose the asks are 100 at 50.01, 200 at 50.02 and 500 at 50.03. A market buy for 250 fills 100 at 50.01 and 150 at 50.02, so the VWAP is (10050.01+15050.02)/250=50.016(100\cdot 50.01 + 150\cdot 50.02)/250 = 50.016. You paid 0.6 ticks above the touch and 1.1 ticks above the pre-trade mid. That gap is your impact.

This is the mechanical root of market impact: trading size moves the price because it consumes depth. It is also why execution algorithms slice large orders rather than sweep them in one go.

What are L1, L2 and L3 order-book data?

The three feed depths describe how much of the book a data feed exposes. L1 is just the top of book. L2 is the aggregated depth per price level. L3 (full order-by-order, or market-by-order) shows every individual order, including its position in the queue.

Level 1 (top of book, BBO): best bid, best ask, their sizes, and the last trade. Enough to see the price; useless for modelling depth or queueing.

Level 2 (market-by-price, MBP): for each side, the resting size aggregated at each price level, often the top 5–10 levels. This lets you see depth and model walking the book, the standard input to most microstructure work.

Level 3 (market-by-order, MBO): every individual order with its own ID, price, size and arrival time, so you can see where in the queue a given order sits. It is required to study queue position and fill probability (see price-time priority) and to reconstruct the book deterministically from the message stream.

Naming varies by venue: Nasdaq TotalView-ITCH is order-by-order; many crypto venues stream L2 snapshots plus diffs. The honest point is that most retail "L2" data is aggregated and cannot recover queue position, which is why a clean, reconstructable L3/MBO dataset is the resource the strategy pages here keep pointing to (see how HF data is recorded).

What does the matching engine actually do?

The matching engine is the venue software that receives every order message, enforces the matching rules, executes crossing orders, and broadcasts the resulting book updates. It is the single source of truth: an order only exists, only has a queue position, and only fills when the engine says so. Its rules (priority, order types, auctions) define the entire game.

The core loop is simple to state: accept a message, validate it, and if a new order crosses the opposite side, match it against resting orders per the priority rule and print the trades; otherwise rest it in the book. Then publish the update to the market-data feed.

The engine enforces priority (almost always price first, then time; see price-time priority, and note some derivatives venues use pro-rata) plus the order types it supports, and any auction phases. Latency lives here too: your order is timestamped on arrival at the engine, and the feed it publishes is what everyone else reacts to. The gap between acting on a feed and your order reaching the engine is the entire substance of latency arbitrage and the systems topic.

Determinism matters for backtesting: to simulate fills faithfully you must replay the exact message sequence the engine saw (see backtesting and simulation).

Worked example

Take a synthetic book for instrument XYZ (prices in currency, sizes in lots), as of a 2026 worked snapshot. The asks rest at 50.01 (100), 50.02 (200) and 50.03 (500); the bids rest at 50.00 (300), 49.99 (400) and 49.98 (600). The tick is 0.01.

The best ask is 50.01 and the best bid is 50.00, so the spread is one tick and the mid is 50.005. The best-bid depth is 300 lots; the best-ask depth is just 100.

A market buy for 250 fills 100 at 50.01 and then 150 at 50.02, giving a VWAP of 50.016. Slippage versus the mid is 50.01650.005=0.01150.016 - 50.005 = 0.011, about 1.1 ticks. The trade also exhausts the 100 lots at 50.01, so the new best ask becomes 50.02: the act of trading moved the touch up a tick.

By contrast, a limit buy for 100 at 50.00 does not execute. It joins the back of the 300 lots already resting at 50.00, so it sits behind 300 lots in the queue (queue position 300) and only fills once those ahead of it have traded or cancelled, which is exactly why queue position costs you fills.

These numbers are illustrative and synthetic; the live book widget above lets you build and break any book you like. Real tick sizes and depth vary by venue and instrument, so always check the venue spec, as of 2026.

Where this fits

Common questions

What is a limit order book?
A limit order book (LOB) is the venue’s live, sorted record of all resting buy (bid) and sell (ask) limit orders at each price. The highest bid and lowest ask form the best bid and offer; the gap between them is the spread. Incoming market orders consume resting liquidity from the top down. It is the central data structure of every order-driven market.