# Impermanent loss 

By [bytecode](https://paragraph.com/@bytewizard) · 2022-06-06

---

By decentralising traditional financial services, anyone can now lend funds to DeFi applications. Depositing digital assets, often into standard [liquidity pools](https://www.finder.com/liquidity-pools), can earn investors interest rates far above what is currently offered by global banks.

However, while high interest rates are offered as a potential upside, liquidity pools offer a sometimes unknown downside risk known as impermanent loss.

**What is impermanent loss?**

Impermanent loss is a unique risk involved with [providing liquidity](https://www.finder.com/liquidity-pools) to dual-asset pools in DeFi protocols. It is the difference in value between depositing 2 cryptocurrency assets within an Automated Market Maker-based liquidity pool or simply holding them in a cryptocurrency wallet.

Essentially, it occurs when depositing them into an automated market maker (AMM) and then withdrawing them at a later date results in a loss, compared to if you had just HODL'd and left them in your wallet.

In fact, you may not actually lose any money, but rather your gains are less _relative_ to if you had just left your assets untouched.

Inversely, losses can be amplified depending on how the market moves.

### **Liquidity pools**

A liquidity pool is typically made up of 2 cryptocurrencies known as a pair (e.g. ETH/DAI).

These are weighted equally in order to create a market for users to trade in and out of.

For example, an ETH/DAI pool is made up of 50% ETH and 50% DAI.

By prefunding a pool like this, AMMs avoid the need to pair buyers with sellers. Instead traders have access to a permanently available pool of liquidity rather than having to wait for someone on the other side of the trade, which is how traditional exchanges which use spot markets work.

### **How impermanent loss occurs**

When you provide liquidity to a pool, you deposit an equal **value** of each asset (e.g. $100 of ETH and $100 of DAI). You then receive liquidity provider tokens (LP tokens) which is a receipt that entitles you to a certain **percentage** of the pool, which is dynamic and corresponds to the amount of liquidity you provided compared to the overall amount in the pool.

Unfortunately, though, there is a unique risk involved when providing **2 assets** into a pool that requires the **value** of the assets to remain **balanced**.

For example, an ETH/LINK pool with a total value of $2 million would need $1 million of ETH and $1 million of LINK to remain balanced, regardless how many tokens that actually equates to.

As one (or both) of the tokens begins to fluctuate in value, the balance of the pool is going to shift. People are also trading in and out of the pool, which may also cause one side of the pool to grow or contract, ending up with something like a 60/40 balance.

When this happens, it presents an opportunity for arbitrage traders who essentially get to purchase one of the assets at a discount, compared to the rest of the market. By taking advantage of this, arbitrage traders end up naturally rebalancing in the pool. This is an important part of how AMMs stay operational, but creates a problem for liquidity providers.

Due to rebalancing, the number of tokens on either side of the pool has changed, even though the **values** have remained the same. Remember that LPs are entitled to a percentage of the pool, rather than a set amount of tokens or dollar equivalent. This means that when you withdraw from a pool, you may receive more of one token and less of the other.

Depending on how those assets changed in price, you may wind up with a "loss" compared to if you had just left those tokens in your wallet in the first place.

### **How to avoid impermanent loss**

In a volatile marketplace, impermanent loss is almost guaranteed when staking cryptocurrency assets within a standard liquidity pool. Exchange prices are always going to move. However, there are ways that the effects of impermanent loss can be mitigated.

### **Trading fees**

In the above math example, no trading fees were added to the liquidity pool. Trading fees are collected from traders using the liquidity pool and a share of those fees are then rewarded to liquidity providers. These fees are sometimes enough to mitigate and offset any impermanent loss. The more trading fees collected, the less impermanent loss there will be.

### **Low volatility pairs**

Impermanent loss is likely to occur for most volatile cryptocurrency pairings. However, impermanent loss can be mitigated by choosing a cryptocurrency pairing where the exchange price is not volatile. Examples of low volatility pairs include stablecoin pairings such as DAI:USDT, or different variations of the same token such as wETH(wrapped Ether):ETH. These examples include cryptocurrency pairings that follow a very similar price. Therefore, significant price movements between the pair are unlikely. If price volatility does not exist, impermanent loss can be avoided.

### **Complex liquidity pools**

One of the main reasons for impermanent loss is due to the 50:50 split that is required by most liquidity pools. To overcome this issue, some decentralized exchanges such as Balancer offer users a variety of liquidity pool ratios. They also offer pools with more than 2 digital assets. Price changes in pools that have a higher ratio, such as 80:20 or 98:2, do not result in as much impermanent loss when compared with pools that have a 50:50 split.

### **One-sided liquidity pools**

Impermanent loss occurs in a standard liquidity pool where 2 different cryptocurrency assets must be deposited. However, some exchanges such as Bancor have developed liquidity pools that offer users the opportunity to stake only one side of the pool. The other side of each liquidity pool on Bancor is made up of the native Bancor token, BNT. For example, for all ETH that is provided to the ETH:BNT liquidity pool, the equivalent BNT is added by the system. As a user only has to provide one side of the liquidity pool, there is no risk of impermanent loss.

Impermanent loss can occur regardless of price direction. In the math example above, we increased the price of ETH and explained that impermanent loss meant gains were lessened in comparison to digital assets sitting in a wallet. However, impermanent loss occurs regardless of which asset in the cryptocurrency pair is moving. An investor can only withdraw digital assets that have not suffered an impermanent loss if the exchange price happens to be exactly the same at the time of withdrawal.

Secondly, an impermanent loss is only realised when funds are withdrawn. It is "impermanent" because prices could return to the initial exchange price at any time. If prices returned, the impermanent loss would no longer exist. The loss is only permanent if an investor withdraws their funds from the liquidity pool.

### Impermanent loss calculator

*   [https://dailydefi.org/tools/impermanent-loss-calculator/](https://dailydefi.org/tools/impermanent-loss-calculator/)
    

### AMM formula

k = x \* y (x = the number of A coins, y = the number of B coins)

### **Math example of impermanent loss**

Investor A wishes to deposit liquidity into the ETH:DAI liquidity pool on SushiSwap.

For the purposes of explaining impermanent loss,

let's imagine that the total liquidity in the pool remains the same throughout. No trading fees are added and no liquidity is removed or added.

1.  The current price of 1 ETH is $100. As DAI is a USD stablecoin, 1 DAI is $1. The ratio of the liquidity pool must be balanced (50:50), so Investor A deposits 1 ETH and 100 DAI into the liquidity pool. The total investment equals $200.
    
2.  In total, there is 10 ETH and 1,000 DAI in the liquidity pool. Based on the AMM formula above, the total liquidity in the pool is $10,000 (10 x 1,000). Investor A's share represents 10%.
    
3.  During the week, the real-world market price changes significantly so that the price of 1 ETH is now $200 (or 200 DAI). There is now an imbalance between the real-world market price and the liquidity pool exchange price. This is an arbitrage opportunity.
    
4.  Arbitrage traders buy ETH from the liquidity pool that is 50% cheaper than the real-world external market price. This decreases the amount of ETH and increases the amount of DAI. The process continues until 1 ETH = 200 DAI.
    
5.  There is now a new distribution of ETH and DAI in the liquidity pool. One that can be calculated. This involves defining a few variables taken from the Automated Market Maker formula and adding in a new variable 'r'. r is the new ratio of cryptocurrency assets.
    

For this example, x = ETH, y = DAI, k = $10,000 (total liquidity) and r is 200 (1 ETH = 200 DAI). The new distribution of each asset can then be calculated using the following formulas:

![https://www.finder.com/finder-au/wp-uploads/2021/07/Impermanent-loss-guide.jpg](https://storage.googleapis.com/papyrus_images/13f19a8f7f135b90d2862fe8b4ef5eaf74ba4f1dd0001b2b7f5237dae61d3d6e.webp)

https://www.finder.com/finder-au/wp-uploads/2021/07/Impermanent-loss-guide.jpg

1.  After the arbitrage process, there is just over 7 ETH and just over 1,400 DAI in the liquidity pool.
    
2.  Remember, Investor A is entitled to 10% of the liquidity pool. If, at the end of the week, they wish to withdraw their share, they can withdraw 0.707 ETH and 141.42 DAI.
    
    At the new market price, this equals $282.82. Investor A has gained $82.82 compared to the initial investment. However, ...
    
3.  If Investor A had left the initial 1 ETH and 100 DAI in a crypto wallet, the value of their assets at the new market price would be $300.
    
4.  The impermanent loss in this example can be calculated by subtracting $282.82 from $300. The impermanent loss is $17.17.

---

*Originally published on [bytecode](https://paragraph.com/@bytewizard/impermanent-loss)*
