What is an AMM? How automated market makers price crypto
An automated market maker, or AMM, is the engine behind most decentralized exchanges. It swaps the old order book for a formula and a pool of tokens, so trades settle against code rather than another trader. Here is how that works, and where it bites.
By Zain
Published · 6 min read
An automated market maker, or AMM, is a type of decentralized exchange that sets prices with a formula instead of an order book. You trade against a shared pool of tokens held in a smart contract, not against another buyer or seller. The pool does the pricing. It runs all day, every day.
Most of the trading in decentralized finance now flows through this design. If you have swapped one token for another on an app like Uniswap, an AMM handled it. Here is how the machine works, who feeds it, and where it can cost you.
How an AMM works
An AMM swaps one token for another using a pool and a formula. A pool is a smart contract that holds reserves of two tokens, say ETH and USDC. When you trade, you put one token into the pool and take the other out. The formula sets the rate from how much of each token the pool holds. No order book. No match with another trader. You deal with the contract, and it is open every hour of the day.
That is the core change decentralized exchanges made. A traditional exchange pairs a buyer with a seller through an order book, and a trade happens only when the two sides agree on a price. An AMM skips the wait. It always has a price to quote, because the formula always has an answer.
The constant product formula, in plain terms
Most AMMs run on one simple rule: x times y equals k. Here x and y are the amounts of the two tokens in the pool, and k is their product, which the contract holds constant through each trade. Uniswap, the protocol that pioneered this model, built on it. An example makes it clear. Say a pool holds 10 ETH and 20,000 USDC. Multiply the two and k is 200,000. That sets the price at 1 ETH for 2,000 USDC.
Now buy some ETH. You add USDC and remove ETH, so the pool is left with less ETH and more USDC. To keep k at 200,000, the price of ETH has to climb. The bigger your trade, the more it moves. That price shift is not a glitch. It is the whole pricing engine. Picture a vending machine that quietly raises the price each time someone clears a shelf.
A fair question follows. If the pool sets its own price, what stops it drifting away from the real market? The answer is arbitrage. When a pool prices ETH below the going rate elsewhere, traders buy from it until the two line up, and they keep the difference as profit. That steady pressure holds a busy pool close to the wider market price, with no central desk setting the number.
What liquidity providers do, and how they get paid
Pools do not fill themselves. The tokens come from liquidity providers, or LPs, and anyone can be one. You deposit equal values of both tokens, say 2,000 USDC and 1 ETH, and the pool grows. In return you receive LP tokens, a kind of receipt that tracks your share of the pool. Hand them back later to pull your money out.
LPs get paid from trading fees. On Uniswap V2 the fee is 0.30% of each trade, taken from the token going in and added straight back into the pool. The Uniswap documents put it plainly: at launch the liquidity provider fee is 0.30%. If a separate protocol charge is ever switched on, that cut splits, and the LP share drops to 0.25%. More trades mean more fees for the people who supplied the tokens. That is the bargain. You lend your assets to the pool, and traders pay to use them.
Slippage and impermanent loss
Two costs bite in an AMM, and both catch newcomers. The first is slippage. Because the price moves with every trade, a large order in a small pool gets a worse rate than the screen first suggested. Take the 10 ETH pool from earlier. Buy a single ETH and the math forces the pool to 9 ETH and about 22,222 USDC, so that one coin costs you roughly 2,222 USDC, not the 2,000 the spot price showed. In a pool ten times larger, the same trade barely moves the price. A thin pool and a big order is the worst mix. Check the pool size before any large swap.
Impermanent loss is the second cost, and it lands on LPs rather than traders. When the prices of the two pooled tokens drift apart, an LP can end up holding less value than if they had simply kept the coins in a wallet. It is called impermanent because the gap can shrink if prices move back, though often they do not. We explain the full math in our guide to impermanent loss. Providing liquidity is not free money. The fees have to beat that loss for the position to pay off.
How an AMM differs from a normal exchange
On a centralized exchange, a company holds your coins, runs an order book, and matches your trade with someone else's. An AMM strips that out. No firm holds the funds. The pool is a public contract, and you trade straight from your own wallet. Prices come from the formula, not from buyers and sellers posting offers around the clock.
Listing works differently too. On an order-book venue, a token trades only if the exchange lists it and someone makes a market in it. On an AMM, anyone can spin up a pool for any pair and fund it. That openness is the whole appeal, and also the trap. A pool can exist for a worthless or fake token just as easily as for a real one, and no one vets it first. The burden of checking lands on you.
Where AMMs came from
AMMs are not old. Uniswap launched its first version in November 2018 and showed that a formula could stand in for a trading desk. Before that, decentralized exchanges tried to run order books on-chain, and they were slow and thin on liquidity. The pool model fixed the thin part. There was always something to trade against, as long as someone had funded the pool.
The design has grown since. Some AMMs use a different formula built for assets meant to hold the same value, such as two stablecoins, which cuts slippage close to zero for those pairs. Others let LPs concentrate their funds inside a price range to earn more on the same money. The core idea has not changed. A pool, a formula, and a fee for whoever fills the pool.
The risks worth knowing
An AMM is code, and code can fail. A bug in a pool contract can be drained, and several have been over the years. A pool can also be handed a bad price if it leans on a weak outside data feed, which is one reason protocols care so much about blockchain oracles. Then there is the token risk. A pool can hold a coin that collapses, and your LP position holds it right alongside you. None of this makes AMMs unsafe to touch. It means you should know what sits under the hood first. Start small. Read the pool. Understand the fee.
Frequently asked
What does AMM stand for?
AMM stands for automated market maker. It is a type of decentralized exchange that prices trades with a formula and a pool of tokens, instead of matching buyers and sellers through an order book. Uniswap popularized the model after launching in November 2018.
How does an AMM set prices?
An AMM sets prices from the ratio of tokens in its pool, using a formula such as x times y equals k. Each trade changes that ratio, which moves the price. Buying a token makes it scarcer in the pool, so its price rises. Larger trades move the price more.
Can you lose money providing liquidity to an AMM?
Yes. Liquidity providers earn a share of trading fees, but they also face impermanent loss when the pooled tokens move apart in price. If a pooled token crashes, the position holds it too. Fees can offset these costs, but they do not remove the risk.
Sources, and what is behind them
- What is an automated market maker?, UniswapDocumentation
- Uniswap v2, UniswapDocumentation
- AMM (Automated Market Maker), The BlockOther