How an order book makes a price
Where does the number on an exchange actually come from?
An order book has no reserves and no curve. The price is the last trade, and the next one is whichever resting limit order the next market order reaches.
There is no formula, only a queue
A constant-product pool computes its price. Reserves go in, x·y=k does the rest, and the quoted price is a ratio you can derive at any moment without asking anybody's permission. An order book computes nothing. It holds a queue of offers — bids from people willing to buy at a stated price, asks from people willing to sell — and the price you see quoted is simply the last trade that happened to occur.
What matters for the next trade is not that number but the two edges of the queue: the highest bid and the lowest ask. The gap between them is the spread. A market order does not name a price; it says "fill me now", and the exchange walks it through the queue, taking the best resting order, then the next, then the next, until the requested size is filled.
So the price after a large market buy is not calculated. It is discovered — it is wherever the queue ran out of cheap sellers.
Depth is the shape of the queue
"Depth" is how much size rests at each price level. A book with 400,000 USD of asks stacked between 100.00 and 100.50 will absorb a 300,000 USD market buy with barely any movement. The same buy against a book holding 40,000 USD across that range walks much further up before it is filled, and the last unit costs far more than the first.
This is why two venues showing the same price are not offering the same trade. The quoted number is identical; what a real order does to it is not. The published price answers a question nobody is asking — the useful question is what the queue looks like above and below it.
Where this differs from a pool, concretely
A pool's price is a continuous function of its reserves. Buy more and it costs more, smoothly, without a step anywhere — the curve is defined at every point between zero and infinity, so however thin the pool, there is always a price, and it always moves in the same direction as the trade.
A book is discrete. Between two resting orders there is nothing at all: no price, no size, no obligation on anyone to be there. When a large order clears a level and finds the next one far above, the price does not slide — it jumps. That gap is not a malfunction. It is what a queue does when it empties.
The second difference is about who is committed, and it is the larger of the two. The reserves behind a pool price are locked in a contract for the duration of your trade; the size behind a book price belongs to people who may withdraw it before your order arrives. That distinction decides how each venue behaves under stress, and it has its own article.
Push against a book
Two fixed books, same best price, different size behind it. Nothing here is live market data.
Size stacked close to the touch, the way a heavily quoted pair looks when nothing is happening.
spread 0.20 (20.0 bps) · mid 100.00
- Filled
- 150 u
- Average price
- 100.12
- Cost vs. touch
- 0.02 %
- Unfilled
- 0 u
Where a stop sits
A stop-loss is not resting depth. It waits off-book until the price prints, then becomes a market order — one that consumes the book like any other, at whatever is left by then.
Not triggered at the current touch. It is an instruction, not depth — nobody can trade against it while it waits.
Fixed example books, not a live venue. Real books also hold hidden and iceberg orders, and every resting order shown here could be cancelled before your order arrives.
What this establishes
- The quoted price on an exchange is the last executed trade, not a derived value
- What the next trade costs is determined by resting size above and below, not by the quoted price
- A book can gap between levels because the space between two resting orders holds nothing
- A constant-product pool cannot gap: its price is continuous in its reserves
What this does not establish
- It says nothing about which venue is better, safer or fairer — only that they form prices differently
- Real venues add mechanics this description omits: hidden and iceberg orders, maker/taker fee tiers, auction phases and circuit breakers
- It is not a claim about any specific exchange's matching rules, which vary and are rarely published in full
- Nothing here is a basis for trading. It describes a mechanism, not an opportunity
Sources
- Market and limit orders — Kraken (Payward, Inc.). Retrieved 2026-08-22.
- How Uniswap Works — Uniswap Labs. Retrieved 2026-08-22.
Keep going
- Order-book depth is not pool liquidity
- Simulate price impact in a real pool
- What a swap actually costs
- Reading a crypto order book you did not build
- Risk disclaimer
Last revised 2026-08-22. Figures quoted in this article were measured on the dates stated beside them and are not refreshed.