Order Book Dynamics and Price Formation

Market Microstructure · Easy · Free problem

Walk through the mechanics of a limit order book.

  1. What is the difference between a passive (limit) order and an active (market) order? How does each interact with the order book?
  1. Explain how price-time priority works. If two limit orders rest at the same price, which one gets filled first?
  1. Suppose the order book shows bids at $\$100.00$ (500 shares), $\$99.99$ (300 shares) and asks at $\$100.02$ (200 shares), $\$100.03$ (400 shares). A market buy order for 350 shares arrives. Walk through exactly what happens -- which resting orders get filled, what is the resulting book state, and what is the new mid-price?
  1. Distinguish between temporary and permanent price impact. Why does the distinction matter for someone executing a large order?

Hints

  1. Think of the order book as two queues -- one for buyers, one for sellers -- sorted by price, with ties broken by arrival time.
  2. When a market order is larger than the depth at the best price level, it "walks the book" -- filling at progressively worse prices. Trace through exactly what happens at each level.
  3. Consider why some price moves after a trade revert quickly while others persist. What determines whether an order carries information?

Worked Solution

How to Think About It: The order book is the central data structure of modern electronic markets. Everything a market maker or execution trader does revolves around understanding how orders enter the book, match, and move prices. The key mental model: passive orders are the supply of liquidity sitting on the shelf; active orders are the demand that grabs it off the shelf. When demand exceeds the supply at a given price level, the price moves. If you think of it that way, most microstructure results follow naturally.

Key Insight: Price moves happen when incoming order flow consumes the available depth at a price level, forcing the next fill to occur at a worse price. Whether that move is permanent (reflects new information) or temporary (reflects a short-lived liquidity imbalance) is the central question in execution and market making.

The Method:

Part 1 -- Passive vs. Active Orders

  • A passive order (limit order) specifies a price and quantity and rests in the book until matched or cancelled. A limit buy at $\$100$ says "I will buy up to $N$ shares, but only at $\$100$ or lower." It provides liquidity.
  • An active order (market order) demands immediate execution at the best available price. It takes liquidity. A marketable limit order (e.g., a limit buy at $\$100.05$ when the best ask is $\$100.02$) behaves like a market order until its price limit is reached.

Part 2 -- Price-Time Priority (FIFO)

Most exchanges use strict price-time priority: 1. Price priority: an order at a better price always fills first. A bid at $\$100.01$ fills before a bid at $\$100.00$. 2. Time priority: among orders at the same price, the one that arrived earlier fills first (first-in, first-out).

This means queue position matters enormously. A market maker who is first in the queue at the best bid has a significant edge -- they get filled before later arrivals. Losing your queue spot (e.g., by cancelling and re-submitting) is costly.

Part 3 -- Walking Through the Example

Initial book:

| Side | Price | Size | |------|-------|------| | Ask | $\$100.03$ | 400 | | Ask | $\$100.02$ | 200 | | Bid | $\$100.00$ | 500 | | Bid | $\$99.99$ | 300 |

Spread: $\$100.02 - \$100.00 = \$0.02$. Mid-price: $\$100.01$.

A market buy for 350 shares arrives:

  1. First, it matches against the best ask at $\$100.02$. There are 200 shares there, so all 200 fill at $\$100.02$. Remaining buy quantity: 150 shares.
  2. The $\$100.02$ level is now empty. The order walks up to the next ask at $\$100.03$. It fills 150 of the 400 shares resting there at $\$100.03$. Remaining ask at $\$100.03$: 250 shares.

Resulting book:

| Side | Price | Size | |------|-------|------| | Ask | $\$100.03$ | 250 | | Bid | $\$100.00$ | 500 | | Bid | $\$99.99$ | 300 |

New best ask: $\$100.03$. Best bid: $\$100.00$. New spread: $\$0.03$. New mid-price: $\$100.015$.

The mid-price moved up by $\$0.005$ -- this is the price impact of the 350-share market buy.

Part 4 -- Temporary vs. Permanent Impact

  • Temporary impact is the price displacement caused by consuming liquidity that gets replenished shortly after. Limit orders flow back in, the spread narrows, and the mid-price partially reverts. This component is essentially a transaction cost.
  • Permanent impact is the portion of the price move that does not revert because the trade conveyed information. If a large buy signals that an informed trader believes the stock is worth more, the book will not fully replenish at the old levels.

For execution traders, this distinction is critical. If you are executing a large parent order (say, buying 100,000 shares), you want to minimize temporary impact by slicing the order over time (TWAP, VWAP, etc.). But the permanent impact is unavoidable -- it is the cost of your information leaking into the market. The optimal execution strategy balances urgency (information decay, risk) against market impact.

Answer: The order book is a sorted collection of resting limit orders. Market orders consume liquidity starting at the best price and walk through successive levels if their size exceeds available depth, causing price impact. Price-time priority governs fill order. The resulting price movement decomposes into temporary impact (liquidity displacement, mean-reverting) and permanent impact (information content, non-reverting). Understanding this decomposition is essential for market making, execution algorithms, and transaction cost analysis.

Intuition

The order book is the fundamental interface between supply and demand in electronic markets. Every trade, every price move, every spread fluctuation is a consequence of how passive and active orders interact. The depth at each price level acts like a buffer -- small orders get absorbed without moving the price, but large orders punch through and cause impact. This is why market makers care about queue position (being first at the best price means getting filled more often) and why execution algorithms care about sizing (sending too much at once creates unnecessary impact).

The temporary vs. permanent impact decomposition connects directly to the theory of adverse selection. A market maker posting a bid is offering a free option: if the next trade is uninformed (temporary impact only), the maker earns the spread; if the next trade is informed (permanent impact), the maker loses because the true value has shifted. The spread exists precisely to compensate for this risk. This is why spreads widen around news events and narrow in calm markets -- the probability of facing an informed counterparty changes. Understanding these mechanics is not just academic; it is the foundation of everything from optimal execution to HFT strategy design.

Open the full interactive solver →