What is Impermanent Loss in Yield Farming?

Blog_Li.png

If you’re interested in generating a passive income with crypto, then you probably know something about farming and providing liquidity. Today, many DeFi platforms such as Uniswap, SushiSwap, and PancakeSwap allow you to become a liquidity provider (LP) by placing your crypto assets in their liquidity pools and earning commissions for trading operations carried out on the platform.

It’s quite easy to make money this way, but you must be aware of the risks of investing in liquidity pools, and the most common risk is impermanent loss.

How automated market maker (AMM) liquidity pools work

For users of a given DeFi protocol based on an automated market maker (AMM) to be able to sell or buy coins and tokens at any time that is convenient for them, a liquidity pool — a form of cryptocurrency storage that allows you to exchange one currency for another quickly — is required.

An AMM is a software algorithm that controls the liquidity and pricing of cryptocurrencies on decentralized platforms such as DEXs.

Let's say you want to sell 1 ETH, which is worth, for the sake of argument, 2,000 USDT. To avoid waiting for a counterparty who needs 1 ETH and has 2,000 USDT to purchase it from you, you need a liquidity pool that can take 1 ETH from you and give you 2,000 USDT in return. 

There are lots of people who want to exchange ETH for USDT, so there is a high demand for this liquidity, which is what LPs – also known as market makers – provide.

Market makers contribute a cryptocurrency pair (in our case, ETH/USDT) to the liquidity pool, usually at a ratio of 50:50. The decentralized exchange and traders receive liquidity and can exchange ETH for USDT and vice versa at any time, while liquidity providers are rewarded in the form of commission fees in proportion to their share of investments in the pool.

All of this looks fairly simple and mutually beneficial for the participants. There is, however, one caveat pertaining to the risk of impermanent loss for market makers. This risk is associated with the volatility of one cryptocurrency in relation to the other.

What is impermanent loss?

Impermanent loss occurs when the price of a token rises or falls after you deposit it in a liquidity pool. It indicates a loss when the dollar value of your token at the time of withdrawal is less than the amount deposited. 

Impermanent loss is a temporary loss associated with the volatility of the trading pairs that LPs place in AMM-based liquidity pools. This indicator is expressed in dollars and shows how much the liquidity provider has lost in terms of the funds actually withdrawn, as compared with the value of the assets if they had simply been stored in a crypto wallet.

The AMM balances the ratio of crypto assets in the pool at 50:50, thereby setting their value.

AMMs use the following formula as the pricing mechanism:

X * Y = K

where X and Y are a pair of assets in the pool, and K is a constant that must be the same before and after the transaction.

The main reason for impermanent loss is the discrepancy between the value of the coins in the pool and their real market price.

How impermanent loss happens

Let’s imagine a scenario where you are a liquidity provider who has put 1 ETH and 2,000 USDT in a pool. For convenience, let’s say that 1 ETH is worth 2,000 USDT, so your investment is valued at $4,000.

Now, let's say that your investment in the liquidity pool is worth 10% of all the funds placed in it. This would mean that K = 10 ETH * 20,000 USDT = 200,000.

The constant K must remain the same after all of the transactions in the pool have been executed. Even if the price of 1 ETH rises to 8,000 USDT, the AMM will still treat it as being worth 2,000 USDT.

As long as the total value of the pair of coins you have placed in the pool is the same, nothing happens, and everything remains stable. If the cost of 1 ETH starts to grow, arbitrage traders appear. They buy ETH from the pool at the below-market price until the coin's value equals the external market price.

In our example (we’ll omit fees for convenience), for the ETH price in the pool to match its market price, the pool ratio should be 5 ETH to 40,000 USDT (this would maintain the value of K at 200,000).

If you withdraw your crypto assets from the pool, you will receive 0.5 ETH and 4,000 USDT. In dollar terms, you’ll get $8,000 in your wallet. This appears satisfactory. You’ve invested $4,000 in the pool and received $8,000. 

Now, let's calculate how much money you would have if you didn't become a liquidity provider but simply held your crypto assets (1 ETH and 2,000 USDT). Based on the exchange rate when withdrawing your funds from the pool, they would be worth $10,000 (1 ETH = $8,000 + 2,000 USDT). This $2,000 difference is the impermanent loss.
 

Examples of impermanent loss

To better understand impermanent loss, consider the details of a typical scenario that an investor like you may experience. 

For example, we have a USDC/ETH liquidity pool with an equal ratio of each token, with 1 ETH worth $100. You contribute 1 ETH and 100 USDC to the liquidity pool as a liquidity provider. The deposit amount is US$200 because both the ETH and USDC tokens deposited are worth $100 each.

Assume the liquidity pool contains 10 ETH and 1,000 USDC. It means you own 10% of the pool. Since the liquidity pool ratios determine the price of each token in the pool, their prices are unique from those seen on exchanges.
 

Let's assume the ETH price multiplies in the next six months, making each ETH worth $200 in January 2022. There should be approximately 7.071 ETH and 1,414.21 USDC to maintain the 50/50 ratio.
 

If you withdraw now, you will receive 0.7071 ETH and 141.42 USDC, approximately $282 USD. However, if you had kept your ETH, you would have US$300 in tokens (US$100 in USDC and US$200 in ETH). The difference of US$18 is your impermanent loss. 

More significant changes in the pooling ratio result in a greater impermanent loss for the providers. The previous calculation assumes that impermanent loss is calculated for only one asset. Furthermore, one of the assets is presumed to be stable, which may or may not be the case.

Estimating impermanent loss

Impermanent loss can occur regardless of how the asset price changes.

Let's see how much impermanent loss you'll get for different price changes in the ETH/USDC pair.

If the price of ETH rises, then:

  • A 10% increase results in a 0.11% loss
  • A 25% increase results in a 0.62% loss
  • A 50% increase results in a 2.02% loss
  • A 2x increase results in a 5.72% loss
  • A 3x increase results in a 13.4% loss
  • A 4x increase results in a 20.0% loss
  • A 5x increase results in a 25.46% loss

If the price of ETH falls, then:

  • A 10% decrease results in 0.14% more loss
  • A 20% decrease results in 0.62% more loss
  • A 50% decrease results in 5.72% more loss
  • A 90% reduction will result in 42.5% more loss

As you can see, using automated market makers as a liquidity pool is bound to result in a temporary loss. It reduces your gains and can significantly increase your losses. Let's discuss options for avoiding or mitigating impermanent loss in yield farming.

How to avoid impermanent loss

Now that you understand impermanent loss, let's look at ways to reduce your chances of incurring them.

Try stablecoin pairs

 The first thing you need to understand is that volatility is the deciding factor impacting the size of the impermanent loss. The more the value of an asset changes, the greater the loss. Therefore, one way to reduce the risk of its occurrence is to work with crypto assets with a lower volatility.

If you provide liquidity to a pair such as USDT/USDC, you will not be exposed to any risk of temporary loss because the prices, as the name implies, are stable. It is an effective strategy in a declining market because you will still profit from your share of trading fees.

Invest only a portion of your assets

Another way to reduce your exposure to impermanent loss is to split your crypto assets in half. Only one portion should be invested in a liquidity pool. Then, hold the other half to cut your potential impermanent loss by two. Since only half of your assets are invested in the pool, fees and benefits are cut in half. 

Consider the ETH/DAI pair. If the price of ETH rises by 50%, you will incur a 2.02% temporary loss. 

If you invested $1,000, you would incur an impermanent loss of about $20. However, if you only invest half of your ETH/DAI pairing into the liquidity pool, your impermanent loss is reduced to US$10.1.

Avoid volatile pairs

Avoiding more volatile cryptocurrency pairs can help you avoid temporary loss. If your research suggests that one asset in a pair exceeds the other, you should look for more stable pairs. 

You should also look for LPs with asset ratios that differ from the standard 50/50 split. For example, Balancer has flexible pools with asset ratios like 95/5, 80/20, and 60/40. Do the math and discover what works best for you.

Invest in uneven liquidity pools

Uneven LPs can help minimize impermanent loss because a significant price movement for a specific asset has less damage and covers less than half of the asset's value. Finally, even if you risk temporary loss, some liquidity pools provide incentives to cancel any possible losses from a price change. If the trading fees are high, your share of the costs may surpass any temporary loss.

Try liquidity mining

Liquidity mining is another popular DeFi investment strategy. It rewards the liquidity provider with a native token in exchange for providing liquidity. 

Invest in new liquidity pools

Putting your assets in pools that have recently opened can provide a certain level of protection. You’ll get a larger share of the pool and a higher reward through commissions for providing liquidity, which can partially or completely cover the impermanent loss.

You can also invest in pools with high commissions and APY (annual percentage yield), which can also help reduce impermanent loss.

It goes without saying that you should also track the prices of coins and tokens that you have invested in liquidity pools so you can withdraw your crypto assets in good time.

Conclusion

The concept of liquidity pool impermanent loss is crucial in decentralized finance, especially yield farming. Understanding the meaning of impermanent loss will show you how much profit you miss out on by becoming a liquidity provider instead of simply holding your assets. 

Yield farming is a relatively new area of decentralized finance, so it's critical to understand the risks involved. DeFi prediction markets and decentralized exchanges are also popular DeFi protocols with risks and strategies.

Despite the risk of impermanent loss, you can still determine whether a particular liquidity pool is profitable. If your yield returns are more significant than your impermanent loss, you will have higher returns than simply holding your assets. Consider the fees you can charge as a liquidity provider.