AMM and Liquidity Pools Explained: How DEX Trading Really Works
Understand how automated market makers (AMMs) and liquidity pools power decentralized trading. Covers the x*y=k formula, impermanent loss, LP returns, and Uniswap v4 hooks โ your 2026 DeFi guide.
Last updated

Over $200 billion in crypto trades execute every month on decentralized exchanges โ no order books, no matching engines, no brokers. Just math. The system powering all of it is the Automated Market Maker (AMM), fed by pools of tokens that anyone can contribute to. If you've ever hit "Swap" on Uniswap and wondered how the price was calculated, this guide walks through the mechanics from first principles.
What Are AMMs and Liquidity Pools?
On a traditional centralized exchange like Coinbase or Binance, a matching engine pairs buyers with sellers. On a decentralized exchange (DEX), there's no order book and no counterparty waiting for your trade. Instead, you swap against a liquidity pool โ a smart contract holding a reserve of two tokens โ and an AMM sets the price automatically using a formula.
Think of it like a self-service currency kiosk that never closes:
- Traditional exchange (CEX): A teller matches your buy with someone else's sell, taking a spread.
- AMM-powered DEX: No teller. Two currencies sit in a vault. A math formula adjusts the rate as inventory shifts. Anyone who stocks the vault earns a cut of every exchange fee.
The key insight: the price isn't negotiated โ it emerges from the ratio of assets in the pool.
How AMMs Work: The Math Behind Every Swap
The Constant Product Formula: x ร y = k
The most widely used AMM formula is the Constant Product Formula, introduced by Uniswap v2.
x ร y = k
x = quantity of Token A in the pool
y = quantity of Token B in the pool
k = a constant that never changesThe rule is simple: no matter what trades happen, the product of the two token quantities must stay the same. This one constraint drives the entire price mechanism.
A Worked Example
Say an ETH/USDC pool holds 10 ETH and 20,000 USDC:
- k = 10 ร 20,000 = 200,000
- Implied price: 1 ETH = 2,000 USDC
Someone swaps 1 ETH into the pool:
- Pool now holds 11 ETH
- To keep k = 200,000: USDC remaining = 200,000 รท 11 = 18,181.8
- USDC paid out: 20,000 โ 18,181.8 = 1,818.2 USDC
- Effective rate: 1 ETH = 1,818.2 USDC (vs. the starting price of 2,000)
That gap is slippage โ the price impact of your own trade. The larger your trade relative to pool depth, the worse your slippage. Deep liquidity minimizes this.
Types of AMMs and Pool Structures
The Constant Product formula is just the starting point. Different protocols have engineered variations for different use cases.
AMM Types Compared
| AMM Type | Protocol | Key Feature | Best For |
|---|---|---|---|
| Constant Product (xรy=k) | Uniswap v2 | Simple, universal | General token pairs |
| Concentrated Liquidity | Uniswap v3/v4 | Focus LP capital in price ranges | Capital efficiency |
| StableSwap | Curve | Near-flat curve for pegged assets | Stablecoins, LSTs |
| Weighted Pools | Balancer | Custom token ratios (not just 50/50) | Portfolio-style pools |
How Liquidity Providers Work
Users who deposit tokens into a pool are called LPs (Liquidity Providers).
- Deposit two tokens at equal value (e.g., $1,000 of ETH + $1,000 of USDC)
- Receive LP tokens โ proof of your proportional share in the pool
- Earn a pro-rata cut of every trading fee generated by the pool
- Withdraw anytime by returning your LP tokens
Fee Structures Across Protocols
| Protocol | Fee Range | LP Share | Notes |
|---|---|---|---|
| Uniswap v3/v4 | 0.01โ1% (tiered) | 100% | Fee tier chosen at pool creation |
| Curve | 0.01โ0.04% | ~50% | Lowest fees for stable pairs |
| PancakeSwap | 0.25% | 68% | Largest DEX on BNB Chain |
| Raydium | 0.25% | 84% | Largest DEX on Solana |
Real-World Use Cases
The DEX Market in 2026
AMMs are no longer a niche experiment. As of early 2026:
- DEX share of global spot trading: 13.6% (up from 6.9% in January 2024)
- Monthly DEX volume: approximately $231 billion (January 2026)
- Uniswap TVL: approximately $6.8 billion
| Rank | DEX | Market Share | Chain |
|---|---|---|---|
| 1 | Uniswap | ~36% | Ethereum, L2s |
| 2 | PancakeSwap | ~29% | BNB Chain |
| 3 | Raydium | ~27% | Solana |
| 4 | Aerodrome | ~7% | Base |
| 5 | Curve | โ | Ethereum |
Uniswap v4: Programmable Pools
The standout AMM development in 2026 is Uniswap v4's Hooks architecture โ plugin-like contracts that attach custom logic to individual pools. The community has already shipped over 150 hooks, enabling:
- Dynamic fees that adjust automatically with market volatility
- Auto-rebalancing that keeps LP positions in the optimal price range
- Impermanent loss insurance funded by protocol fees
- Custom swap curves that replace xรy=k entirely for specialized use cases
LP Tokens and Composability
LP tokens don't just sit idle. Many DeFi protocols accept them as collateral, letting you borrow against your liquidity position or stake them for additional rewards. This layered yield is what makes liquidity provision central to the broader ecosystem.
Why AMMs Matter: Open, Permissionless Liquidity
Before AMMs, becoming a market maker required a license, institutional capital, and a seat on an exchange. AMMs remove every one of those barriers:
- Anyone can provide liquidity โ no application, no minimum beyond covering gas fees
- 24/7 availability โ pools never close the way traditional markets do
- No counterparty risk from a broker โ the smart contract holds the assets, not a company that can freeze your account
- Global access โ anyone with a wallet and internet connection can use a DEX or become an LP
- Transparent pricing โ the formula is public; the pool's reserves are verifiable on-chain in real time
This is exactly why DEX volume has doubled its share of global spot trading in under two years. Transparency, self-custody, and permissionless access are pulling both retail and institutional flow.
Risks and Limitations
Providing liquidity is not passive income with a guaranteed upside. Every LP must understand what can go wrong before depositing capital.
Impermanent Loss (IL)
Impermanent loss is the primary risk of being an LP. When the price of pooled tokens diverges from when you deposited, you end up holding more of the depreciated token and less of the appreciated one โ worse than simply holding both.
The term "impermanent" is misleading: the loss only becomes permanent when you withdraw at an unfavorable ratio.
Warning
2025 data shows that 54.7% of Uniswap v3 LPs in volatile pairs lost money relative to simply holding. Only 37.2% of non-stablecoin positions ended in profit. Most losses came from price ranges set too wide, or positions not adjusted as markets moved.
IL by price change:
| Price Change | Impermanent Loss |
|---|---|
| ยฑ25% | ~0.6% |
| ยฑ50% | ~2.0% |
| ยฑ75% | ~3.8% |
| 2ร increase | ~5.7% |
| 3ร increase | ~13.4% |
| 5ร increase | ~25.5% |
Smart Contract Risk
AMMs run on code. Bugs, exploits, and governance attacks have drained hundreds of millions from DeFi protocols. Audited protocols are meaningfully safer โ but not risk-free. Never deposit funds you can't afford to lose.
Slippage on Large Trades
The Constant Product formula means large trades against shallow pools get progressively worse prices. Always preview slippage before executing a significant position.
Regulatory Uncertainty
DeFi regulation varies by jurisdiction and continues to evolve. Access and legality today may shift depending on where you are and where policy moves.
Strategies That Reduce IL Risk
- Stablecoin pairs (USDC/USDT on Curve): near-zero IL, lower yield
- Correlated assets (ETH/stETH): tokens that move together reduce divergence
- Higher fee tiers on volatile pairs to offset IL with trading revenue
- Regular rebalancing for concentrated liquidity positions as prices move
Tip
Starting with a stablecoin pair on Curve is the lowest-risk way to learn LP mechanics. Near-zero impermanent loss means the learning curve doesn't cost you capital before you understand what you're doing.
FAQ
Is providing liquidity guaranteed to be profitable?
No โ and this is the most important thing to understand before depositing. You profit only when fee revenue exceeds impermanent loss. 2025 data shows that more than half of Uniswap v3 LPs in volatile pairs lost money relative to simply holding. Stablecoin pairs are the exception โ minimal IL, but also lower returns.
What is impermanent loss in plain English?
Imagine you put $1,000 of ETH and $1,000 of USDC into a pool. ETH then doubles. Arbitrageurs rebalance the pool, leaving you with less ETH and more USDC than you started with. If you had just held both tokens, you'd have more total value. That gap โ compared to simply holding โ is impermanent loss. It becomes real the moment you withdraw.
Can I withdraw my liquidity at any time?
Yes. Return your LP tokens and you can withdraw your share of the pool whenever you want. However, the token ratio you receive back will likely differ from what you deposited, reflecting any impermanent loss that occurred while your capital was in the pool.
Which chain is best for beginners starting out as LPs?
Low-fee chains like Arbitrum, Base, or Solana let you learn without large gas costs eating into your returns. On Ethereum L1, gas fees can exceed the returns from a small LP position entirely, making it impractical for getting started with limited capital.
What makes Uniswap v4 different from v3?
Uniswap v4 introduces Hooks โ pluggable smart contracts that can modify pool behavior at the level of individual pools. This enables dynamic fees, auto-rebalancing, impermanent loss insurance, and entirely custom swap curves. Every pool becomes a programmable venue rather than a fixed mechanism. Architecture changes also reduce gas costs for LPs.
Conclusion
AMMs and liquidity pools are the infrastructure layer of DeFi โ replacing order books and licensed market makers with open, algorithmic liquidity that anyone can contribute to. Understanding the xรy=k formula, the mechanics of impermanent loss, and the differences between pool types puts you well ahead of most participants.
Being well-informed doesn't remove risk, though. Impermanent loss is real, smart contract exploits happen, and no yield strategy is guaranteed โ especially with volatile token pairs. Dig deeper with our impermanent loss guide, explore the DEX vs. CEX comparison, and check the full DeFi overview for how AMMs connect to the wider ecosystem.
Important
This article is for informational purposes only and does not constitute financial advice. Providing liquidity involves real risks including impermanent loss, smart contract vulnerabilities, and price volatility. Only use capital you can afford to lose, and always do your own research (DYOR). NFA.
Keep learning

Impermanent Loss Explained: The Hidden Cost of DeFi Liquidity
Understand impermanent loss in plain language โ what it is, when it hurts most, how to reduce it, and the risks every DeFi LP should know before depositing.

DEX vs CEX: A Practical Comparison for Crypto Users
Centralized or decentralized exchange โ which one fits you? Compare security, fees, custody, and use cases to find out what actually matters for your situation.

What Are Stablecoins? Types, How They Work, and Real Risks
Understand stablecoins from the ground up โ fiat-backed, crypto-backed, algorithmic, and yield-bearing types โ plus depeg risks, USDT vs USDC, and how to use them in DeFi.
Explore related topics

Crypto Scam Prevention Guide 2026: How to Spot, Avoid, and Respond
Crypto scams drain billions every year โ and most victims thought they were careful. This how-to guide covers 10 scam types, step-by-step prevention rules, a security checklist, and what to do if you get hit.

Bitcoin Hits 20 Million Coins Mined: What the Scarcity Milestone Tells Us
On March 9, 2026, Bitcoin mined its 20 millionth coin โ 95.2% of all supply is now in circulation. A look at the supply architecture, halving schedule, and observable patterns from past cycles. Not financial advice.