NOONOO TRADINGJoin free chat

What Is an AMM (Automated Market Maker)?

An automated market maker (AMM) is the engine behind most decentralized exchanges. Instead of matching buyers and sellers through an order book, it uses pools of tokens and a fixed math formula to set prices and settle trades automatically.

What an AMM actually is

An automated market maker (AMM) is a piece of code — a smart contract — that lets people trade one token for another without a traditional middleman. On a regular exchange, your order is matched against someone else's opposite order in an order book. An AMM works differently: it holds a shared pot of tokens called a liquidity pool and uses a formula to decide the price of every swap.

AMMs are the core of most DeFi applications and power the DEX (decentralized exchange) you may have heard of. Because everything runs on-chain, you trade directly from your own crypto wallet — there is no company holding your coins while you trade.

How liquidity pools and the x*y=k formula work

A liquidity pool is just two (or more) tokens locked in a contract — for example, ETH paired with a stablecoin like USDC. People called liquidity providers (LPs) deposit both tokens and, in return, earn a share of the trading fees.

The most common pricing rule is the constant product formula, written as x * y = k. Here x is the amount of one token in the pool, y is the amount of the other, and k is a number that must stay constant. When you swap, you add to one side and remove from the other — but the product of the two sides has to remain equal to k. That constraint is what sets the price.

Example Imagine a pool with 10 ETH and 20,000 USDC. Then k = 10 × 20,000 = 200,000. If you buy 1 ETH, the ETH side drops to 9. To keep k constant, the USDC side must rise to 200,000 ÷ 9 ≈ 22,222. So you pay about 2,222 USDC for that 1 ETH — more than the starting "spot" price of 2,000, because your own purchase moved the price.

This is the key insight: the price is not fixed. The larger your trade is relative to the pool, the more the price moves against you. A deep pool with lots of liquidity barely moves; a shallow pool moves a lot.

AMMs vs. order book exchanges

FeatureAMM (DEX)Order book exchange
Price set byA formula and pool balancesBuyers and sellers placing orders
CounterpartyThe liquidity poolAnother trader
CustodyYou hold your own keysOften the exchange holds funds
Who earns feesLiquidity providersThe exchange / market makers
Works without active traders?Yes, as long as the pool has tokensNo, needs matching orders

AMMs made it possible to trade tokens that no professional market maker had ever touched. Anyone can create a pool, and anyone can supply liquidity — which is powerful, but also means quality varies wildly.

Slippage and impermanent loss: the two costs to understand

Two concepts trip up almost every beginner. Learn both before you trade or provide liquidity.

Example You provide ETH and USDC to a pool. If ETH doubles in price, the AMM automatically sells some of your ETH into USDC along the way. When you withdraw, you have more USDC and less ETH — and the combined value is lower than if you had just held the original ETH. The trading fees you earned may or may not make up the difference.
  1. Decide whether you are swapping (worry about slippage and fees) or providing liquidity (worry about impermanent loss and fees).
  2. Check pool depth — thin pools mean high slippage and easy price manipulation.
  3. Confirm you understand the token contract; scam and "honeypot" tokens often live on AMMs because listing is permissionless.
  4. Start small while you learn how a specific DEX behaves.

Why AMMs matter — and a word of caution

AMMs turned exchanges into open infrastructure. They run 24/7, require no account approval, and let assets from Bitcoin wrappers to obscure altcoins trade with whatever liquidity the community supplies. Many also run on faster, cheaper Layer-2 networks to reduce fees.

That openness cuts both ways. Smart-contract bugs, low-liquidity pools, malicious tokens, and front-running are real risks, and providing liquidity is not a guaranteed yield — fees can be smaller than impermanent loss. Nothing here is a promise of profit.

This article is educational and not investment advice. Crypto assets are volatile and you can lose money. Do your own research, understand each protocol's risks, and never commit funds you cannot afford to lose.

NOONOO TRADING — join the free chat and watch live trading together.

Join free chat →

📈 Sign up on OKX for a trading fee discount

Get OKX fee discount →