Liquidity Curve
A liquidity curve is the mathematical function that defines how an AMM prices assets and distributes liquidity across a price range.
Key Takeaways
- A liquidity curve is the mathematical invariant that governs how an automated market maker (AMM) prices trades and allocates reserves between two or more tokens in a liquidity pool.
- Different curve shapes produce different trading behaviors: the constant product formula (x · y = k) spreads liquidity across all prices, while StableSwap curves flatten near the peg to minimize slippage on stablecoin trades.
- Curve design directly determines the tradeoffs between capital efficiency, slippage, and impermanent loss: choosing the right curve for an asset pair is one of the most important decisions in AMM design.
What Is a Liquidity Curve?
A liquidity curve is the mathematical function that an AMM uses to determine exchange rates between assets. When a trader swaps token A for token B in a decentralized exchange, the liquidity curve dictates how much of token B they receive for a given amount of token A. It also determines how the pool's reserves change after each trade.
In traditional finance, prices are set by matching buy and sell orders on an order book. AMMs replace this with a deterministic formula. The shape of that formula (the "curve") controls where liquidity is concentrated, how prices respond to trades of different sizes, and how much slippage traders experience. Different asset types require different curves: a volatile pair like ETH/USDC needs a different pricing function than a pair of stablecoins pegged to the same value.
The term "curve" comes from plotting the relationship between the two token reserves on a graph. Each point on the curve represents a valid pool state after a trade. The slope at any point gives the instantaneous exchange rate, and the curvature determines how quickly that rate changes as trade size increases.
How It Works
Every AMM enforces an invariant: a mathematical relationship between pool reserves that must hold true before and after every trade. Traders move along the curve by depositing one token and withdrawing another, but the invariant remains constant (ignoring fees). The three major liquidity curve designs each define a different invariant.
Constant Product (x · y = k)
The constant product formula is the simplest and most widely used AMM invariant, introduced by Uniswap v2. If a pool holds x units of token A and y units of token B, the invariant requires that their product remains constant:
x * y = k
// Example: pool with 100 ETH and 200,000 USDC
// k = 100 * 200,000 = 20,000,000
// Spot price of ETH = y / x = 2,000 USDC
// Trader buys 1 ETH:
// New x = 99, new y = k / 99 = 202,020.20
// Trader receives 200,000 - 202,020.20 ... wait
// Actually: trader sends USDC in to get ETH out
// Trader wants 1 ETH out: new x = 99
// new y = 20,000,000 / 99 = 202,020.20
// Cost = 202,020.20 - 200,000 = 2,020.20 USDC
// Effective price = 2,020.20 USDC per ETH (vs spot 2,000)On a graph, this invariant traces a hyperbola. Liquidity is distributed uniformly from a price of zero to infinity, meaning the pool can always facilitate trades at any price. The tradeoff is that most of the capital sits idle: in a pool where ETH trades around $2,000, the reserves allocated to prices like $10 or $100,000 are never used.
The constant product curve is robust and general-purpose. It never runs out of either token entirely (the curve approaches but never touches the axes). This makes it suitable for volatile pairs where prices can swing dramatically, but it comes at the cost of poor capital efficiency.
StableSwap (Curve Finance)
The StableSwap invariant, introduced by Curve Finance, is optimized for assets that trade near the same price, such as stablecoin pairs (USDC/USDT) or wrapped asset pairs (WBTC/BTC). It blends two simpler invariants using an amplification coefficient A:
// StableSwap invariant (simplified for 2 tokens):
// Blends constant sum (x + y = D) with constant product (xy = (D/2)^2)
// A * 4 * (x + y) + D = A * D * 4 + D^3 / (4 * x * y)
// When A is high: curve flattens toward constant sum
// -> near-zero slippage at peg, ideal for stablecoins
// When A = 0: reduces to constant product (x * y = k)
// -> same behavior as Uniswap v2
// Typical A values: 10 to 2,000
// Higher A = flatter curve near peg = lower slippage
// Lower A = more curvature = better protection at extremesThe constant-sum component (x + y = D) provides zero slippage when the pool is balanced, but it has a fatal flaw: it allows the pool to be fully drained of one token. The constant-product component prevents that by introducing steep price impact at the extremes. The amplification coefficient A controls the blend: high A values flatten the curve near the peg, while low A values make it behave more like a standard constant product pool.
This design concentrates liquidity around the peg price. A StableSwap pool can facilitate a $1 million stablecoin trade with a fraction of the slippage that the same trade would incur on a constant product pool of equal size. For pegged assets, this is dramatically more capital efficient.
Concentrated Liquidity (Uniswap v3)
Concentrated liquidity, introduced by Uniswap v3, takes a fundamentally different approach. Instead of relying on a single global invariant, it allows individual liquidity providers (LPs) to choose a specific price range for their capital. Within that range, the math still follows a constant product formula, but the "virtual reserves" are much larger than the actual deposited capital.
// Concentrated liquidity within price range [p_low, p_high]:
// Virtual reserves: x_virtual and y_virtual
// L^2 = x_virtual * y_virtual
// L = liquidity parameter (depth of position)
// Example: LP provides $10,000 to ETH/USDC
// Full range (0 to infinity): same as Uniswap v2
// Range $1,800 to $2,200: ~10x more effective liquidity
// Range $1,950 to $2,050: ~40x more effective liquidity
// Uniswap's launch materials cited up to 4,000x
// capital efficiency gains in best-case scenariosThe narrower the range, the more concentrated the liquidity and the higher the capital efficiency. An LP concentrating in a tight range around the current price provides the same depth as a much larger position spread across all prices. The tradeoff: if the price moves outside the LP's chosen range, their position becomes inactive and earns zero fees. It also becomes fully composed of the less valuable token, a form of impermanent loss.
Concentrated liquidity effectively lets the market create any curve shape through the aggregation of many individual positions. A stablecoin pair will naturally attract most LPs to a tight range around $1.00, producing a flat aggregate curve similar to StableSwap. A volatile pair will see LPs spread across wider ranges.
How Curve Shape Affects Trading
Slippage
Slippage is the difference between the expected price and the executed price of a trade. Flatter curves produce less slippage for a given trade size because the exchange rate changes slowly. The StableSwap curve with a high amplification coefficient can handle large stablecoin swaps with near-zero slippage. A constant product curve, by contrast, produces proportional slippage on every trade regardless of size.
Capital Efficiency
Capital efficiency measures how much useful trading depth a given amount of deposited capital provides. A constant product pool distributes its capital across all possible prices, so most of it goes unused. Concentrated liquidity and StableSwap curves focus capital where it is actually needed, requiring less total value locked to achieve the same trade execution quality. In practice, a concentrated liquidity position in a narrow range can provide the same depth as a full-range position many times its size.
Impermanent Loss
Impermanent loss occurs when the price ratio between pooled assets changes, leaving LPs worse off than if they had simply held the tokens. Curve shape affects how severe this loss becomes. Concentrated liquidity amplifies impermanent loss within the chosen range: the narrower the range, the higher the potential loss when prices move. StableSwap curves mitigate impermanent loss for pegged assets because prices rarely deviate far from the peg, and the flat curve region minimizes the portfolio rebalancing that drives the loss.
Use Cases
Stablecoin Pools
Stablecoin-to-stablecoin trades demand minimal slippage because the assets should trade near 1:1. StableSwap curves (or tightly concentrated liquidity positions) are the standard choice. Curve Finance built its entire protocol around this use case, and its pools routinely handle multi-million dollar swaps with slippage measured in basis points. This makes flat curves essential infrastructure for stablecoin swaps across DeFi.
Volatile Asset Pairs
Pairs like ETH/USDC or BTC/ETH experience large price swings. Constant product curves or wide-range concentrated liquidity positions work best here because they guarantee liquidity at any price. LPs in volatile pairs accept lower capital efficiency in exchange for staying active across a broader range of market conditions.
Custom Curve Protocols
Newer protocols experiment with custom curves for specific use cases. Bonding curves define token price as a function of supply for token launches and continuous funding. Protocols like Balancer generalize the constant product formula to weighted pools (x^w1 · y^w2 = k), enabling exposure ratios other than 50/50. Uniswap v4's hook system allows developers to modify curve behavior through programmable hooks that run custom logic before or after swaps.
DEX Aggregation and Routing
DEX aggregators split trades across multiple pools with different curve types to minimize total slippage. A large stablecoin swap might route partially through a StableSwap pool and partially through a concentrated liquidity pool, depending on which offers better rates at each portion of the trade size. Understanding curve shapes is fundamental to how smart order routers optimize execution.
Why It Matters
Liquidity curves are the core primitive of decentralized trading. The choice of curve determines whether a protocol can compete with centralized exchanges on execution quality, whether LPs earn sustainable returns, and whether large trades can execute without excessive price impact. As DeFi matures, curve design continues to evolve: from the simplicity of constant product to the specialization of StableSwap to the flexibility of concentrated liquidity and programmable hooks.
For users of payment infrastructure built on decentralized protocols, curve design affects the cost and reliability of token swaps that happen behind the scenes. When a payment system converts between stablecoins or settles across different assets, the underlying liquidity curve determines execution cost. Protocols in the Spark ecosystem that handle stablecoin swaps or atomic swaps benefit from deep, efficiently-curved liquidity on the venues they route through.
Risks and Considerations
Curve Mismatch Risk
Using the wrong curve for an asset pair leads to poor outcomes. A constant product curve on a stablecoin pair wastes capital and produces unnecessary slippage. A StableSwap curve on a volatile pair can catastrophically underprice large trades when one asset depegs, because the flat region allows massive imbalances before the price reacts. Depeg events on StableSwap pools have historically caused significant losses for LPs who provided liquidity assuming the assets would stay pegged.
Amplification Parameter Risk
In StableSwap pools, the amplification coefficient A is a governance parameter that can be adjusted. Setting A too high creates a very flat curve that offers minimal protection during depegs. Setting A too low negates the benefit of using StableSwap over constant product. Protocol governance must balance efficiency against tail risk, and parameter changes can affect existing LP positions.
Concentrated Liquidity Complexity
Concentrated liquidity requires active management. LPs must choose price ranges, monitor positions, and rebalance when prices move. Passive LPs who set wide ranges sacrifice much of the capital efficiency benefit. Research has shown that concentrated liquidity gains disproportionately benefit traders (through lower slippage) rather than LPs, who often underperform a simple buy-and-hold strategy after accounting for impermanent loss.
Oracle and Manipulation Risks
AMM pool prices are determined by the curve and can diverge from true market prices until arbitrageurs correct them. Shallow curves or low-liquidity pools are vulnerable to oracle manipulation and sandwich attacks. Protocols that use AMM pool prices as TWAP oracles must understand how the underlying curve shape affects price responsiveness and manipulation cost.
This glossary entry is for informational purposes only and does not constitute financial or investment advice. Always do your own research before using any protocol or technology.