What Is an Automated Market Maker?
An automated market maker prices trades with a formula and a token pool, not an order book. How x × y = k works, a worked price-impact example and the risks.
An automated market maker (AMM) is a smart contract that lets people trade tokens against a pool of funds, with prices set by a formula instead of an order book. Uniswap popularized the idea in November 2018. AMMs power most decentralized exchanges, and anyone can supply the pool’s tokens for a share of fees.
Where AMMs came from
Early decentralized exchanges tried to copy order books on-chain, which was slow and expensive because every order and cancellation cost a transaction. Uniswap’s first version, launched on November 2, 2018, replaced orders with a pool and a formula, which made trading any token possible as long as someone deposited both sides. Its third version, launched on May 5, 2021, introduced concentrated liquidity. Most decentralized trading since then has run on variations of these designs.
How an AMM differs from an order book
On a centralized exchange, buyers and sellers post orders and the exchange matches them. Our guide to what an order book is explains that model. An AMM has no orders. Instead, a liquidity pool holds two tokens, and you trade directly against it. The pool is always available, but the price you get depends on the size of your trade relative to the pool.
The constant product formula
The simplest and most widely used AMM rule is x × y = k, where x and y are the amounts of the two tokens in the pool and k must stay the same after every trade (before fees). If you take some of one token out, you must put in enough of the other to keep the product constant. The pool’s price is simply the ratio of the two amounts.
Worked example
A pool holds 100 ETH and 300,000 USDC, so k = 30,000,000 and the pool price is 3,000 USDC per ETH. Fees are ignored here.
Buying 1 ETH: the pool keeps 99 ETH, so it must hold 30,000,000 ÷ 99 = 303,030.30 USDC. You pay 3,030.30 USDC, about 1% above the starting price.
Buying 10 ETH: the pool keeps 90 ETH, so it must hold 30,000,000 ÷ 90 = 333,333.33 USDC. You pay 33,333.33 USDC, an average of 3,333.33 per ETH, about 11% above the starting price. Afterward the pool price is 333,333.33 ÷ 90 ≈ 3,703.70.
The larger the trade compared with the pool, the worse the average price. This is called price impact. Traders then buy or sell against the pool until its price lines up with other markets again. See what slippage is in crypto trading for how this shows up when you trade.

Figure: The worked example on the x × y = k curve (fees ignored).
What liquidity providers earn
Most AMMs charge a fee on every trade, often between 0.05% and 1% depending on the pool. In the first example above, buying 1 ETH for about 3,030 USDC in a pool with a 0.30% fee would add about 9.09 USDC in fees to the pool, shared among liquidity providers in proportion to their share. Busy pools generate steady fee income; quiet ones earn little. Providers also bear impermanent loss when prices move, so fee income has to be weighed against that cost. See what impermanent loss is.
Choosing a pool
The same pair of tokens often has several pools with different fee levels. Low-fee pools suit pairs that move little, such as two stablecoins, where trading is frequent and price risk small. Higher-fee pools suit volatile or less traded pairs, where liquidity providers need more income to compensate for larger price swings. Traders usually get routed automatically to the pool with the best overall price for them.
How arbitrage keeps prices in line
After the 10 ETH purchase in the example, the pool prices ETH at about 3,704 USDC while other markets may still be near 3,000. Arbitrage traders spot the gap, sell ETH into the pool and buy it cheaper elsewhere, pushing the pool’s price back down until the gap closes. The arbitrageur’s profit comes from the pool’s liquidity providers, who effectively sell ETH cheaply as the pool rebalances. This is how AMMs stay close to market prices without anyone setting them, and also part of why providing liquidity has hidden costs beyond impermanent loss.
Newer designs
- Concentrated liquidity: Uniswap v3, launched in May 2021, lets liquidity providers choose a price range for their funds, so less capital sits idle.
-
Stablecoin-focused curves: some AMMs use formulas that keep prices tighter for assets meant to trade near the same value.
-
Weighted pools: some AMMs allow pools with uneven weights, such as 80% of one token and 20% of another, which changes how much the pool rebalances as prices move.
AMMs compared with order books
| AMM | Order book | |
|---|---|---|
| Who provides liquidity | Anyone who deposits into the pool | Market makers and traders posting orders |
| How price is set | Formula based on pool balances | Highest bid and lowest offer |
| Large trades | Pay rising price impact along the curve | Fill against orders at several price levels |
| Availability | Always on, for any token with a pool | Depends on active market makers |
Risks to know
- Price impact on large trades or small pools.
- Impermanent loss for liquidity providers when prices move.
- Front-running and sandwich attacks, where bots trade around your order. See what MEV is.
- Smart contract risk in the pool’s code.
For the bigger picture, read what DeFi is and centralized vs decentralized exchanges.
This article is educational content and does not constitute financial, investment, legal or tax advice. Digital assets are volatile and you may lose the amount you invest.
Frequently asked questions
Who sets the price on an AMM?
No one directly. The formula sets the price from the pool’s balances, and arbitrage traders keep it close to other markets by trading whenever a gap appears.
Can anyone create an AMM pool?
Yes, on most decentralized exchanges anyone can create a pool for a pair of tokens by depositing both. That openness is useful for new tokens, but it also allows scam tokens to get pools, which is why checking the token contract matters before trading.