Basic Prerequisites: Probability (random walks and expectation) - no market-making or blockchain background needed.


1. Intuition & Practical Objective

This page builds the why of DeFi market making with no prior knowledge needed. The objective is one idea: a decentralized exchange’s “market maker” is not a trader at all - it is a deterministic pricing curve written in a smart contract, and the people who fund it (liquidity providers) earn swap fees in exchange for bearing inventory risk and adverse selection that they cannot actively manage.

Start with the familiar picture first, because crypto inherited it. On a centralized exchange, a market maker posts a bid and an ask and manages inventory - the whole business of the Avellaneda–Stoikov folder. Now ask the DeFi version of the question: can a smart contract do this? A contract can’t watch prices, can’t cancel a stale quote, can’t decide to quote tighter when it’s over-inventoried. So it does the only thing a contract can do reliably: it commits to an unconditional pricing rule - “trade against me at any time, and the price adjusts by a fixed formula as my reserves change.” That rule is the automated market maker (AMM).

Three “aha”s:

  1. The AMM is a market maker with an infinite quote ladder. Its pricing curve () has a quote at every price - but they are all posted passively. Unlike a human maker it never re-centres, never skews, and never walks away. Every improvement a human maker would make by quoting (skewing the book when over-inventoried, widening when flow is toxic) is something the AMM cannot do.
  2. The AMM cannot avoid adverse selection - it is exposed to it 24/7. When the external (CEX) price moves, the AMM’s price is briefly wrong, and an arbitrageur immediately trades against it to correct the pool. That arbitrageur’s profit is a loss to the LPs. This is exactly the divergence loss (impermanent loss) story, and it is the crypto analogue of the Glosten–Milgrom “informed trader picks off the stale quote” mechanism of Adverse Selection.
  3. LPs are short convexity. The AMM’s payoff is concave (short-gamma): you lose more on large adverse moves than you earn on small oscillating ones, and you are paid only by swap fees. A human maker would hedge or walk away; an LP cannot.

2. Mathematical Ground Truth & Derivations

The trading function. A constant-product AMM holds reserves of token and of token subject to the invariant

The marginal price of in units of is the slope of the curve,

so the curve is literally a one-dimensional price ladder: at each point the pool “quotes” , and a trade moves the pool along to a new point with a new price. Because always, the pool always has a quote - it can absorb arbitrarily large trades (at an ever-worse price). That infinite shelf of quotes is the market-maker role; the worsening price is the price impact / slippage.

The LP’s value. In numeraire , the pool is worth

using , on the curve.

Divergence loss from scratch. Deposit at ; the value deposited is . Now let the price move to and hold the deposit instead: the “hold” value is the linear portfolio . The LP’s realized value is the curve value . The divergence-loss fraction is how much the LP underperforms holding:

Writing the multiplier and (so , ):

At it is ; it is symmetric in (a halving and a doubling hurt equally, each); it grows monotonically to as ( at , at ). This is the closed form the sub-pages verify numerically.

Why it is “short gamma”. The LP’s value is a concave function of price, while “holding” is a linear function. The gap is exactly the payoff of a short position in a straddle-like option bundle - Clark (2020) proves a CPMM LP’s payoff is a short portfolio of European options. The convexity you are short is the price of the guaranteed liquidity you provide.


3. Computational Implementation - watching the price ladder bite

A tiny deterministic pool makes the curve visible: as the price moves, the pool slides along , and the divergence loss shows up as the gap between the (linear) hold value and the (concave) LP value.

Note the asymmetry between the “ladder” (LP value grows, but more slowly than holding) and the hold benchmark: at a move the LP has vs the a passive holder would have - the divergence loss. The pool never goes to zero, but it lags the market forever; the fees are the only thing that can make the position worth it. The full accounting of “fees minus divergence loss” is the failure-mode analysis of 05 · Failure Modes.


4. Failure Modes & First-Principles Breakdowns

  1. “The AMM always quotes, so it’s infinitely liquid” trap. The pool always has a quote, but not at a good price. Price impact is real, grows with trade size, and is the divergence loss when the move is adverse. Infinite liquidity at any price is worthless liquidity at a bad price.
  2. Divergence loss is not “impermanent” for concentrated LPs. The word “impermanent” is used because if the price returns to the loss disappears. But for a concentrated position (03 · Concentrated Liquidity) the price can also leave the range entirely, converting the position to a single token - and if it never returns, the “temporary” loss is permanent. And as 06 shows, the path-dependent loss-versus-rebalancing never goes away even when the price round-trips.
  3. The AMM has no inventory control and no adverse-selection defense. A human maker skews away from inventory and widens against toxic flow; the AMM does neither. Every “free” feature a dealer has (see Avellaneda–Stoikov) is exactly what an AMM LP is giving up.

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
  • Avellaneda & Stoikov (2008), High-frequency trading in a limit order book, Quantitative Finance 8(3)
  • Milionis, Moallemi, Roughgarden & Zhang (2022), Automated Market Making and Loss-Versus-Rebalancing, arXiv:2208.06046

6. Connected Graph Bridges