What is Impermanent Loss?

Sai
Shunya
Published in
6 min readJul 1, 2022

Automated market maker (AMM) technology has tasted soaring success despite being home to DeFi’s dirty secret — AMM liquidity providers can lose their token value while providing liquidity compared to just holding the token on their own.

Some users are completely unaware of this risk, while others have a vague idea of the concept. Even then, most of them don’t understand why and how impermanent loss occurs. This article delves into impermanent loss in crypto and explores potential ways to mitigate the risks.

Impermanent Loss Explained

The temporary loss of funds that occurs while providing liquidity is known as impermanent loss. The term explains the difference between providing liquidity to an asset versus holding an asset.

Impermanent losses are most noticeable in standard liquidity pools. In these pools, liquidity providers need to provide both assets of equivalent value. The risk of liquidity pool impermanent loss occurs when the value of one asset is volatile in relation to the other.

Brief on Liquidity Pools and Automated Market Making (AMM)

DeFi liquidity pools usually feature two tokens, forming a pair- for example, DAI and ETH. The weightage of both cryptocurrencies is kept the same so that it’s easier to trade. Basic liquidity pools constantly ensure that the value of the two tokens remains equal. In case the quantity of one token decreases, the pool increases the token price leading to liquidity pool risk.

On the other hand, AMM uses a mathematical formula to manage the trades in the liquidity pool. The same algorithm is responsible for determining the prices of the currencies depending on the trades happening in the pool. For example, Uniswap uses the following formula X * Y = K.

X and Y in this formula are the tokens, and K is the fixed constant that ensures that the total liquidity in the pool remains the same. Although all AMMs use a different formula, the common thread is that they use algorithms for their pricing instead of order books.

The world’s most popular Dex, Uniswap, witnessed more than 50% of liquidity providers lose money due to impermanent loss. Impermanent loss exceeded the trading fees earned in almost all the pools analyzed. Both amateur users and sophisticated professionals could not bank a profit under this model.

Curve Finance dodges the risks of impermanent losses using stable pools. All pools in Curve are of two kinds — 1:1 stable coin pools (i.e., USDT/DAI) or 1:1 synthetic token pools or token pools (i.e., sETH/ETH). By restricting pairs to assets that reflect one another in value, Curve Finance makes impermanent loss a non-existent issue.

An example of how impermanent loss occurs

Here’s an easy way to understand how impermanent loss plays out for the liquidity providers-

Consider I provide:

  • Token A: 1 ETH
  • Token B: 100 DAI
  • There’s a total of 10 ETH and 1,000 DAI in the pool post deposit.
  • Now my stake in the pool is 10%

Assume
In a week, 1 ETH trades for 200 DAI

First off, let’s calculate k, which is the constant product of the pool.

  • k = 10 * 1,000 = 10,000

Since ETH has doubled in price relative to DAI, arbitrage traders purchase ETH at a low price from the pool until it hits 200 DAI a unit. At the start of the week, there was 10 ETH and 1,000 DAI in the pool, but that was when it was 100 DAI per ETH. Now after the price of ETH has increased, to calculate the new distribution of assets in the pool, a few variables must be established, beginning with the price ratio between the assets in the pool.

  • Rt =a price in b where a and b are the two assets in the pool

In the above formula, a is ETH and b is DAI. Also, in the formula, 1 ETH traded for 100 DAI at the start. Therefore initial r is 100; t is used to show the time in which r is calculated.

Combining the above equation with the fundamental formula of AMM, formulae can be extracted to calculate the amount of each asset in the pool at any given ratio r at any given time t:

  • Xt = sqrt(K/Rt)
  • Yt = sqrt(K * Rt)

These equations can then be applied to the starting position of the price assets:

  • Xt1 = sqrt(10,000/100) = 10
  • Yt1 = sqrt(10,000 * 100) = 1000

Thus, the initial state of the assets in the pool is — 10 ETH and 1,000 DAI. The same equation can be applied for the new prices, when 1 ETH trades for 200 DAI. The new r is 200.

  • Xt2 = sqrt(10,000/200) = 7.07
  • Yt2 = sqrt(10,000 * 200) = 1,​​414.21

After the change in the price of ETH, the pool contains about 7 ETH and about 1,414 DAI:

7.07∗1,414.21 = 10,000

The constant product equation is intact. The original stake in the pool was 10%, so after the price change of ETH, the investor is entitled to 0.707 ETH and 141.421 DAI. If they had simply held the assets (1 ETH and 100 DAI) they would now have $300 worth of assets.

However, since they participated in an AMM-based pool, worth in USD is:

  • 0.707 * 200 +141.421 = $282.821

Using this, the impermanent loss can be calculated:

Initial investment = $300
Current value of the pool = $282.821
$300 - $282.821 = $17.179

  • Impermenant loss percentage = 17.179/300 = 0.0572*100 ~= 5.72%

The investor would have gained about 5.72% or 17.179 DAI if they had simply held the assets instead of staking them in the pool.

How to Mitigate Impermanent Loss

If the market is volatile and prices are bound to fluctuate, impermanent loss is inevitable. However, you can follow a few practices to ensure you don’t suffer a heavy loss when prices move in DeFi liquidity pools.

Use a stable coin pairs:
To completely avoid impermanent loss, make two stable coins liquid. For example, if you make USDT and USDC liquid, impermanent loss can be avoided altogether since stable coin prices are meant to be stable. However, one major drawback is that there will be no profits from a rise in the market.

There’s no logic to holding stable coins in a bull market because there won’t be any returns from them. However, in a bear market, you can provide liquidity to stable coins and earn trading fees. This way, you can earn profits from fees without any losses.

Invest in highly correlated pairs:
Some cryptocurrencies are more volatile than others. If you are studying a crypto pair and the market shows that one will outperform the other, avoid providing liquidity to them. However, if you find out that the prices of both currencies will rise or fall relative to each other, you can go ahead with them. The overall idea is to stay alert of volatile currency pairs by tracking current and future market trends.

Like for an example: BTC - ETH are very much correlated.

Seek trading fees:
While trading, users need to pay trading fees. The AMM offers a share of these fees to the liquidity providers. In some cases, the fee amount can offset the impermanent loss that occurred.

Go for a flexible liquidity pool ratio:
AMMs create a balanced liquidity pool ratio which increases the chances of impermanent loss. However, other DeFi exchanges allow liquidity in different ratios.

Make use of an impermanent loss calculator:
As a liquidity provider, it is important to identify possibilities of loss with specific liquidity pools. Just like dexes, impermanent loss calculators can determine potential losses for you in advance. You can even set the initial and future prices of two tokens in some calculators. These impermanent loss calculators provide a detailed report of potential losses based on a comparison of different situations in the pool.

Wait for exchange rates to get back to normal:
Another way to prevent heavy losses is to not withdraw your currencies in the face of price deviation. Instead, you can wait for the prices of your crypto pair to return to their initial rates.

How Much Impermanent Loss Has Happened?

A recent study by crypto consultancy, topaze.blue revealed that approximately 50% of users who provided liquidity to their tokens in Uniswap V3 had to face negative returns. In other liquidity pools, a high percentage of users (70 to 75%) suffered more losses via impermanent loss than in trading fees.

As AMMs continue to rise in popularity, impermanent loss is something many users will have to deal with. Thankfully, there are a bunch of ways to mitigate, eliminate, or prevent these losses. One of them is to use Shunya’s DeFi dashboard to monitor your investments and track impermanent losses with P&L. We support Uniswap, Pancakeswap & Sushiswap in AMMs.

About Shunya

Shunya is an investor-focused DeFi deep analytics platform. Our goal is to simplify DeFi experience and help investors grow with informed decisions.

We’re a team with a very diversified background in engineering, entrepreneurship & marketing. We love talking about web3, finances, food, health & pets.

Follow us on

Website | Twitter | Discord

--

--