The order book: where price actually gets made
Every price you see quoted for a stock is the momentary output of a continuous auction happening in the limit order book — a live ledger of every unfilled buy and sell order, sorted by price. Bid orders (offers to buy) are ranked highest price first; ask orders (offers to sell) are ranked lowest price first. The best bid and best ask are the top of book, and the gap between them is the bid-ask spread — the most immediate, visible cost of trading.
Two order types drive everything. A limit order specifies a price and simply waits in the book until a matching order arrives — it adds liquidity (it becomes something others can trade against) and its sender is called a maker. A market order takes whatever price is currently available at the top of book, executing immediately against resting limit orders — it removes liquidity and its sender is a taker. Matching follows price-time priority: orders at a better price execute first, and among orders at the same price, the one that arrived earliest executes first — which is exactly why arriving even microseconds earlier at a given price level has real economic value.
What sets the spread
The bid-ask spread is not an arbitrary fee; it compensates market makers for two distinct risks. Order-processing cost is the trivial baseline — the operational cost of standing ready to trade. Inventory risk reflects that a market maker who has just bought will want to lean their subsequent quotes to sell it off before the price moves against them, widening the effective spread when inventory is imbalanced. Adverse selection — the information risk — is the deepest one: some counterparties trade because they know something the market maker doesn't (a large institution rebalancing on inside information, a fast algorithm reacting to fresh news microseconds sooner), and every market maker must price the possibility that the person crossing their spread right now is better informed than they are. Wider spreads during earnings announcements or macro news releases are a direct, visible symptom of adverse-selection risk spiking.
Market depth and price impact
The spread only tells you the price for a tiny (top-of-book) trade. Depth — how much volume sits at each price level going deeper into the book — determines what a larger order actually costs: a market order that exhausts all the volume at the best price 'walks the book,' filling progressively at worse and worse prices, and the resulting average execution price versus the price that prevailed before the order arrived is the trade's price impact. Thin books (little resting volume near the top) mean even modest orders move the price noticeably; deep, liquid books absorb large orders with comparatively little price movement, which is exactly why institutional traders slice large orders into many smaller pieces over time rather than sending one giant market order.
What HFT actually changes
High-frequency trading firms operate mostly as very fast, algorithmic market makers: they post and continuously update limit orders on both sides of the book, profiting from the spread while managing inventory and adverse-selection risk at microsecond timescales that human traders cannot match. The empirical case for HFT's net effect on markets is genuinely mixed rather than one-sided. On one hand, competition among fast market makers has measurably narrowed average spreads and deepened books for the most liquid securities, lowering trading costs for ordinary investors. On the other, the same speed advantage enables strategies — including latency arbitrage, where a firm exploits being microseconds faster to react to a price change on one venue before slower participants can update their own quotes elsewhere — that critics argue extract value from slower participants without adding real liquidity, and can contribute to sudden liquidity withdrawal during stress events like the 2010 Flash Crash, when many algorithmic makers pulled their quotes simultaneously.
Frequently asked questions
What's the difference between a market order and a limit order?
A limit order specifies a price and waits in the order book until a matching counter-order arrives, adding liquidity to the market. A market order takes whatever price is immediately available at the top of the book and executes right away, removing liquidity — the trade-off is certainty and speed of execution versus price control.
Why is the bid-ask spread wider for some stocks or at some times than others?
Spreads compensate market makers for inventory risk and, most importantly, adverse-selection risk — the danger that whoever is trading against them knows something they don't. Spreads widen around earnings releases and major news precisely because the odds of trading against better-informed counterparties spike at those moments.
Does high-frequency trading make markets better or worse for ordinary investors?
The evidence is genuinely mixed. HFT market-making has narrowed average spreads and deepened order books for liquid stocks, which lowers everyday trading costs. But the same speed advantage enables latency-arbitrage strategies that critics argue extract value without adding liquidity, and can contribute to abrupt liquidity withdrawal during market stress, as in the 2010 Flash Crash.
Try it live
Everything above runs in your browser — open Market Microstructure — Order Book Simulation and change the parameters while it is running. Nothing is installed, nothing is uploaded, the whole model lives in one tab.
▶ Open Market Microstructure — Order Book Simulation simulation