Market Microstructure and the Limit Order Book
How modern electronic markets actually match trades, and the data structure every execution algorithm reasons about.
Leads to: 16.2 explains how the spread forms; 16.3–16.4 use the book to model impact and execution.
Learning Objectives
Click a status chip to cycle: Not started → In progress → Studied → Practiced → Needs review → Mastered.
- Describe the limit order book and the roles of limit, market, and cancel orders.
- Explain price–time priority and how a marketable order walks the book.
- Define the mid-price, micro-price, spread, and depth from book state.
- Compute the execution price and slippage of a market order that consumes multiple levels.
- Explain how the book is a queueing system and what latency means for a limit order.
Key Vocabulary
- Limit order
- An order to buy/sell a quantity at a stated price or better; rests in the book providing liquidity.
- Market order
- An order to trade immediately against the best available prices; consumes liquidity.
- Limit order book (LOB)
- The set of all resting limit orders, organized by price level and time priority on each side.
- Best bid / best ask
- The highest resting buy price and lowest resting sell price; their gap is the spread.
- Price–time priority
- Matching rule: best price first, and within a price, earliest order first (FIFO queue).
- Depth
- The quantity available at each price level; how much you can trade before moving the price.
- Micro-price
- A depth-weighted mid \((P_a Q_b+P_b Q_a)/(Q_a+Q_b)\) that leans toward the heavier side.
Intuition & Motivation
The order book and order types
Each side of the book is a price-sorted collection of resting limit orders. Two order types drive it: a limit order adds liquidity (rests until matched or cancelled); a market order removes liquidity (executes immediately against the best prices). A cancel removes a resting order. The exchange matches by price–time priority: better prices first, and ties broken by arrival time (first in, first out).
| Order | Liquidity | Price control | Execution |
|---|---|---|---|
| Limit | Provides (maker) | You set the price | Uncertain (may not fill) |
| Market | Removes (taker) | No price control | Immediate, at book prices |
| Cancel | - | - | Removes your resting order |
Prices you can read off the book
Let the best bid be \(P_b\) with size \(Q_b\) and best ask \(P_a\) with size \(Q_a\). Then:
The micro-price weights toward the side with more size on the opposite queue - heavy bid depth predicts an up-move - and is a better short-horizon predictor of the next mid than the plain mid. Depth is the size available at each level; total depth to a price bounds how much you can trade cheaply.
Walking the book: execution price and slippage
A market buy for \(Q\) shares fills against ask levels \((P_1,q_1),(P_2,q_2),\dots\) from the top until \(Q\) is filled. The average execution price is
The book as a queue, and latency
Each price level is a FIFO queue; your limit order’s fill probability depends on your position in queue and the flow of cancels/executions ahead of you. Latency - the time to send/modify/cancel - determines whether you reach the front, avoid adverse fills, and cancel stale quotes before they are picked off. This is why HFT is partly an engineering race: microstructure alpha is often about queue position and reaction time, not just a signal.
Interactive: execution simulator
Trade a parent order into a simulated book and watch how splitting it changes the average price and slippage relative to the arrival mid.
Interactive: compute average price and slippage
- Assuming you always trade at the mid: market orders pay the spread and walk the book; only patient limit orders can earn it.
- Ignoring queue position: two limit orders at the same price are not equal - the earlier one fills first.
- Treating displayed depth as guaranteed: it can be cancelled in microseconds before your order arrives (fleeting liquidity).
- Forgetting fees: maker/taker rebates and fees shift the true cost of providing vs taking liquidity.
- Use the micro-price, not the mid, as a short-horizon fair-value estimate when depth is imbalanced.
- Size relative to top-of-book depth: crossing multiple levels signals your order is large for the market.
- For passive fills, model your queue position explicitly; it dominates fill probability at the touch.
- Measure execution against a clear benchmark (arrival mid, VWAP) - slippage is meaningless without one.
Knowledge Check
Practical Exercise
A stock’s book shows bids \(49.98\times400,\ 49.97\times600\) and asks \(50.00\times300,\ 50.01\times500,\ 50.02\times1000\). (a) Compute the mid, spread, and micro-price. (b) You send a market buy for \(600\) shares - find the average fill price and slippage vs the mid. (c) Would resting a limit buy at \(49.99\) have been better, and what is the risk?
(a) Mid \(=(50.00+49.98)/2=49.99\); spread \(=0.02\). Micro-price uses best sizes \(Q_b=400,Q_a=300\): \((P_aQ_b+P_bQ_a)/(Q_a+Q_b)=(50.00\times400+49.98\times300)/700=49.9914\), leaning up toward the ask because bid depth exceeds ask depth.
(b) Buy 600: take 300 at 50.00 and 300 at 50.01. \(\bar P=(300\times50.00+300\times50.01)/600=50.005\). Slippage \(=50.005-49.99=0.015\) per share (\(\$9\) total).
(c) A limit buy at 49.99 (inside the spread) would, if filled, beat the market-order price by \(0.015\) and even improve on the old mid. The risk is non-execution: the price may run away (fill never happens, opportunity cost) or you get filled only when the market moves against you (adverse selection - the topic of 16.5). Patience trades a better price for fill uncertainty.
Lesson Summary
Formula Sheet Additions
- Did I account for walking multiple levels, not just the touch?
- Did I pick an explicit benchmark for slippage (mid/VWAP)?
- Did I consider queue position for any passive order?
- Did I include fees/rebates in the true cost?
Retrieval Practice
Close the lesson and answer from memory before checking. This is deliberate, effortful recall - the single highest-yield study action.
A: Best price matches first; within a price, earliest arrival first (FIFO). A new limit order at the best bid joins the back of that queue and waits.
A: \(\bar P=\tfrac1Q\sum_i P_i\min(q_i,Q-\sum_{j\lt i}q_j)\) over consumed levels; slippage \(=\bar P-\text{mid}\), the cost of walking the book.
A: It depth-weights the two touches, tilting toward the heavier side, which predicts the direction of the next mid move that the unweighted mid ignores.
Flashcards
Click to flip. These feed the site-wide spaced-repetition queue.
Completion Checklist
- I can explain the core ideas in my own words
- I worked the derivations/examples by hand
- I completed the interactive workbench(es)
- I passed the knowledge check
Source References
This lesson synthesizes and paraphrases concepts from the sources below. No copyrighted text, problem sets, or solutions are reproduced. Return to the originals for full depth.
- Algorithmic and High-Frequency Trading (Cartea, Jaimungal & Penalva, 2015) current - Ch. 1–3 - Ch. 1–3: market microstructure, the limit order book, order types, and price-time priority.
- Stochastic Calculus for Finance II (Steven Shreve, 2004) foundational - Ch. 1–2 - Ch. 1–2: discrete-time probability and martingale tools used to model order flow.
- Time Series Analysis (James Hamilton, 1994) foundational - Ch. 1 - Ch. 1: stationary time-series concepts underlying microstructure signal modeling.