What is Impermanent Loss?


Impermanent loss is a concept related to decentralized finance (DeFi) that refers to the potential price volatility of cryptocurrencies. It occurs when a user enters into a DeFi transaction and the value of the asset they’re trading with changes before the transaction is completed. This can lead to a temporary loss of funds, but the asset can then recover its value and the loss can be reversed. In this way, impermanent loss can be seen as a necessary risk of DeFi transactions.


AdvancedDeFiTrading and investment


AdvancedDeFiTrading and investment

What are non-permanent losses?

Intermittent losses (Impermanent Loss, IL) are temporary losses in the process of holding a position on a decentralized exchange based on the automatic market maker (AMM) mechanism. They represent the difference in the value of assets held in a wallet (HODL) and held in a liquidity pool.

Intermittent losses occur mainly in classic pools, where the liquidity provider (LP) must provide both assets in an equal ratio, and one of the assets is volatile relative to the other.

Intermittent losses on the example of the DAI/ETH liquidity pool of the Uniswap exchange, where both tokens are represented in a 50:50 ratio:

  1. We stake 1 ETH and 1000 DAI in the pool.
  2. After a week, 1 ETH is equal to 2000 DAI.
  3. If we kept 1 ETH and 1000 DAI, then the profit would be 50% (the value of 1000 DAI would not change, but the price of 1 ETH would increase to 2000 DAI).
  4. Staking tokens in an AMM pool on Uniswap gives less profit than 50% from simply holding assets.

Losses are called non-permanent or unrealized, because they are not fixed until the liquidity tokens are withdrawn from the pool. In the example above, if the price of ETH returns to the original 1000 DAI and funds are withdrawn after that, there are no intermittent losses.

Uniswap, SushiSwap and similar AMMs work with a simple formula:

x ∗ y = k

  • x — number of tokens for asset A;
  • y — number of tokens for asset B;
  • k – the so-called constant product (constant product) of the pool – this value does not change.
What is Impermanent Loss?
An example of the operation of the DAI/ETH liquidity pool of the Uniswap exchange. Data: The Chain Bulletin.

The contract held tokens with an approximate value of $153.5 million – 29,116.6 WETH and 76.7 million DAI.

Based on the formula above, we calculate the value k for this pool at the moment:

29 116.63 ∗ 76 737 921.22 ≈ 2.23 ∗ 10^12

k only changes when users add or withdraw liquidity, or when a commission is charged on trades (eg 0.3% in the case of Uniswap). These funds are added to the total liquidity in the pool.

Detailed example of interaction with the AMM pool:

  1. Staking 1 ETH and 100 DAI in a Uniswap pool.
  2. After that, the total liquidity in the pool is 10 ETH and 1000 DAI (liquidity provider’s share in the pool is 10%).
  3. During the week, trades are made in the pool for a total of 100 ETH (50% in ETH and 50% in DAI), but the price of ETH in relation to DAI does not change.
  4. During the week, liquidity is not added to the pool and is not withdrawn from it.
  5. The total liquidity in the pool is now 10.15 ETH and 1015 DAI, with 0.3 ETH accumulated fees.
  6. The share of the liquidity provider in the pool is still 10%, but the stake has grown thanks to the commission fee.
  7. If you withdraw funds after a week, there will be no intermittent losses, since the price ratio between ETH and DAI has remained the same.

Intermittent losses in classic pools

An example of the Uniswap DAI/ETH liquidity pool:

  1. We stake 1 ETH and 100 DAI, the share of the liquidity provider is 10%.
  2. There are 10 ETH and 1000 DAI in the pool.
  3. A week later, 1 ETH is trading for 200 DAI.
  4. There are no commission fees in the pool.
  5. We calculate non-permanent losses.

First, we count k:

k = 10 ∗ 1000 = 10,000

In relation to DAI, the global price of ETH has doubled. The arbitrageurs took the opportunity to buy him out of the pool cheaply. Due to increased demand with limited supply, the price of 1 ETH has reached 200 DAI.

At the beginning of the week, when 1 ETH was worth 100 DAI, there were 10 ETH and 1000 DAI in the pool. Let’s calculate the new allocation of assets in the pool after the price of ETH rises. To do this, you need to set several variables, starting with the ratio of prices between assets.

rt = price a to b,

where a and b are two assets in the pool.

In our example a — ETH, b — D.A.I. 1 ETH was initially traded for 100 DAI. Therefore, the original value r equals 100. Use tto indicate the time over which to calculate r.

By combining the equation above with the fundamental AMM formula, formulas can be constructed to calculate the amount of each asset in the pool at any given ratio r at an arbitrary point in time t:

What is Impermanent Loss?

Let’s apply these formulas to the starting position:

What is Impermanent Loss?

We get the initial state of the assets in the pool – 10 ETH and 1000 DAI. Now apply the same formulas at the end of the example where 1 ETH is trading for 200 DAI. New value r equals 200. Substitute it into the equations:

What is Impermanent Loss?

After the ETH price change, the pool contains about 7 ETH and about 1414 DAI. You can check the correctness of the calculations:

7.07 * 1414.21 ≈ 10,000

The constant product equation remains valid. The pool share is 10%, so after the ETH price change we are entitled to 0.707 ETH and 141.421 DAI.

If the assets (1 ETH and 100 DAI) were simply stored in the wallet, their value would be $300. However, the dollar-denominated value of the funds in the pool is:

0.707 * 200 + 141.421 = 282.821

Using this value, you can calculate the non-permanent losses from this example:

300 – 282.821 = 17.179

17.179/300 ≈ 0.0572 ≈ 5.72%

17,179 DAI or about 5.72% is what we would get by simply storing the assets instead of placing them in a pool. The profit from the initial position of 200 DAI is received, but it would be more profitable to just keep the coins in the wallet.

A simple formula for calculating non-permanent losses:

stakingUSD/storage USD – 1

Let’s apply the formula to our example:

282.821/300 -1 ≈ -0.0572 ≈ -5.72%

To determine the exact share in the pool (in each token), formulas (2) and (3) can be used, analytical platforms Uniswap Analytics And Sushi Swap Analytics or third party tools Croco Finance, Growing And API.vision.

Why should pool fees be considered?

The previous example excludes trading fees. While this makes it easier to calculate non-permanent losses, commissions should be taken into account. They are an integral part of the AMM-based platform economy.

The higher the commission, the lower the non-permanent loss. After reaching a certain amount of trading fees, participation in the pool brings more profit than holding assets.

Let’s take the example above and add a fee component:

  1. We stake 1 ETH and 100 DAI in the pool;
  2. The share of our stake is 10% (10 ETH and 1000 DAI in the pool);
  3. A week later, 1 ETH is trading for 200 DAI;
  4. Fees: 1 ETH and 100 DAI.

Excluding trading fees, the non-permanent loss is 17,179 DAI. Since the pool share is 10%, we are entitled to 0.1 ETH and 10 DAI from the accumulated fees. Since ETH is trading at 200 DAI, 0.1 ETH is worth 20 DAI and the total fee profit is 30 DAI. So the total is $312,821 ($282,821 + $30).

Let’s insert these new numbers into formula (4):

312.821/300 – 1 ≈ 0.042 ≈ 4.2%

In this example, the non-permanent loss is -12,821 DAI (17,179 – 30). By holding assets in a pool instead of holding, this is not a loss but a 4.2% gain.

What is the formula for constructing a graph of non-permanent losses?

So far, a simple formula (4) has been used to calculate non-permanent losses. It is suitable for measuring the current IL, but inconvenient if you need to get different values ​​of non-permanent losses for different prices.

From formulas (1), (2) and (3) one more can be derived for ease of calculation of non-permanent losses:

What is Impermanent Loss?

Let’s apply this formula to our example. We know that the initial r equals 100 (1 ETH is traded for 100 DAI), and the final r equals 200. Therefore, p equals 0.5 (100/200). We use these values:

What is Impermanent Loss?

It is this number that we obtained by formula (4). Using this formula with different meanings p allows you to display IL indicators for different price changes.

This formula does not take into account trading fees. If you want to chart trading fees, the formula would be:

What is Impermanent Loss?

You can calculate fees based on data APYthat some AMM platforms provide.

The chart below illustrates non-permanent losses with various price changes. For example, a fivefold change in value entails an IL of 25.5%, a twofold change of 5.7%.

What is Impermanent Loss?
Data: finematics.

Does the mechanism of non-permanent losses work in other pools?

curve is a decentralized exchange of stablecoins and tokenized bitcoins based on the automatic market maker mechanism. Its pools contain only assets that must have the same or comparable value: stablecoins (USDC, DAI) or tokenized bitcoins (renBTC, wBTC). The risk of intermittent losses in such pools is minimal.

Balancer offers pools with arbitrary token ratios. For example, if a liquidity provider wants to supply a large number of certain tokens, he can choose a pool in which these coins have more weight than others (proportions can be 80/20 or even 98/2). This model also minimizes intermittent loss. The larger the share of the token in the pool, the smaller the difference in outcomes between holding the token and providing liquidity in that token.

Pools of the second version of Bancor automatically change the share of tokens based on data provided by price oracles. Thanks to this, even in pools with volatile assets, it is possible to minimize intermittent losses.

How easy is it to calculate non-permanent losses?

Understanding non-permanent losses is essential for any user of AMM platforms. You can make your own IL calculations using calculator on dailydefi.org (based on Uniswap formulas).

In general, users of the AMM protocol are always at risk cost of lost profitregardless of price movements. Compared to holding, if asset prices rise, the participant’s position grows at a slower rate; if prices go down, he loses more.

Trading commissions and profitable farming come to the rescue – they help neutralize intermittent losses so that participation in the AMM pool brings more profit than simply holding assets.

Subscribe to CryptoNewsHerald on social networks

Found a mistake in the text? Select it and press CTRL+ENTER

CryptoNewsHerald Newsletters: Keep your finger on the pulse of the bitcoin industry!


In conclusion, impermanent loss is an important concept to understand when dealing with cryptocurrency investments. It occurs when a trader’s position moves against them, but the loss is only temporary if the trader takes action to close their position before the market moves back in their favor. Understanding impermanent loss and how it can affect your investments can help you minimize potential losses and maximize potential profits.


What is Impermanent Loss?


Impermanent loss is a type of loss that can occur when using decentralized finance protocols. It occurs when a user swaps one asset for another and the price of one of the assets changes during the transaction, resulting in a lower amount of the swapped asset than expected. This is because the two assets are not pegged to each other and their values can change independently.

Comments (No)

Leave a Reply