How Automated Market Makers Actually Price Trades

Last updated: August 2, 2026

Fact-checked against our editorial guidelines.

Editorial illustration of a formula-driven mechanism setting a trade price against a token pool

An automated market maker (AMM) is the software logic that prices every trade against a liquidity pool, replacing the buyer-meets-seller matching a traditional exchange order book relies on. Understanding how it actually calculates a price is what makes concepts like slippage and impermanent loss make sense, rather than feeling like arbitrary side effects.

{{IMAGE:assets/images/amm-featured.webp}}

No order book, no problem

A traditional exchange needs a buyer and a seller who agree on a price at the same moment. An AMM sidesteps this entirely: instead of matching two people, it lets you trade directly against a pool of tokens, with the price set algorithmically based on the pool’s current balance. There’s always a counterparty to trade against, as long as the pool has liquidity in it — you’re never waiting for a matching order.

The constant-product formula, walked through

Three-step illustration showing a token deposit entering a pool, the balance shifting, and the resulting exchange rate

The most widely used AMM model is the constant-product formula: x × y = k. Here, x and y are the quantities of the two tokens in the pool, and k is their product, which the formula holds constant across every trade. If a trader adds token A to the pool (buying token B with it), the pool’s token A balance goes up and, to keep the product the same, its token B balance has to go down — and how much it goes down by determines the exchange rate the trader receives.

Here’s a purely illustrative, hypothetical walkthrough — not real market data:

  1. A pool holds 100 token A and 100 token B. Product: 100 × 100 = 10,000.
  2. A trader deposits 10 more of token A into the pool, so it now holds 110 token A.
  3. To keep the product at 10,000, the pool’s token B balance must drop to roughly 90.9 (10,000 ÷ 110).
  4. The trader receives the difference — about 9.1 token B — in exchange for their 10 token A.

{{IMAGE:assets/images/amm-formula-process.webp}}

Why bigger trades move the price more (slippage)

Notice that the trader in the example above didn’t get a clean 1:1 exchange rate, even though the pool started perfectly balanced — they received about 9.1 token B for 10 token A, not 10. This gap between the price before and after a trade is called slippage, and it grows with trade size relative to the pool: a trade that’s a small fraction of a large pool barely moves the price, while a trade that’s a large fraction of a small pool can move it substantially. This is also exactly the mechanism behind impermanent loss for liquidity providers — see impermanent loss, explained for how the same rebalancing math affects providers rather than traders.

Other AMM formulas exist too

The constant-product model isn’t the only design. Some protocols use a “stableswap” formula tuned for pairs expected to trade near a fixed ratio (like two different stablecoins), which produces far less slippage and impermanent loss for those specific pairs than a plain constant-product pool would. Others use weighted pools that allow ratios other than 50/50 between the two assets, which changes the pool’s risk and slippage profile accordingly. The underlying idea — a formula that automatically recalculates price from pool balance — stays the same across all of them.

AMM vs. order book, at a glance

Aspect Traditional order book AMM / liquidity pool
Who sets the price Buyers and sellers, via matched orders A formula, based on pool balance
Counterparty A specific matching order The pool itself, always available if it has liquidity
Large-trade cost Depends on order-book depth at each price level Slippage, growing with trade size relative to pool depth
Who earns fees The exchange operator Liquidity providers, proportionally

Concentrated liquidity: a newer variant

Some more recent AMM designs let liquidity providers concentrate their capital within a specific price range instead of spreading it evenly across all possible prices the way a standard constant-product pool does. This makes that capital far more effective within the chosen range (deeper liquidity, less slippage for trades in that range), but it means the provider earns nothing on trades that happen outside the range they picked, and they take on the added complexity of choosing and managing that range themselves — a meaningfully different risk and effort profile than simply depositing into a standard pool. If the price moves outside the chosen range entirely, the position effectively stops earning fees until either the price moves back in range or the provider manually adjusts it — an active-management burden a standard full-range pool doesn’t carry.

Why liquidity depth matters to everyday traders

Even if you never provide liquidity yourself, pool depth affects every trade you make against an AMM. A deep pool (a large total value locked relative to typical trade sizes) means your swaps execute closer to the quoted price with minimal slippage; a shallow pool means even a moderate-sized trade can move the price noticeably against you before it completes. This is why the same token pair can trade at meaningfully different effective prices across different pools or protocols — the pool with more depth generally, though not always, offers the better execution for a given trade size.

FAQ

Does slippage mean I lose money on every trade?

Slippage means you get a slightly different rate than the pool’s price before your trade, not that you overpay in an absolute sense — it’s a function of trade size relative to pool depth, not a fee or penalty.

Why do some pools have less slippage than others?

Larger pools (more total value locked) generally produce less slippage for a given trade size, since the same trade represents a smaller fraction of the pool’s total balance.

Is the constant-product formula used by every DEX?

No — it’s the most common model, popularized by early AMMs like Uniswap, but stableswap and weighted-pool variants are widely used for specific asset pairs where they perform better.

For the full picture of what this pricing mechanism means for anyone providing capital rather than just trading, see our liquidity pool overview.