5.4 Arbitrage and Price Discovery in AMMs
The Invisible Hand of DeFi
Imagine you're shopping and notice the same bottle of water costs $1 at Store A and $2 at Store B. You'd naturally buy from Store A. Now imagine you could instantly buy from Store A and sell to Store B for risk-free profit. If you could do this at scale, you'd keep buying and selling until the prices converged—the price at A rises (your buying depletes supply) and the price at B falls (your selling increases supply) until they meet somewhere in the middle.
This is arbitrage, and it's the mechanism that keeps AMM prices tethered to reality.
In 5.2, we learned that AMM prices are determined purely by pool ratios (y/x). But how do these ratios stay aligned with global market prices? The answer: arbitrageurs—traders who profit from price discrepancies and, in doing so, synchronize prices across all markets.
Arbitrage in DeFi is fascinating because:
- It happens automatically through smart contracts
- It can execute in milliseconds
- It requires no capital (via flash loans)
- It's provably optimal (via convex optimization)
- It generates billions in value extraction (MEV)
This lesson explores the mathematics, mechanics, and economics of arbitrage in AMMs—the invisible force that makes decentralized price discovery possible.
The Role of Arbitrageurs: Market Synchronization
Why AMMs Need Arbitrageurs
Consider an ETH/USDC Uniswap pool where ETH trades at $2,000. Suddenly, on Binance, ETH pumps to $2,100 due to a large buy order. What happens to the Uniswap price?
Without arbitrageurs: Nothing. The Uniswap pool maintains its ratio, now showing $2,000 while the market trades at $2,100. The pool becomes useless—no one would sell ETH to it for $2,000 when they could get $2,100 elsewhere, and everyone would try to buy ETH from it at the "discount."
With arbitrageurs: Within seconds:
- Arbitrageur spots the discrepancy
- Buys ETH from Uniswap at ~$2,000
- Sells ETH on Binance at ~$2,100
- Pockets $100 profit per ETH
- Uniswap price rises toward $2,100 due to the purchase
This continues until the price gap closes. Arbitrage is the mechanism that synchronizes AMM prices with the global market.
Arbitrageurs as Price Oracles
AMMs don't have built-in price feeds or oracles. The "correct" price emerges from arbitrage:
AMM Price ─────→ Arbitrage ←───── External Market Price
(profit incentive)
When AMM price < market price:
- Arbitrageurs buy from AMM, sell elsewhere
- AMM reserves rebalance: less ETH, more USDC
- AMM price rises until profitable arbitrage disappears
When AMM price > market price:
- Arbitrageurs sell to AMM, buy elsewhere
- AMM reserves rebalance: more ETH, less USDC
- AMM price falls until profitable arbitrage disappears
Key insight: Arbitrageurs don't set the price—they synchronize it. The external market (with its order books, institutional flows, and fundamental valuations) sets the price. Arbitrageurs ensure AMMs reflect it.
The Arbitrage-LP Relationship
Arbitrageurs and LPs have a symbiotic but adversarial relationship:
From the LP perspective:
- Arbitrageurs are extracting value through impermanent loss
- Every arbitrage trade rebalances the pool at unfavorable prices
- LPs are providing the liquidity that arbitrageurs profit from
From the arbitrageur perspective:
- LPs provide the opportunity to profit
- Arbitrage volume generates fees for LPs
- Without LPs, no arbitrage opportunities exist
The equilibrium:
- LPs accept IL in exchange for fee income
- Arbitrageurs provide price accuracy and trading volume
- Users get reliable prices and immediate liquidity
Arbitrage Volume and Frequency
How much trading is arbitrage? Studies suggest:
Uniswap V2 (2020-2021):
- ~30-40% of volume is arbitrage
- Arbitrage trades occur every 2-3 blocks on average during volatility
- 80%+ of blocks contain at least one arbitrage opportunity
Curve Finance (stablecoins):
- ~60-70% of volume is arbitrage
- Almost every significant external price movement triggers arbitrage
- Lower profits per trade, but higher frequency
General pattern:
- More volatile pairs → more arbitrage opportunities
- Deeper liquidity → smaller opportunities but still frequent
- MEV bots compete intensely, capturing opportunities in <1 second
The Optimal Arbitrage Problem
Now let's formalize arbitrage mathematically. This section draws from Guillermo Angeris et al.'s seminal paper "An Analysis of Uniswap Markets."
Problem Setup
An arbitrageur can trade between two markets:
Market 1 (AMM):
- ETH/USDC pool with reserves x₀, y₀
- Constant product: k = x₀y₀
- Fee: γ (typically 0.997 for 0.3% fee)
Market 2 (External reference market):
- ETH trades at price p_m (in USDC)
- Assumed infinitely liquid (for simplification)
The Arbitrage Strategy
The arbitrageur's strategy:
- Determine optimal trade size Δx to purchase from AMM
- Buy Δx ETH from AMM, paying Δy USDC
- Sell Δx ETH on external market, receiving p_m × Δx USDC
- Profit: p_m × Δx - Δy
Formulating the Optimization Problem
Objective: Maximize profit
maximize π = p_m · Δx - Δy
Constraints:
(x₀ + γΔy)(y₀ - Δx) = k (constant product with fee)
Δx ≥ 0, Δy ≥ 0 (non-negative trades)
Variables: Δx (amount of ETH to buy), Δy (amount of USDC to spend)