Basic Prerequisites: 01 · From Zero and Stochastic Calculus & Itô’s Lemma.


1. Intuition & Practical Objective

This page states the constant-product AMM precisely: its trading function, its swap (execution) math, its marginal-price and price-impact structure, and the derivation of divergence loss from scratch (not quoted). The practical objective: before discussing concentrated liquidity or MEV, have a first-principles, numerically-verified model of what an AMM LP’s payoff actually is.

The constant-product rule is deceptively simple - the pool maintains

after every trade. Three consequences fall out, and each is a market-making fact:

  1. Every trade changes the price. Swapping of into the pool changes so that the product is preserved, moving the marginal price . The bigger the trade relative to reserves, the bigger the move - this is price impact / slippage, the AMM’s way of making large orders expensive.
  2. The pool is always a market maker. There is always a quote and never an inventory limit; liquidity is “everywhere on the curve.” The cost of that guarantee is that the curve is concave, so the LP is short convexity.
  3. Arbitrage keeps the pool honest. When the external price moves, an arbitrageur trades against the pool until the pool’s marginal price matches the market. That arbitrageur’s profit is the LPs’ divergence loss - the crypto incarnation of adverse selection (Glosten–Milgrom).

2. Mathematical Ground Truth & Derivations

2.1 The swap (execution) rule

Reserves with . A trader sends of in; the pool must return of so that the product is preserved:

The marginal price the trader pays, , is worse than the current (a full in gets less than out), which is the slippage. The marginal price of the next infinitesimal unit is

and repeated trades move the pool along the curve. This is the entire micro-price model of the AMM - no order book, no queue, no priority; depth is the derivative of the curve.

2.2 LP value and divergence loss, derived from scratch

On the curve, and , so and . The pool’s value in numeraire is

Divergence loss. Deposit at price , value . The passive-hold benchmark keeps the same two tokens regardless of price:

The LP’s realized value is the curve value . The divergence-loss fraction is the relative shortfall:

Substitute , , and multiply through by :

Let and . Then , , so

Properties. ; symmetry ; monotone to as ; and the small-move expansion (letting , small) is - the seed of the LVR rate of 05.

2.3 Why it is “short gamma” (the Clark replication)

Expand the LP value about : , with . The LP’s value is concave; the hold benchmark is linear. The gap is a convex, -shaped loss for small moves - precisely the payoff of a short straddle. Clark (2020) proves rigorously that a CPMM LP’s payoff is a short portfolio of European options, so the “short gamma” is not an analogy; it is the exact replication. The fees the LP earns are the (too-thin) premium for having written that option.


3. Computational Implementation - swap math + divergence loss verified

We brute-force the pool through actual swaps and confirm the closed-form divergence loss to machine precision.

The closed form reproduces the measured pool loss exactly (to machine precision) at every multiplier. The bookkeeping line confirms the swap rule: pushing X in returns Y and moves the pool along the curve to a lower marginal price of ( - a trader dumping into the pool is exactly what an arbitrageur does when ‘s market price falls). (For a example - ETH/USDC, where ETH and USDC - the identical math yields the divergence loss at a price move.)


4. Failure Modes & First-Principles Breakdowns

  1. Divergence loss is a worst-case-from-now measure, not a running cost. It depends only on . A price path that round-trips (up then back to ) shows zero divergence loss but the LPs have been picked off all along - the arbitrage cost is path-dependent, which is exactly the gap that LVR (06) fills. Do not conclude “no move, no cost.”
  2. Slippage and divergence loss are the same coin. The same curvature that makes big swaps expensive for the trader makes the LP’s value concave for the holder. You cannot have cheap large trades for users and no short-gamma for LPs; the fee tier is the only dial.
  3. The no-fee model understates the loss for thin pools. At small (shallow pool), even modest external moves generate large percentage slippage, so the realized divergence loss on a volatile token is worse than the curve suggests. Depth () and volatility interact multiplicatively.
  4. Ignoring arbitrageurs is fatal. The AMM only marks the “fair” price because arbitrageurs bring it there; those arbitrageurs are adverse selectors from the LPs’ viewpoint. A model of the AMM that prices liquidity without modelling the arbitrageur (Market Impact) is pricing the asset side and ignoring the cost side.

5. References

  • Adams, Zinsmeister, Salem, Keefer & Robinson (2021), Uniswap v3 Core, Uniswap whitepaper
  • Clark, Joseph (2020), The Replicating Portfolio of a Constant Product Market, SSRN 3550601
  • Milionis, Moallemi, Roughgarden & Zhang (2022), Automated Market Making and Loss-Versus-Rebalancing, arXiv:2208.06046
  • Capponi & Jia (2022), The Anatomy of a Liquidity Provision in Automated Market Makers, arXiv:2210.07852

6. Connected Graph Bridges