What Is an Automated Market Maker? AMMs Explained with a Swap Example
Learn how an AMM prices a token swap, work through a constant-product example, and understand the difference between an AMM and a DEX.
What you’ll learn
- An AMM applies rules to pool reserves to quote and execute swaps.
- Your own trade changes a constant-product pool’s reserve ratio.
- The trading mechanism and the exchange using it are different concepts.
What is an automated market maker?
An automated market maker, or AMM, is a system that uses a programmed pricing rule and pooled assets to make trades possible. A trader exchanges tokens with a pool, while liquidity providers supply the assets held by that pool. The contract applies the rule when a swap executes.
This is a useful starting point for understanding decentralized exchanges. On an order book, individual bids and asks define available trades. In a basic AMM, reserves and a mathematical relationship define a quote. Different AMM designs use different relationships, so one formula should not be assumed to describe every decentralized exchange.
Reference: Uniswap v2 — Swaps and reserve accounting ↗
A constant-product swap, step by step
Take a fictional pool containing 100 units of token A and 10,000 units of token B. For this simplified example, ignore trading fees, token transfer fees, and rounding. A constant-product rule keeps the product of the two reserves at 1,000,000.
A trader adds 10 A. The new A reserve is 110, so the B reserve must become 1,000,000 ÷ 110, or about 9,090.91. The pool sends out roughly 909.09 B. Before the trade, the reserve ratio was 100 B per A. The trader’s average output was only about 90.91 B per A because the price changes along the curve.
The resulting reserve ratio is about 82.64 B per A. That final ratio is different from the average price across the swap. This distinction explains why multiplying the starting quote by the trade size can overstate the tokens received. Real quotes also incorporate the applicable fees and route.
x × y = k; output B = 10,000 − (1,000,000 ÷ 110) ≈ 909.09
How pool prices relate to other markets
The simplified pool does not need to ask another exchange for a price before applying its formula. Traders comparing markets can buy where an asset is cheaper and sell where it is more expensive. Those trades change balances and tend to reduce differences when the opportunity exceeds the costs.
That process is not a promise of perfect alignment. Network fees, execution delays, liquidity, and token restrictions can leave prices different across venues. A price on a market overview is therefore useful context, but the actual swap quote must come from the route being used.
Why some AMMs behave differently
Some designs focus on assets expected to trade near a shared value; others let liquidity providers choose price ranges. In concentrated-liquidity systems, the liquidity near the current price matters more than a pool’s headline total. A position outside its active range may stop earning swap fees.
Always identify the protocol version and pool type before using a calculator. The simple full-range example above is a teaching model. It does not reproduce every fee tier, multi-asset pool, custom hook, or concentrated position.
Reference: Uniswap — Concentrated liquidity ↗
What to read before interpreting a swap
Read the input amount, expected output, minimum received, network cost, and price impact together. For liquidity providers, the relevant comparison also includes how the position performs against holding the same starting assets. Trading fees are revenue, not automatically profit.
For research on CoinBee, start with the asset and its market context, then inspect the specific pool on the relevant protocol. Token market cap describes the asset broadly; it does not tell you how much liquidity is available in a particular swap.
Common questions
Is an AMM the same thing as a DEX?
No. A decentralized exchange is a trading venue or protocol. An AMM is one way to provide liquidity and pricing; other designs can use order books or quoted offers.
Does every AMM use x × y = k?
No. It is a common introductory model. Other pricing curves and liquidity designs behave differently.
Can an AMM trade have price impact?
Yes. In the example, adding A and removing B changes the reserves. Larger swaps relative to the available liquidity generally move the quote more.
Sources & further reading
Educational content by CoinBee Journal. Worked examples use hypothetical values and stated assumptions.