DeFi
Impermanent loss: the formula, and why the name misleads
Impermanent loss is the gap between what a deposit in an automated market maker is worth and what the same tokens would be worth if they had simply been held. For a constant-product pool it depends only on how far the price has moved, and it can be written down in one line. Concentration multiplies it, fees offset it only some of the time, and the word “impermanent” describes a special case: the loss is realised the moment the deposit is withdrawn.
What is being compared
The comparison is with holding, not with the original deposit. A depositor who put two tokens into a pool can end up with more dollars than they started with and still be behind holding. In a falling market the deposit can lose money and lose more than holding would have. Impermanent loss measures one thing: the cost of having let the pool trade the tokens on the depositor’s behalf.
Uniswap’s documentation frames the risk the same way, as the risk of losing money during large and sustained price movement “compared to simply holding an asset”, and its page on understanding returns calls it divergence loss in its page description before quoting the longer derivation by the writer Pintail. Divergence is the better name. The cause is that the two prices diverge from where they were at deposit.
How a pool prices trades in the first place is in what an automated market maker is. The short version needed here: the pool holds reserves x and y, keeps x × y constant (ignoring fees), and its price is y divided by x.
Deriving the formula
Take a pool of token A and a dollar stablecoin. Let x be the reserve of A, y the reserve of dollars, and k their product, so the pool’s price of A is P = y / x. Arbitrage moves the pool to the market price, and with the product fixed there is only one pair of reserves for each price. Uniswap’s page gives it:
- x = √(k / P)
- y = √(k × P)
The pool’s value in dollars at price P is P × x + y. Substituting both expressions, each term equals √(kP), so
V_pool = 2 × √(k × P)
Now suppose the deposit was made at price P₀, when the reserves were x₀ = √(k / P₀) and y₀ = √(k × P₀), and the price moves to P₁. Holding those original tokens is worth
V_hold = P₁ × x₀ + y₀
Write r for the price ratio, P₁ / P₀. Dividing V_pool by V_hold and cancelling √(k × P₀) from top and bottom leaves
V_pool / V_hold = 2√r / (1 + r)
so the loss against holding is 2√r / (1 + r) − 1, which is the formula on Uniswap’s page. A depositor’s share of the pool scales both values equally, so the ratio holds for any share. It is the same for r and 1/r: a doubling and a halving of the price cost the same percentage.
| Price ratio | Loss against holding |
|---|---|
| 1.25× | 0.6% |
| 1.5× | 2.0% |
| 2× | 5.7% |
| 3× | 13.4% |
| 4× | 20.0% |
| 5× | 25.5% |
These match the figures Uniswap’s page lists, and all of them ignore fees. Note what the formula does not contain: volume, time or the path the price took. In this model only the starting and ending prices matter.
A worked example, as arithmetic
The numbers below are invented to show the formula working. They are not a reading of any pool and say nothing about what any deposit will do.
A depositor adds 10 units of token A and 1,000 dollars of stablecoin when A is priced at 100, a deposit worth $2,000. Their own share has a product of 10 × 1,000 = 10,000.
Suppose the price doubles to 200. The share now holds √(10,000 / 200) = 7.07 A and √(10,000 × 200) = 1,414.21 dollars, worth 7.07 × 200 + 1,414.21 = $2,828.43. The original 10 A and 1,000 dollars, held, would be worth $3,000. The depositor is $171.57 behind holding, 5.7%, while being $828.43 ahead of the deposit.
If instead the price halves to 50, the share holds 14.14 A and 707.11 dollars, worth $1,414.21, and holding would be worth $1,500. The gap is $85.79, again 5.7%. Here the deposit and the held tokens have both lost money against the $2,000 starting value; the pool has simply lost more.
In both cases the pool did the same thing. As the price moved, arbitrageurs traded with it until its price matched the market, which meant buying A from the pool as A rose and selling A into it as A fell. The depositor’s share ended each move holding less of whichever token had gained.
Why concentrated liquidity amplifies it
Uniswap v3 lets a depositor confine liquidity to a price range. The v3 core whitepaper describes the real reserves of such a position by the curve (x + L/√p_b)(y + L√p_a) = L² (equation 2.2), where p_a and p_b are the ends of the range and L is the position’s liquidity. Inside the range, the position holds L × (1/√P − 1/√p_b) of the first token and L × (√P − √p_a) of the second (equations 6.30 and 6.29). Below the range it is all the first token and above it all the second. Out of range, it earns no fees.
Apply those formulas to the same invented deposit, 10 A and 1,000 dollars at a price of 100, placed in a range from 80 to 125. That deposit gives L ≈ 947.2.
| Price | Range position | Held tokens | Gap | Full-range gap |
|---|---|---|---|---|
| 120 | $2,113.71 | $2,200.00 | 3.9% | 0.4% |
| 125 | $2,118.03 | $2,250.00 | 5.9% | 0.6% |
| 150 | $2,118.03 | $2,500.00 | 15.3% | 2.0% |
| 80 | $1,694.43 | $1,800.00 | 5.9% | 0.6% |
At 120 the range position has given up $86.29, against $9.11 for the same deposit spread over the full range. The reason is visible in L. A full-range position with the same liquidity would need about $18,944 of capital at a price of 100, about 9.5 times this deposit, and inside the range the two positions lose the same number of dollars against holding. The range position takes the full-range loss of a deposit nine and a half times its size, which is the same multiplier that makes its fee share larger while the price stays in range.
Outside the range the position stops trading. At 125 it has sold all its A and holds $2,118.03 in stablecoin, and at 150 it holds exactly the same, while the held tokens keep rising. Below 80 it holds only A. Loesch, Hindman, Richardson and Welch, in a 2021 study of Uniswap v3, put the trade plainly: concentration increases the fees earned, but it also increases the risk taken, which they measure as impermanent loss.
Why “impermanent” misleads
The name comes from the special case. Uniswap’s page, quoting Pintail, says that if the price returns to where it was at deposit the loss disappears, and “for this reason, we can call it an impermanent loss”. The arithmetic agrees: at r = 1, the formula gives zero.
Three things make the word a poor guide. The first is that the loss is realised on withdrawal. A withdrawal hands back fixed quantities of each token, the ones the pool held at that moment. In the doubling example the depositor leaves with 7.07 A and 1,414.21 dollars, which is 2.93 A fewer than they put in and 414.21 dollars more. Buying the missing A back at 200 costs $585.79, which is $171.57 more than the extra dollars cover, so restoring the original holding costs exactly the gap. After that, a fall in A back to 100 changes the value of what they hold, as it would for anyone holding that mix, but it cannot reverse the pool’s trades: those were made inside the pool and the depositor has taken the result. The loss was impermanent only while the deposit stayed in.
Second, nothing makes the price come back. The formula is symmetric in the ratio, not in time, and a pair whose prices drift apart and stay apart leaves the loss in place for as long as the deposit remains.
Third, a range position can finish converting. Once the price leaves a v3 range the position is entirely one token, and the v3 whitepaper notes that if a crossed position is not withdrawn and the price crosses back, the position is traded back, effectively reversing the trade. A position that ran through the top of its range has, in effect, sold all its A on the way up.
There is also a finer objection, which concerns the benchmark. Milionis, Moallemi, Roughgarden and Zhang compare a pool not with holding but with a strategy that makes the same net trades at market prices, and call the shortfall loss versus rebalancing; they show it corresponds to arbitrageurs’ profits. Against that benchmark, a pool that ends where it started is level with holding but still behind. Where crypto yield comes from sets out how the two measures fit together, and the arbitrage itself is described in what MEV is.
Fees offset it only sometimes
A depositor’s fee income comes from volume: the pool’s fee rate times the trading that passes through liquidity the depositor provides, and in a v3 range, only while the price is inside it. The loss against holding, in the model above, comes from the ratio between the starting and ending prices and nothing else. Neither number, on its own, says whether the first will exceed the second. The passage Uniswap’s page quotes says as much: the trade-off is hard to know without knowing the amount of trading in between, and more back-and-forth movement is better for the depositor.
The Loesch study is one measurement of how that netted out. It covered 17 Uniswap v3 pools with uncorrelated pairs and more than $10 million locked, about 43% of v3’s locked value at the time. Between 5 May and 20 September 2021 it counted $199.3 million in fees against $260.1 million of impermanent loss, and the authors write that this left about half of the liquidity providers, 49.5%, with negative returns. It is one window and one set of pools, measured against holding. It shows that fees can fall short of the loss across a large part of a market, not how often they do.
The figures normally on display leave the loss out. A protocol’s fees, as shown beside its value locked on the protocol pages, are what traders paid in aggregate, and protocol fees and revenue sets out why that number cannot say what any depositor kept. A fee rate annualised from a short window describes the income side only, whichever of the APR and APY forms it is quoted in.
What to work out before depositing
None of this says whether a deposit is worth making. It says what has to be worked out to know.
- How far apart can the two tokens move? The formula depends only on the ratio. A pair that moves together keeps r near 1, and two stablecoins pegged to the same currency are the designed case for as long as both pegs hold. A pair that does not move together has no ceiling on r.
- What happens at the edges? For a range position, find the prices at which it becomes all one token, and what holding that token would mean.
- What does the fee depend on? Volume through your liquidity, at your fee tier, while in range. A past fee rate is a reading of past volume.
- What is the benchmark? Measure the result against holding the deposited tokens, fees included, at the moment you would withdraw. That is the comparison the loss is defined by, and the one a dashboard rate does not make for you.