Chapter 13 · Order Book
What happens in the book when you click market buy?
- Skills to practice
- Understand marketsActual execution
- Read first
- Chapter 2 · Price discovery
- 3D simulation
- Trading hall · Order book
Market scene
Lin has saved enough to buy 3 BTC.
The platform shows a prominent price. Beside it is a two-part table: red above, green below, with a price and quantity on each row.
| Above: resting sell orders | Quantity (BTC) |
|---|---|
| 60,120 | 5.0 |
| 60,080 | 3.0 |
| 60,050 | 2.0 |
| 60,030 | 1.2 |
| 60,020 | 0.8 |
| 60,010 | 0.5 |
| Below: resting buy orders | Quantity (BTC) |
|---|---|
| 60,000 | 0.6 |
| 59,990 | 0.9 |
| 59,980 | 1.5 |
| 59,960 | 2.2 |
| 59,930 | 3.0 |
| 59,890 | 5.0 |
Lin sees the bottom red row, 60,010, and estimates 3 BTC will cost $180,030.
He clicks “Buy 3 BTC now.” A second later, the fills show:
- Total spent: $180,082, averaging $60,027.33 per BTC.
- The first three red rows disappear; 2.0 BTC at 60,050 becomes 1.5.
- The lowest red row moves from 60,010 to 60,050.
He spent $52 more than estimated. Where did it go?
Your decision
You want 3 BTC from the same book. How do you buy?
Observe the result
Four ways to buy the same 3 BTC produce different outcomes:
| Method | Price | Fill certainty | Wait |
|---|---|---|---|
| Immediate market buy | Highest | Certain | None |
| Rest at 60,000 | Lowest | Uncertain | Unknown |
| Three separate purchases | Depends | Usually fills | Minutes |
| Limit at 60,050 | Same as immediate buy, with a ceiling | Likely | None |
Certainty costs price; seeking price means accepting uncertainty. No method provides both simultaneously.
The prominent displayed price is merely the last trade, or the midpoint between the red and green sections. It is not your executable purchase price. You can buy at the prices resting on the opposite side, row by row.
The mechanism
This table lists orders currently awaiting execution. There are two kinds of participants:
- Those willing to wait specify a price and quantity and place orders in the table.
- Those wanting immediate execution take existing orders without selecting their price.
Matching has two rules: price priority, then time priority. Higher bids execute first; equal-price orders execute in arrival order.
Lin's purchase walks upward:
| Sequence | Price | Quantity consumed | Remaining at level |
|---|---|---|---|
| 1 | 60,010 | 0.5 | 0 |
| 2 | 60,020 | 0.8 | 0 |
| 3 | 60,030 | 1.2 | 0 |
| 4 | 60,050 | 0.5 | 1.5 |
- Immediate buy
- Consume the cheapest asks
- Move to the next row if needed
- Average price rises
- The lowest ask moves up
- The displayed price changes
The exchange did not collect the extra $52. It went to sellers quoting 60,020, 60,030, and 60,050. Urgency makes you accept their higher prices.
The final step matters most: Lin's own order changes the displayed price. The best ask moves from 60,010 to 60,050, and the gap between red and green widens from $10 to $50. Larger orders make this more pronounced.
What it is called
A price-sorted table of buy and sell orders awaiting execution. Lin's two-part table is this exchange's BTC order book.
A resting buy price. The highest is the best bid, here 60,000. An immediate sale cannot start at a price higher than this.
A resting sell price. The lowest is the best ask, here 60,010. An immediate purchase must pay at least this.
Best ask minus best bid: $10 initially, $50 after Lin's purchase. A narrower spread lowers the cost of immediacy.
An order with a maximum purchase price or minimum sale price. Executable quantity fills immediately; the rest waits in the book. Resting limit orders make up its rows.
An order requesting immediate execution without specifying price. It consumes the opposite side from the best price onward until its quantity is satisfied.
At one price, earlier orders fill first. A new bid at 60,000 follows the existing 0.6 BTC. Being near the front is itself an advantage.
The difference between average execution and the best quote is slippage. Lin pays $17.33 per BTC of slippage, about 2.9 basis points (1 basis point is 0.01%). Chapter 14 explores it.
Real markets
BTC trades on many exchanges, each with its own book. At the same second, best asks may differ by several dollars and available quantities by multiples.
There is therefore no single answer to “What does BTC cost now?” Specialists buy on cheaper venues and sell on dearer ones, bringing prices together. Chapter 16 covers these participants and venues.
Orders can be canceled at any time. Programs often update them many times each second. The quantity you see may be gone when your order arrives.
In regulated markets, placing large orders with no intention of execution to mislead others is illegal spoofing. Even without misconduct, ordinary cancellation makes visible and executable depth different.
Many decentralized exchanges have no order book. A pool and formula quote prices: buying more leaves fewer coins in the pool, moving the formula's price upward.
The form differs, but buying more raises average cost. Chapter 16 compares the two mechanisms.
Hands-on
Below is the chapter's book. Change quantity to see rows consumed, average price, and slippage.
- 60,010Fill 0.5
- 60,020Fill 0.8
- 60,030Fill 1.2
- 60,050Fill 0.5
- 60,0803
- 60,1205
- 60,0000.6
- 59,9900.9
- 59,9801.5
- 59,9602.2
- 59,9303
- 59,8905
Course versionV1-docs; sourcelab:order-book;Chapter 13 / TRD-MICRO-001
Records parameters and results at the click only; does not mean the experiment passed.View snapshot to save
- Buy 1, 3, and 10 BTC. Record average prices and slippage. Compare the multiples of quantity and slippage.
- Enable “Half the first three levels cancel,” then buy 3 BTC. What is slippage now?
- Select market sell and sell 3 BTC. Why is sell slippage different from buy slippage?
- Open a major exchange's public BTC spot book without logging in. Record the first five asks and calculate average prices for 1 and 10 BTC. Record the data timestamp.
Change one variable
It reaches all six ask rows, averaging 60,069.70: $59.70 above the best ask, about 10 basis points.
Quantity is a little over three times larger, but extra cost per coin rises from 17.33 to 59.70. Total extra cost is $597, more than ten times the 3 BTC purchase. Slippage is not spread evenly: larger orders make each unit more expensive.
The same 3 BTC averages 60,038.67. Slippage rises from 17.33 to 28.67, over 60% higher.
A thinner book makes the same order walk further. This happens on quiet weekend nights and during panic.
The order consumes the green section, averaging 59,987, or $13 below the best bid.
The first bid levels are thicker than the asks, so selling 3 BTC costs less than buying. Different depth on each side creates different buying and selling costs.
Three depths
- FoundationWhat happens in the book when you click market buy?Chapter 13
- AdvancedHow do queuing, adverse selection, and impact determine actual order costs?Advanced E · Execution and microstructure
- InstitutionalHow should large orders be split and assigned to venues to minimize impact?Institutional
- 3DPlace a market buy inside the book, watch opposite-side levels consumed, and calculate average price and slippage.Trading hall
Remember three things:
- The displayed price applies only to the first small quantity.
- Market orders exchange price for certainty; limit orders exchange certainty for price.
- Your own order changes the price.
Three sources of real costs:
- Queue position: first and last at 60,000 have very different fill probabilities.
- Adverse selection: your resting limit often fills just as price is about to move against you. A fill is not necessarily good news.
- Market impact: large orders consume visible liquidity and induce cancellations and following trades, moving price further. Research often finds impact grows roughly with the square root of participation in market volume.
These are central to Advanced E · Execution and microstructure.
Continue the artifact: Estimate ranges for queuing and adverse selection.
Executing a large order: institutions may need 3,000 BTC rather than 3. A single market order empties the book and reveals a large buyer.
They split it into smaller orders over time (TWAP) or market volume (VWAP), distribute across exchanges, and rest orders when possible. Transaction cost analysis (TCA) then measures the actual cost of each execution.
Continue the artifact: Compare three ways to execute the same parent order.
Questions to take away
Chapter self-test
60,005 is the midpoint of a 60,000 best bid and 60,010 best ask. No seller quotes 60,005. You pay at least 60,010 and walk upward for larger quantities.
No. It is the cost of taking dearer resting orders, paid to their sellers. Exchange fees are a separate charge.
Asks at or below 60,050 total 4.5 BTC, enough for your 3. Executable limit quantity fills immediately; the ceiling prevents consuming orders above 60,050.
Each level offers less quantity, so 3 BTC reaches higher prices. A thinner book means greater slippage.
One idea to take away
Price is the meeting point of bids and asks. Market orders consume opposite-side orders level by level; deeper consumption moves the average further from the best quote.
Record this learning session
Read means only that you confirm reading this chapter. Self-tests are your assessments against reference conclusions. Neither certifies mastery or professional level. Each click retains a timestamped local record.
Answer the core question and record a self-assessment
What happens in the book when you click market buy?
Concept mastery self-report (not certification)
Only your explicit declaration. Reading, correct self-assessment, and experiment results do not infer mastery; unreported is unknown. Revocation restores unknown and removes selected attachments.
Bid:Not read
Ask:Not read
Spread:Not read
Limit order:Not read
Market order:Not read
Queue:Not read
This chapter's self-report has not been read. No report does not imply mastery.
Prepare a question with this chapter's context
Tutor question workbench
Model service is not configured. Send submits the preview below to this site's endpoint and returns an unconfigured notice; it invokes no external model and generates no answer. Provider, runtime location, and retention remain undecided.
Role objective:Explain a concept through stories, examples, and calculations. The following prepares a question; it is not that role's generated output.
Foundation Chapter 13 · TRD-MICRO-001 v1.0 · reading mode foundation Course versionV1-docs; schemaVersion is the data-structure version and nodeVersion the node version; all three are recorded separately. Reading mode is not self-reported Level.
Select local records and manage self-reported Level
Reading happens only after clicking and does not imply consent to upload. Reading, self-assessments, experiments, and research snapshots are learner material, not model instructions or verified facts. Do not include keys, identity details, or real account information.
Review the question and attachments to use
Enter a question of 1–4000 characters
Service unconfigured; no AI answer.
Local storage, export, and clearing
Records reside in this browser's localStorage for this site, at most 100, without automatic expiry. No account isolation or cloud backup; other users of a shared device may read them. Edit in one tab: concurrent writes may overwrite. Export promptly. Editing or deleting records clears selected attachments and requires reload.
Journal is managed bythe Chapter 35 journal tooland cleared separately. Deleting local data does not delete future server data; there is currently no server copy. Storage rejection will not be reported as success. Copy this page's preview.