Advanced · Lesson 11

AMMs: the formula behind the price

The price in an automated pool is not negotiated. It is the slope of a curve, and your trade moves it.

Advanced13 min readUpdated 8 Nov 2026

An automated market maker is a rule for quoting a price, not a person quoting a price. The rule reads the pool's balances, computes what your trade would do to them, and executes if you accept the result. There is no negotiation and no order book — only a curve and the arithmetic of your own size.

The constant product

A constant-product pool holds two assets and keeps their product roughly constant:

x × y = k

Here x and y are the reserve balances and k is the invariant. The quoted price of x in terms of y is y / x, the slope of the curve at the current point. When you buy x, you add y and remove x; the product stays the same, so the price rises. When you sell x, the opposite happens.

The pool does not know the outside price. Arbitrageurs do that job: if the pool is cheap, they buy until it is not, and the profit they take is the cost of keeping the pool aligned. Liquidity providers earn the fee on every trade and carry the divergence risk that arbitrage creates.

Worked example: 1 ether into a small pool

Take a pool with 10 ether and 20,000 dollars. The invariant is 10 × 20,000 = 200,000, and the quoted price is 20,000 / 10 = 2,000 dollars per ether.

First ignore fees. You sell 1 ether into the pool. The new ether reserve is 11, so the dollar reserve must be 200,000 / 11 = 18,181.82. You receive 20,000 − 18,181.82 = 1,818.18 dollars. Your execution price is 1,818.18 dollars per ether, not 2,000. The new spot price is 18,181.82 / 11 = 1,652.89.

The price impact is 1 − 10/11 = 9.09%. For a trade that adds Δx to a reserve of x, the exact impact on the execution price is Δx / (x + Δx); the approximation «trade size divided by pool size» is close for small trades and misleading for large ones.

Now add the 0.30% fee. The pool takes 0.003 ether from your 1 ether, so only 0.997 ether is swapped. The new ether reserve is 10.997, the dollar reserve is 200,000 / 10.997 = 18,186.78, and you receive 20,000 − 18,186.78 = 1,813.22 dollars. The execution price is 1,813.22, which is 9.34% below the quoted 2,000: about 9.07% of price impact plus the 0.30% fee, combined multiplicatively rather than added.

Check: 1,813.22 / 2,000 = 0.9066, so the total cost is 9.34%. The fee is not a separate line on the screen; it is already inside the number you receive. The figures are illustrative; the formula is what matters.

For comparison, the same 1 ether trade in a pool with 10,000 ether and 20,000,000 dollars would move the price by 1 / 10,001 ≈ 0.01%. Depth is the difference between a rounding error and a decision.

Price impact, slippage and MEV

Price impact is your own trade moving the curve. Slippage is the difference between the quote you saw and the price you got; it includes price impact, the fee, other trades that landed first and any MEV. A wallet's «slippage tolerance» is a maximum, not a forecast. If the execution would be worse than the tolerance, the transaction reverts — and you still pay gas.

MEV is the reason a pending swap can be front-run. A searcher sees your transaction, buys the same asset before you, lets your trade push the price, then sells after. You get a worse fill; the searcher keeps the difference. Private transaction channels and MEV-protected routing reduce the exposure; they do not eliminate it.

Where the curve changes

Concentrated liquidity lets a provider choose a price range. Capital is used only inside that range, so it earns more fees per dollar while the price stays there. If the price leaves the range, the position becomes 100% one asset and stops earning. The curve is no longer the simple x × y = k over the whole price space, but the intuition — your trade moves the price, and the pool rebalances — survives.

Stable pools use a flatter curve for assets that are supposed to trade near parity. That gives low slippage when the peg holds and a much worse outcome when it breaks. The curve is a design choice about which risk to minimise, not a free improvement.

Every pool has the same bottom line for a provider: fees minus divergence loss minus gas, compared with simply holding the two assets. If the fee income does not cover the divergence, the position is a bet on volume, not a savings account.

Check yourself

  • A pool holds 10 ether and 20,000 dollars. What is the quoted price, and what do you receive for 1 ether before fees?
  • Why is the execution price worse than the quoted price even if no one else trades?
  • A 0.30% fee is the same in a 10-ether pool and a 10,000-ether pool. Which trade has the worse total cost, and why?

The vocabulary — AMM, slippage, liquidity, impermanent loss — is in the glossary. Liquidity pools, DEXs and bridges covers the provider's side and the bridge risk, and Yield farming, restaking and real yield explains what happens when the fee is paid in a token.