Skip to main content

Quant Analytics: from scratch to pro · Microstructure, execution and costs · Beginner

Order books, spreads and depth

A price on a chart is the last trade, not the price you can trade at. The order book shows the best prices on offer, how much is available at each, and what a round trip costs in basis points or pips.

3 min read Reviewed Revision 1

In this lesson

  • Read a simple order book: best bid, best ask, mid price and depth
  • Express a spread in price units, basis points and pips
  • Compute the average fill price of a market order that walks through the book
  • Estimate the round-trip cost of a trade from the spread

Read first: Spreads and trading costs

Worked numbers

Each result is recomputed from the formula shown.

WhatFormulaResult
mid price(99.98 + 100.02) / 2100.00
spread in price units100.02 - 99.980.04
spread in basis pointsspread / mid * 100004.0 basis points
average fill for 900 shares(400 * 100.02 + 500 * 100.03) / 900100.0256
average fill above mid, in basis points(avg_fill - mid) / mid * 100002.56 basis points
depth imbalance over three levels(2500 - 2100) / (2500 + 2100)0.087
EUR/USD spread in pips(1.0850 - 1.0848) / 0.00012.0 pips
EUR/USD spread in basis points(1.0850 - 1.0848) / ((1.0850 + 1.0848) / 2) * 100001.84 basis points
round-trip spread cost on 1,000 sharesspread * 100040.00

Check yourself

The best bid is 99.98 and the best ask is 100.02. What are the mid price and the spread in basis points?

Mid = (99.98 + 100.02) / 2 = 100.00. Spread = 0.04, and 0.04 / 100.00 = 0.0004 = 4.0 basis points.

EUR/USD is quoted 1.0848 / 1.0850. What is the spread in pips?

One pip is 0.0001 for this pair, so the spread is 0.0002 / 0.0001 = 2.0 pips. That is about 1.84 basis points of the mid price of 1.0849.

Why can a market order to buy 900 shares cost more than the best ask?

Only 400 shares are offered at the best ask. The rest fills at worse prices further up the book, so the average price is above the best ask.

A trader buys with a market order and sells straight back with a market order. Nothing else changes. What does the round trip cost?

About one full spread: the buy fills at the ask and the sell at the bid. Here that is 0.04 on a mid of 100.00, or 4.0 basis points, before any fees.

Key terms

Order bookMarket depthBasis pointPipSpread

Sources

  • Trading and Exchanges: Market Microstructure for Practitioners. Oxford University Press (Larry Harris), 2003. Accessed 9 Nov 2026
  • Trades, Quotes and Prices: Financial Markets Under the Microscope. Cambridge University Press (Jean-Philippe Bouchaud, Julius Bonart, Jonathan Donier, Martin Gould), 2018. Accessed 9 Nov 2026

Informational content. Not investment advice.