The impermanent loss also called divergent loss, is the difference between when you are holding tokens in an AMM (Automated Market Maker) Liquidity Pool and just simply holding them (i.e. HODLing) on the blockchain. When tokens are provided for liquidity in the market, they are funded to other users from a Liquidity Pool. When HODLing, the tokens are simply being held at market value.
In providing liquidity, the price ofthe tokens in a Liquidity Pool can diverge in any direction. The more divergence there is, the more impermanent loss a user (i.e. Liquidity Provider) suffers. This is called impermanent because it can only be temporary. When the price of the tokens returns to the original value the user had invested, the loss is erased. This is a common occurrence in Liquidity Pools, but it can become a permanent loss if the user withdraws their liquidity and absorbs the losses or if the price continues to diverge and the user loses more tokens as a result.
Due to market volatility, losses can become permanent in the short run. This severely affects a user’s investment in a pool when it leads to negative returns. This occurs due to how the AMM price the value of tokens. If the AMM is not directly connected to external markets, then when the price changes in other exchanges they do not automatically adjust their pricing.
When a user joins a Liquidity Pool (e.g. Uniswap pool) they must deposit a token pair consisting of ETH and another token set at a 50/50 ratio. This follows the constant product yield, which states that the product of the two liquidity pool tokens should be the same after a trade as before (excluding fees).
k = x * y
Using the example, we can represent ETH as x and another token as y. In this case y represents the amount of DAI in the token pair. Let us say 1 ETH = $100. The pool provides 10 ETH (10 * 100) which will be worth $1,000. The pool must hold an equivalent amount of DAI. In this case since 1 DAI = $1, the amount is 1,000 DAI.
ETH = $100 DAI = $1 1 ETH = 100 DAI
The pool is balanced when we have the following:
x = 10 ETH y = 1000 DAI k = 10 * 1000 = 10000
The constant k, must always be equal (minus fees) before and after a transaction in the pool. The value k is the product of the ETH liquidity pool and its token pair liquidity pool. The product in the example is 10000, which must be rebalanced if there are changes in order to keep this value constant.
Rebalanced means that if you were to lose a certain amount of ETH, the AMM should balance it out by buying more DAI so the constant product does not change.
The total pool size contribution is:
LP Total = ETH(x) + DAI(y) = 100(10) + 1(1000) = 1000 + 1000 = 2000
Likewise the size of the Liquidity Pool at any given price for each token is given relative to the price of ETH:
LP = Liquidity Pool pETH = Price of ETH ETH LP = √ (k / pETH) DAI LP = √ (k * pETH)
For ETH LP:
= √ ( 10000 / 100) = 10 For DAI LP: = √ (10000 * 100) = 1000
pETH is the same as P1 which is the original price of 100 for ETH.
Now suppose a new price for ETH P2 increases to 110, which increases the value of the asset by 10%.
∆ P = ( P2 — P1 ) / P1 ∆ P = ( 110–100 ) / 100 = 0.1 or 10% P1 = 100 P2 = 110
This changes the balance in the pool. Now the value pETH of ETH P2 is 110.
For ETH LP:
= √ ( 10000 / 110) = 9.534625892455923
For DAI LP:
= √ (10000 * 110) = 1048.808848170151547
In order for the value of k to remain balanced, the amount of DAI must increase if the amount of ETH decreases:
x = 9.534625892455923 ETH y = 1048.808848170151547 DAI k = 9.534625892455923 * 1048.808848170151547 = 10000
This creates an arbitrage opportunity with a 10% increase in the price of P2 ETH. Traders called arbitrageurs can buy ETH at a lower price from the AMM, if it does not update. Arbitrageurs are also incentivized to balance the pool by selling DAI for ETH.
If a user has 1% liquidity in the pool, they can claim only 0.01(9.5346) or0.095346258924559 ETH and 0.01(1048.8088) or 10.488088481701515 DAI, excluding fees. The user has lost ETH, but gained in DAI.
Here is the difference in value if the user provides liquidity and if the user just held their tokens:
With LP (V1):
1048.8088 (9.5346 ETH) + 1048.8088 (1048.8088 DAI) = 2097.62
1000 (DAI) + 1100 (ETH) = 2100
Based on the difference, the user lost:
L = V1 — V0 L = 2097.62 – 2100 L = -2.38
Selling DAI earns users 48.81 on the pool. The arbitrageurs will earn $2.38 in profit from buying ETH from the pool and selling it at the higher price on other exchanges.
Liquidity Providers (the users) on the pool lose $2.38 of their liquidity when compared to just holding their tokens and not providing it for liquidity. This is a negative on returns and it is a divergent or impermanent loss.
The divergence loss can be computed in terms of the price ratio between when liquidity was initially supplied and the current price of the token.
The Divergence Loss
In its most basic form, not including fees, the Divergence Loss is calculated by the formula:
DL = Divergence Loss PR = Price Ratio DL = [ ( 2 √ PR ) / (1 + PR) ] — 1
The PR is the ratio of the initial amount P1 invested by a user into the Liquidity Pool and the current price P2 in the market.
PR = P2 / P1 DL = [ ( 2 √ (P2 / P1) ) / (1 + (P2 / P1) ) ] — 1
First compute for the PR (Price Ratio):
PR = 110 / 100 = 1.1
Now that we have the variation in price from the ratio, we can compute the divergence.
DL = -0.001134430314141
By providing liquidity to the pool rather than holding, the user has a loss of -0.001134430314141 or -0.1134% in liquidity.
Based on a scale (see graph below) we can observe the following:
The more the price diverges from the initial amount of ETH (100) the greater the impermanent loss to the user. When the price of ETH goes up by 400%, the divergence loss is greater to the Liquidity Provider.
- At price of 100 there is no loss, at 0%
- At price of 200 (100% increase) there is a divergence of -5.71%
- At price of 300 (200% increase) there is a divergence of -13.33%
- At price of 400 (300% increase) there is a divergence of -20%
- At price of 500 (400% increase) there is a divergence of -25.46%
Solutions To Impermanent Loss
There is no absolute solution to impermanent loss much like there is no way to prevent market prices from dipping. These are events beyond anyone’s control because they are market-driven. The mood and sentiment of the market are often what determines pricing, so there should be due diligence on anyone’s part. The main problem with AMM is if they don’t have perfect information from the market, they cannot adjust quickly enough to prevent impermanent loss.
One way to counter this would be for AMM to have connections to external markets through the use of oracles. What oracles provide is up to the minute and more current information about activity in the market. Since AMM are implemented through smart contracts, they can plug into oracles to get data for adjusting to market prices as they happen. The benefit of this would be to prevent arbitrage opportunities that can affect the balance in a Liquidity Pool.
Bancor has introduced a protocol of their own for combating impermanent loss that relies on oracles. Bancor V2 uses pools that can adjust their weights automatically based on the external prices coming from the price oracles. What this does is mitigate impermanent loss, even in pools with volatile assets.
Another way to offset impermanent loss is through stablecoins as the token for liquidity. Since they are pegged to more stable baskets of currencies, they tend to remain stable at a 1:1 relationship with their peg. Curve Finance does this by creating stable pools. By using stablecoins they offer lower risk and less slippage, or variations in prices. Some may also see this as offering higher yields on investments.
It is all about risk management when it comes to impermanent loss. There will be newer and more innovative AMM solutions coming to the DeFi space to address the issue. Not just to mitigate against impermanent loss, but certainly to offer higher yields. Higher yields can also mean more exposure to divergence, which is why developers are always trying to find the best ways to address those issues.