Book depth and execution curves
Construct a quantity-cost curve, separate marginal and average prices, and certify the largest affordable purchase.
32 minutes · intermediate · Original Poker4Quant lessonWhat you will learn
Derive a discrete convex execution-cost curve from cumulative depth, invert a chip budget with a maximality certificate and construct a scale-dependent book-ranking reversal.
Prerequisites: Price-time order matching · Quotes, spreads and reference prices
Turn a snapshot into a quantity-indexed question
A best ask tells you the lowest displayed selling price, but it does not tell you the price of an entire purchase. Depth supplies the missing quantities. Instead of asking which seller fills one particular instruction, we now ask for the whole function C(q): the chip cost of acquiring each feasible quantity q from the same frozen snapshot. This lets us compare scale, identify the cost of one additional unit and solve a budget problem backward. A curve is a family of counterfactual purchases from the original book, not a sequence of separate orders each receiving a newly replenished book.
Assume one synthetic venue, whole indivisible units, deterministic ascending-price execution, no fees, no hidden orders, no arrivals, no cancellations and no replenishment during execution. There are exactly eight units displayed. A buyer can access every displayed level, and identical-price orders are aggregated because their internal priority does not affect this total cost. Prices are chips per unit, not real quotes. We define C only for integer q from zero through eight. Larger quantities have insufficient displayed depth; they do not inherit the final price indefinitely. These assumptions deliberately exclude timing strategies and later market responses.
Derive the curve from cumulative depth
Our editable book starts with two units at 101, four at 103 and two at 107. Let d_i be depth at increasing price p_i, and D_i the cumulative depth through level i, with D_0=0. The units taken from level i in a q-unit counterfactual purchase are x_i(q)=min(d_i,max(0,q−D_(i−1))). Thus C(q)=sum_i p_i x_i(q). The inner maximum prevents negative purchases from a level not yet reached, while the outer minimum prevents taking more than its displayed supply. This formula uses cumulative quantities rather than the order in which rows happen to appear on a screen.
For the starting book, D=(2,6,8). Consequently C(q)=101q for 0≤q≤2; C(q)=202+103(q−2) for 2≤q≤6; and C(q)=614+107(q−6) for 6≤q≤8, evaluated at integer quantities. The formulas agree at shared boundaries: C(2)=202 and C(6)=614. Expanding produces C(0..8)=(0,101,202,305,408,511,614,721,828). Every adjacent difference is positive and the final total equals 2×101+4×103+2×107=828. Matching both endpoints and the independent level-value sum catches errors that checking a single purchase could miss.
Separate marginal, average and total prices
Define the marginal unit price M(q)=C(q)−C(q−1) for q=1,...,8. It is the cost of the qth unit, so our marginal sequence is (101,101,103,103,103,103,107,107). Define average price A(q)=C(q)/q only when q>0. At q=4, total cost is 408, average price is 102 and the last unit costs 103. The next unit also costs 103. At q=6 the last unit still costs 103, but the next costs 107. Calling either marginal price the average loses information about which cheaper units were already included.
Because execution proceeds through nondecreasing prices, M(q+1)≥M(q). This is discrete convexity of total cost: each added unit costs at least as much as the preceding unit. It does not require calculus or a smooth curve. Average price is also nondecreasing: A(q+1)−A(q)=[M(q+1)−A(q)]/(q+1)≥0 because every included price is at most the next price. Equal marginal prices give straight segments of total cost. At zero, total cost is zero but average and last-unit price are undefined. At eight, the next-unit price is undefined. Enter none for these cases rather than inventing zero prices.
Invert cost and certify a budget boundary
A budget B asks for q*=max{q in {0,...,8}: C(q)≤B}. Since each marginal price is positive, cumulative costs strictly increase, making the answer unique. To certify a proposed answer k, show C(k)≤B and either k=8 or C(k+1)>B. The first inequality proves feasibility; the second proves maximality. A merely affordable quantity need not be the largest one. An average-price shortcut B/A(q) is circular because the average itself changes with the quantity being purchased. Dividing the budget by the best ask is only an upper bound before applying the depth cap.
With B=515, C(5)=511≤515 while C(6)=614>515, so q*=5 with four chips unspent. The best-ask shortcut gives floor(515/101)=5 here by coincidence. At B=610 it gives six, although C(6)=614 still exceeds budget and the true answer remains five. At B=511 equality is affordable, giving five with zero left. At B=0 the answer is zero; at B=900 it is eight with 72 left. That final remainder cannot purchase an invented ninth unit because the curve has no such displayed execution. Budget feasibility is an arithmetic constraint within this snapshot, not advice about position size.
Construct a crossing rather than declare one book better
Compare the starting book with a fixed alternative holding four units at 101, zero at 103 and four at 107. Both have best ask 101 and total displayed quantity eight. At quantity four, the alternative costs 404 against our 408. At quantity five, both cost 511. At quantity six, our book costs 614 against its 618; at eight, our 828 beats its 832. More depth at the best price has not made the alternative cheaper for every quantity, because its middle-price supply disappeared. A liquidity comparison must declare the requested scale or compare the whole cost curve.
In the workshop, transfer one conserved depth token between adjacent prices, construct the marginal level for each of eight unit positions and select every quantity at which your edited book is strictly cheaper than the fixed alternative. Then change the selected quantity and budget independently and audit total, average, last, next, affordable quantity and unspent budget. Rebuilding the model clears old answers. Moving all tokens to one level tests a flat marginal curve; empty intermediate levels test whether your construction skips nonexistent supply. Comparing all quantities prevents cherry-picking one favorable size. The resulting snapshot costs do not measure permanent market impact, future fill probability or a causal response by other traders. Those questions require additional observations and models.
Worked example
For depths (2,4,2) at prices (101,103,107), construct the cost curve, analyze quantity four and invert budget 515. Compare depths (4,0,4).
- Cumulative depths are (2,6,8). Marginal prices are (101,101,103,103,103,103,107,107).
- Prefix sums give C=(0,101,202,305,408,511,614,721,828). Independently sum level values: 202+412+214=828.
- At q=4: C=2×101+2×103=408; average=408/4=102; last=103 and next=103.
- Budget certificate: C(5)=511≤515<C(6)=614. Largest affordable quantity is five and remainder is 515−511=4.
- Alternative C(4)=4×101=404, C(5)=404+107=511, C(6)=404+214=618. Our book loses at four, ties at five and wins at six.
A curve answers quantity-dependent questions. A budget answer needs both feasibility and maximality, and a book ranking needs its quantity domain.
Hands-on: Construct and invert a depth curve
Transfer conserved supply, build all marginal steps, identify strict cost improvements and certify a budget boundary.
Construct and invert a depth curve
Eight whole units, frozen supply, no fees or replenishment. Each quantity is a fresh counterfactual from this snapshot. Draft lasts for this visit; no game or lesson credit.
Move conserved supply
Level 1: price 101; depth 2 units.
Level 2: price 103; depth 4 units.
Level 3: price 107; depth 2 units.
Selected quantity 4; budget 515 chips. Comparison book: four units at 101, none at 103, four at 107.
Build the marginal curve
Assign a price level to each successive unit. Your assignments become the curve increments.
Unit 1: unassigned chips
Unit 2: unassigned chips
Unit 3: unassigned chips
Unit 4: unassigned chips
Unit 5: unassigned chips
Unit 6: unassigned chips
Unit 7: unassigned chips
Unit 8: unassigned chips
Your cumulative costs: finish assigning all eight steps.
Select strict cost improvements
Fixed comparison costs at q=0..8: 0, 101, 202, 303, 404, 511, 618, 725, 832. Select every q where your book costs less.
Construct every marginal step before auditing.
Common mistakes
- Extrapolating the last displayed price beyond available depth.
- Confusing total cost, average price, last unit and next unit.
- Treating the best-ask budget quotient as a depth-aware answer.
- Certifying affordability without ruling out the next quantity.
- Declaring one book universally better from best-price depth alone.
Keep these ideas
- Cumulative depth determines the unit-price sequence and its prefix cost sums.
- Nondecreasing marginal prices give discrete convex total cost and nondecreasing average price.
- Certify C(k)≤B and either depth exhaustion or C(k+1)>B.
- Equal best asks and equal total depth can hide quantity-dependent cost reversals.
Further reading
- CME Group: Understanding the CME Liquidity Tool Methodology, depth and Cost To Buy sections ↗
Read ascending asks, level quantities, insufficient-depth exclusion and use of later levels for remaining purchase quantity. Supports depth aggregation only. Our chip total C(q) is not CME’s benchmark-relative tick metric. All curves, proofs, ranking counterexample and questions are original; no source example or video reused. Checked 2026-10-25.
- SEC Investor.gov: Understanding Order Types, market/limit and IOC/FOK sections ↗
Read market/limit definitions, multiple execution prices and IOC/FOK timing paragraphs. Updated August 18, 2026. Used for terminology only; original frozen-book examples, arithmetic and workshop. No source exercises or video review claimed. Checked 2026-10-25.