On this page
Compare the offers with the pricing rule
An order book shows offers at stated prices and quantities. In a constant-product AMM, a rule linking two token reserves determines the amount required for a purchase. To compare the two, follow the whole quantity you want to receive and the state left afterward.
AMM means automated market maker. AMMs can use different designs; this guide calculates one specified model, not a formula for every AMM. The order book is also a simple example with a fixed set of offers, rather than a description of a named service.
Both examples use fictional tokens A and B. Prices are in A per B, not dollars or event probabilities. We leave out fees, gas, token precision and rounding, and assume no cancellations, new offers or outside price changes during the calculation.
Identify the state behind the quote
For the order book, an ask is an offer to sell B for A. We specify two offers: 5 B at 2 A per B, followed by 5 B at 2.2 A per B. The calculation uses those offers in that order and assumes their stated quantities remain available.
For the pool, let x be its B reserve and y its A reserve. It starts with 100 B and 200 A. Our fee-excluded rule is x × y = 20,000: removing B requires adding A so that the reserve product stays the same.
| Specified design | Starting state | Change during the purchase | Limit of the example |
|---|---|---|---|
| Discrete resting offers | 5 B at 2 A/B; then 5 B at 2.2 A/B | Filled quantities are removed from the stated offers | No offers beyond these 10 B are specified |
| Fee-excluded constant-product pool | 100 B and 200 A; x × y = 20,000 | B decreases and A increases under the stated rule | One model; excludes actual protocol fees and other AMM designs |
The BIS-hosted explanation of automated market making discusses the distinction between order-book trading and reserve-based pricing. Chainlink’s AMM guide describes more than one AMM design. Neither makes these invented states a current market quote.
Uniswap’s v2 pricing documentation is version-specific and accounts for fees. The fee-excluded arithmetic below is a teaching model, not a calculation of an actual Uniswap swap.
Start at 2 A per B, then follow the quantity
The first book offer is 2 A per B. The pool’s initial marginal price—the price for an infinitesimally small change—is also 200 ÷ 100 = 2 A per B. These matching starting numbers do not tell you the total for 10 B.
In the book example, receiving 10 B consumes both offers: (5 × 2) + (5 × 2.2) = 21 A. Divide by 10 B to get an average of 2.1 A per B.
In the pool, removing 10 B leaves 90 B. Its new A reserve must be 20,000 ÷ 90 = 2,000/9 A. Subtract the original 200 A to find the required input: 2,000/9 − 200 = 200/9 A, or approximately 22.2222 A. The average is 20/9 A per B, approximately 2.2222.
| B received | Book total input (A) | Pool total input (A) | Pool average (A/B) | Pool post-trade marginal price (A/B) |
|---|---|---|---|---|
| 1 B | 2 | 200/99 ≈ 2.0202 | 200/99 ≈ 2.0202 | 20,000/9,801 ≈ 2.0406 |
| 5 B | 10 | 200/19 ≈ 10.5263 | 40/19 ≈ 2.1053 | 800/361 ≈ 2.2161 |
| 10 B | 21 | 200/9 ≈ 22.2222 | 20/9 ≈ 2.2222 | 200/81 ≈ 2.4691 |
Each row starts afresh from the same initial offers and reserves; the rows are not consecutive purchases. Fractions are exact within the model, and decimals are rounded to four places. The final column describes the pool state after that row’s purchase, not the average paid.
For a quantity q of B, the pool’s total A input is C(q) = 20,000/(100 − q) − 200, equivalently 200q/(100 − q), for 0 ≤ q < 100. For q > 0, its average is C(q)/q = 200/(100 − q). Its post-trade marginal price is the derivative dC/dq = 20,000/(100 − q)². The book calculation is defined only for the stated 0–10 B; it assumes no further offers.
Separate the total, average and price afterward
After the pool supplies 10 B, its marginal price is 200/81 A per B, approximately 2.4691. That differs from the average of 20/9 A per B. The marginal price describes an infinitesimal change at the new state; it is not a quote to receive another finite quantity.
| Measure | Value | What it tells you |
|---|---|---|
| Pool total input | 200/9 A | The amount of A required to receive all 10 B |
| Pool average price | 20/9 A/B | Total A input divided by the 10 B received |
| Pool post-trade marginal price | 200/81 A/B | The infinitesimal price at the resulting reserve state |
| Book last filled ask | 2.2 A/B | The price of the final stated offer used; the next ask is unspecified |
Once the two book offers have supplied their 10 B, the last fill at 2.2 A per B tells you nothing about the next ask. We have not supplied one. Likewise, the pool’s post-trade marginal price does not retroactively become the price paid for all 10 B.
These totals follow from the states we invented. Matching the starting price and requested quantity does not match the capital, liquidity shape or risk of the two designs. It also leaves out real costs. Change the stated book offers and the comparison changes; this example identifies no cheaper, better or safer mechanism.
A design label does not describe the whole service
“Order book” and “AMM” describe aspects of trading design. Either label alone leaves other questions unanswered: who holds assets, where matching happens, how settlement works, and who can use the service. For an event market, its resolution rules also require a separate explanation. A mechanism label does not establish a true event probability.
Use the calculation to distinguish offers from a reserve rule, then read a service’s own current specifications for its implementation. For prediction-market context, see market architecture, execution costs, and the comparison of trading costs.
Common questions about order books and AMMs
Is every AMM a constant-product pool?
No. AMMs can use different designs. This guide calculates one two-token model with x × y fixed and fees excluded. It does not apply that formula to every AMM or every version of a protocol.
Why can the same starting price produce different totals?
The stated offers and the pool rule produce different price paths across the quantity received. A starting price describes only the start. Calculate the total for the whole quantity, then divide to find the average.
Does an order book guarantee that an order will fill?
No. Our calculation assumes the two stated offers remain available. A book label alone does not guarantee the price, available quantity or a complete fill.
Is the pool’s price after the purchase what was paid for all 10 B?
No. The average for those 10 B is 20/9 A per B. The post-trade marginal price is 200/81 A per B. They answer different questions, and the latter is not a finite executable quote.
Does this show which engine HypaForecast uses?
No. These are neutral design illustrations. They do not identify HypaForecast’s current matching or pricing engine, custody arrangements or anyone’s eligibility to use a service.
Explore HypaForecast markets
Browse current market questions and the 5-minute and 15-minute BTC round details. These links do not establish a pricing-engine design or your eligibility to use a service.
Sources and limits of the illustration
- Uniswap v2: Pricing — version-specific context for reserve pricing. Its fee-aware protocol rules are not the fee-excluded outputs calculated here.
- Chainlink: Automated Market Makers Explained — explanatory context for AMM designs from an infrastructure provider.
- Trading in the DeFi era: automated market-maker — a BIS-hosted research box dated 6 December 2021. It presents the authors’ views; the graph is not used in this guide.
The source texts were checked on 19 October 2026. This is the evidence-check date, not their publication date. All A/B quantities, offers and calculations in this guide are fictional. They do not represent a current venue, asset price, event probability or actual trade.
HypaForecast publishes educational guides and operates a prediction-market service. This neutral illustration does not identify its current pricing or matching engine, establish its custody arrangements, or determine your eligibility to use a service.
Share this guide