What is market depth? Reading the order book before you size
Market depth is the quantity of resting orders available at each price level of an order book, and cumulatively within a given distance of the mid price. It determines how much you can buy or sell before your own order moves the price you get.
The spread tells you what the first unit costs. Depth tells you what the hundredth costs. This page shows how to turn a snapshot of the book into a number — the average fill price for your order size — how to summarise depth as a band measure you can compare across instruments and times of day, and why the depth you see is an upper bound on the depth you get. For the wider picture of what liquidity costs, see spread, depth and what liquidity costs you.
Why this matters now
Position sizing works from your account and your stop. It has no term for the market. A size that is correct for your risk budget can still be a large fraction of what is resting in the book — and that is invisible on a price chart, which shows only where trades happened, not how much was waiting.
Depth is also the quantity that disappears under stress. The book you read in a calm session is not the one your stop meets in a fast move. Knowing how to read depth is how you find out, in advance, how wrong a calm-market assumption could be.
How it actually works
An order book is two sorted lists. Asks (offers to sell) ascend from the best ask; bids (offers to buy) descend from the best bid. A buy market order consumes asks from the best upward until it is filled; a sell consumes bids downward. That is “walking the book”.
An illustrative book:
| Bid price | Bid size | Ask price | Ask size | |
|---|---|---|---|---|
| 99.95 | 4 | 100.00 | 2 | |
| 99.90 | 6 | 100.05 | 3 | |
| 99.80 | 4 | 100.10 | 5 | |
| 99.60 | 10 | 100.20 | 8 | |
| 99.30 | 25 | 100.50 | 20 |
The mid is 99.975 and the spread is 0.05, about 5 basis points.
To price a buy of a given size:
- Take the best ask’s size, up to what you need, at its price.
- Move to the next level for the remainder. Repeat.
- The average fill price is total cost ÷ total quantity (the volume-weighted average price, VWAP). The last level touched is your worst fill.
Worked through for several buy sizes:
| Buy size | Average fill | Worst level | Cost vs mid |
|---|---|---|---|
| 1 | 100.000 | 100.00 | 2.5 bps |
| 5 | 100.030 | 100.05 | 5.5 bps |
| 10 | 100.065 | 100.10 | 9.0 bps |
| 18 | 100.125 | 100.20 | 15.0 bps |
| 30 | 100.275 | 100.50 | 30.0 bps |
Same instrument, same moment, same quoted spread — and the cost of crossing it rises twelvefold between the smallest and largest order. That is market impact, and it is the part of slippage you can estimate before trading.
A round trip pays it on both sides. Buying 10 and selling 10 into this book averages 100.065 in and 99.92 out: 14.5 bps of mid before fees, which the trading fee calculator adds on top.
In code, the walk is a few lines:
def average_fill(levels, qty):
"""levels: [(price, size), ...] best first. Returns (vwap, worst)."""
remaining, cost = qty, 0.0
for price, size in levels:
take = min(remaining, size)
cost += take * price
remaining -= take
if remaining <= 0:
return cost / qty, price
return None # the visible book cannot fill this size
The None case is a real answer. If the levels you fetched cannot fill the
order, the book you can see is too thin for it — order book endpoints return a
limited number of levels, so fetch enough to cover your size.
Depth as a band measure
Walking the book answers one order. To compare instruments, sessions or days, summarise depth as the quantity resting within a fixed distance of the mid — often quoted in the quote currency.
For the book above:
| Band around mid | Ask depth | Bid depth |
|---|---|---|
| ±0.10% | 5 units (≈500) | 10 units (≈999) |
| ±0.25% | 18 units (≈1,802) | 14 units (≈1,398) |
| ±0.50% | 18 units (≈1,802) | 24 units (≈2,394) |
Two things this shows that the top of book does not. The bid side is deeper close to the mid but thinner at ±0.25%, so which side is “stronger” depends on the size you care about. And there is nothing on the ask side between 100.20 and 100.50 — a gap a buyer larger than 18 units jumps straight across.
Pick the band from your own numbers: the distance to your stop is the natural one, because it is the exit your stop will have to take.
Market depth vs the adjacent things
| Measure | What it tells you | What it misses |
|---|---|---|
| Spread | Cost of the first unit | Everything behind the best price |
| Depth | Size available now, by price | Whether it stays there |
| Volume | Size that traded over a period | Whether any of it is available to you now |
High volume with thin depth is common: size trades, but in small pieces against a book that refills. A large order meets the thin book, not the volume.
Why displayed depth overstates what you get
A snapshot is an upper bound, for three reasons:
- It can be withdrawn. Resting orders are cancelled in milliseconds. Depth that is there when you read the book may not be there when your order arrives, and it is most likely to leave in exactly the fast moves when your stop fires.
- It thins on the side everyone needs. In a sell-off, bids pull and sellers arrive together — see liquidation cascades.
- Some size is hidden. Order types that display only part of their quantity mean the true book can be deeper than shown. That is the one bias in your favour, and it is not something to size against.
Depth also varies across the day — see market hours and liquidity.
Where the boundary should sit
- Walk the book for your intended size before sizing up. Size from the stop with the position size calculator, then price the fill. If the cost is a visible fraction of your planned gain, the instrument or the size is wrong for the plan.
- Check the exit side at your stop distance, not only the entry side.
- Sample depth at different times, including the quietest hours you might hold through.
- Treat the calm-market figure as a ceiling on what your stop will get, and record intended versus filled prices so you learn the real discount.
FAQ
What is market depth in trading?
Market depth is the amount of resting buy and sell orders at each price level of the order book. It tells you how much can be traded before the price moves by a given amount. A market can have a tight spread and little depth, in which case small orders fill well and larger ones do not.
How do I calculate the fill price for a large order?
Walk the book: fill as much as possible at the best price, then the next level, and so on until the order is complete, and divide total cost by total quantity. Buying 10 units against asks of 2 at 100.00, 3 at 100.05 and 5 at 100.10 averages 100.065. That is an estimate from a snapshot, and real fills are usually no better.
What is the difference between market depth and volume?
Depth is what is available to trade right now at each price; volume is what actually traded over a period. A market can show heavy volume while the book at any moment is thin, because trades arrive in small pieces against orders that keep refilling. A large order is filled by the depth that is resting when it arrives.
Can I trust the order book depth I see?
As an upper bound. Resting orders can be cancelled before your order arrives, and depth thins fastest on the side under pressure, which is when stops fire. Some orders display only part of their size, so depth can also be understated, but that is not something to plan around.