This page is for information purposes only. Certain services and features may not be available in your jurisdiction.

What Is Impermanent Loss and How to avoid it.

Impermanent loss is a risk that can occur when providing liquidity to a decentralized finance (DeFi) market-making (MM) protocol, also known as an automated market maker (AMM). It is called “impermanent” because it is not a permanent loss of capital, but rather a temporary loss that can be recovered if the liquidity provider continues to hold their position.

In DeFi, AMMs are used to facilitate trades between buyers and sellers by providing a pool of liquidity that can be drawn upon to fill orders. Liquidity providers (LPs) can earn a portion of the trading fees generated by the AMM in exchange for providing this liquidity. This process is known as liquidity mining. However, there is a risk associated with liquidity mining due to the volatility of cryptocurrency prices. If the price of the asset in the AMM’s liquidity pool fluctuates significantly, the value of the LPs’ assets may diverge from their initial value, resulting in an impermanent loss.

This article will explain what impermanent loss is and how to avoid it. To understand impermanent loss, however, we need to understand how liquidity pools in AMM protocols work.

How AMM Liquidity Pools Work

In order for users of an AMM-powered protocol to swap tokens, there need to be pools of liquidity available to them. For example, if a trader wants to sell 1 ETH for USDT, there needs to be a liquidity pool that can take the 1 ETH and give 1,000 USDT (and, for simplicity’s sake, let’s say 1 ETH is trading for 1,000 USDT, and we don’t consider fees) and vice versa. 

As trading volumes surge, so does the need for such liquidity, and that is where those who are looking to be LPs come in. These users can deposit the two digital currencies of a pair — in this case, ETH and USDT— to the protocol’s relevant pool(s) in a predetermined ratio, which is often 50/50.

For example, if an LP with 10 ETH wishes to add liquidity to an ETH/USDT pool with a 50/50 ratio, they will need to deposit 10 ETH and 10,000 USDT (still assuming 1 ETH = 1,000 USDT). If the pool they commit to has a total of 100,000 USDT worth of assets (50 ETH and 50,000 USDT), their share will be equal to 20,000 USDT / 100,000 USDT x 100 = 20%.

The percentage of the LP’s share in a given pool is important to note because when the LP commits or deposits their assets to the pool via a smart contract, they will automatically be issued LP tokens. These tokens entitle the LP to withdraw their share of the pool at any time — 20% of the pool in our above example. 

This is where the concept of impermanent loss comes into play. Since LPs are entitled to their share of the pool and not a specific number of tokens, they are exposed to another layer of risk — impermanent loss — if the price of their deposited assets grows significantly.

What Is Impermanent Loss?

Impermanent Loss, or IL, is a measure of the average loss of asset value over time. It’s an important concept in DeFi because it allows investors to take into account both short-term volatility and long-term decay when making investment decisions.

Impermanence is a key feature of decentralized finance applications. A DeFi protocol is designed to ensure that no one can control the value of an asset — not even the issuer. IL is the average loss of value for a given asset over time, and it can help investors decide whether or not to invest in certain assets.

Impermanent Loss is calculated using historic market data from multiple exchanges. This allows us to compare different assets against each other, which is useful when choosing which one to invest in. 

How Does Impermanent Loss Occur?

Impermanent loss can occur when trading on decentralized finance (DeFi) platforms that use automated market makers (AMMs) to facilitate trades. AMMs use algorithms to set the prices of assets and maintain liquidity in the market by holding a balance of the assets being traded. When a trader executes a trade on an AMM, the platform adjusts the balance of the assets in its liquidity pool to match the trade.

If the price of the asset changes significantly between the time the trade is executed and the time it is settled, it can result in a loss for the trader even if the trade was otherwise successful. This is because the value of the assets in the AMM’s liquidity pool will have changed due to the price change, leading to a mismatch between the value of the assets being traded and the value of the liquidity provided by the AMM.

For example, if a trader buys an asset using an AMM and the price of the asset increases significantly before the trade is settled, the trader may make a profit on the trade but also experience an impermanent loss. This is because the value of the asset in the AMM’s liquidity pool has increased, leading to a decrease in the value of the liquidity provided by the AMM. The trader’s profit from the trade may not be enough to offset this loss, resulting in an overall loss for the trader.

On the other hand, if the price of the asset decreases significantly before the trade is settled, the trader may experience an impermanent gain. This is because the value of the asset in the AMM’s liquidity pool has decreased, leading to an increase in the value of the liquidity provided by the AMM. In this case, the trader’s loss from the trade may be offset by impermanent gain, resulting in an overall profit for the trader.

It is important to note that impermanent loss is only a temporary phenomenon and can be recovered if the price of the asset returns to its original level. However, if the price of the asset does not return to its original level, impermanent loss may become a permanent loss.

Calculating Impermanent Loss

In our example, the price of 1 ETH was 1,000 USDT at the time, but let’s say the price doubles, and 1 ETH starts trading for 2,000 USDT. Since the pool is adjusted algorithmically, it uses a formula to manage assets. The most basic and widely used formula is the constant product formula, which is popularized by the DEX platform Uniswap.

In simple terms, the formula is as follows: ETH liquidity x token liquidity = constant product

Using figures from our example above (50 ETH and 50,000 USDT) gets us: 50 x 50,000 = 2,500,000

Similarly, the price of ETH in the pool can be obtained with this formula: token liquidity / ETH liquidity = ETH price 

Applying our example figures gets us: 50,000 / 50 = 1,000 USDT (i.e., the price of 1 ETH).

Now, when the price of ETH changes to 2,000 USDT, we can use these formulas to ascertain the ratio of ETH and USDT held in the pool:

  • ETH liquidity = square root (constant product / ETH price)
  • Token liquidity = square root (constant product x ETH price)

Applying data from our example here, along with the new price of 2,000 USDT per ETH, gets us:

  • ETH liquidity = square root (2,500,000 / 2,000) = ~35.355 ETH
  • Token liquidity = square root (2,500,000 x 2,000) = ~70,710.6 USDT

We can confirm this accuracy by using the first equation (ETH liquidity x token liquidity = constant product) to arrive at the same constant product of 2,500,000: 35.355 x 70,710.6 = ~2,500,000 (i.e., the same as our original constant product above).

Hence, assuming all other factors remain constant after the price change, the pool will have roughly 35 ETH and 70,710 USDT, compared to the original 50 ETH and 50,000 USDT. 

If, at this time, the LP wishes to withdraw their assets from the pool, they will exchange their LP tokens for the 20% share they own. Taking their share from the updated amounts of each asset in the pool, they will get 7 ETH (i.e., 20% of 35 ETH) and 14,142 USDT (i.e., 20% of 70,710 USDT).

Now, the total value of the assets withdrawn equals: (7 ETH x 2,000 USDT) + 14,142 USDT = 28,124 USDT.

However, had the user simply held their 10 ETH and 10,000 USDT, they would have gained more instead of depositing these assets into a DeFi protocol. Assuming ETH doubled in price from 1,000 USDT to 2,000 USDT, the user’s non-deposited assets would have been valued at 30,000 USDT: (10 ETH x 2,000 USDT) + 10,000 USDT = 30,000 USDT.

That difference of 1,876 USDT— which can occur because of the way AMM platforms manage asset ratios — is what is known as impermanent loss.

How To Avoid Impermanent Loss?

There are several ways to avoid or minimize the risk of impermanent loss when trading on decentralized finance (DeFi) platforms that use automated market makers (AMMs):

Use Stop Loss Orders

A stop loss order is an order to sell an asset at a certain price to limit potential losses. By setting a stop loss order at a certain percentage below your entry price, you can minimize the risk of experiencing an impermanent loss due to a significant price change.

Use AMMs With Low Slippage

Slippage is the difference between the expected price of a trade and the actual price at which the trade is executed. AMMs with low slippage is less likely to experience significant price changes between when a trade is executed and when it is settled, reducing the risk of impermanent loss.

Monitor the Market and Adjust Your Strategy Accordingly

Keeping an eye on market conditions and adjusting your trading strategy as needed can help reduce the risk of experiencing an impermanent loss. For example, if you expect a significant price change in the near future, you may want to adjust your trading strategy to minimize the risk of impermanent loss.

Use a Risk Management Tool

Various tools can help you manage and minimize the risk of impermanent loss. For example, some DeFi platforms offer risk management tools that allow you to set limits on your trades or automatically adjust your positions to minimize the risk of loss.

It is important to note that while these strategies can help reduce the risk of impermanent loss, they do not guarantee that you will not experience a loss. Trading on DeFi platforms carries inherent risks, and it is important to thoroughly understand these risks and carefully consider whether DeFi trading is right for you.

Impermanent Loss Is Not Permanent

In our example, the LP stands to lose nearly 2,000 USDT in the process of providing liquidity to a DeFi protocol. Though this process is called impermanent loss, the term is slightly misleading. The meaning of impermanent loss is actually very similar to the concept of unrealized loss. The loss could reverse in theory (if the LP doesn’t withdraw their assets and the ETH price returns to original levels), but there is no guarantee of that happening.

Moreover, once an LP withdraws liquidity from a protocol, impermanent loss indeed becomes permanent. In a case where an LP experiences impermanent loss and then withdraws their assets, the only upside to having provided liquidity to the protocols remains the trading fees that the LP collected while their assets were deposited there. In volatile conditions, however, the fees alone are unlikely to cover the difference, especially during a bull run.

On the flip side, however, a reduction in the price of ETH from the time it was deposited in the pool would yield additional ETH, thereby increasing the liquidity provider’s ETH holding. Given how impermanent loss works, providing liquidity during a bear market and simply holding volatile assets during a bull market are both strategies that merit consideration.

If you’re interested in using a decentralized exchange or providing liquidity, you can start by exploring OKX Swap and Farm DApps on OKC.

Not ready to get into DeFi? Start by learning how crypto trading works and get started trading on OKX — new users can earn rewards for buying, depositing, and trading crypto.


FAQs

How Do I Stop Impermanent Loss?

There are several strategies that can help minimize the risk of impermanent loss when trading on decentralized finance (DeFi) platforms that use automated market makers (AMMs). These strategies include using stop loss orders, using AMMs with low slippage, monitoring the market, and using risk management tools. However, it is important to note that these strategies do not guarantee that you will not experience a loss, and DeFi trading carries inherent risks that should be carefully considered.

Is Impermanent Loss Risky?

Impermanent loss is a risk that can occur when trading on DeFi platforms that use AMMs. It is caused by the difference in price between the time a trade is executed and the time it is settled, and can result in a loss for the trader even if the trade was otherwise successful. While there are strategies that can help minimize the risk of impermanent loss, it is important to understand that DeFi trading carries inherent risks and to consider whether it is right for you carefully.

Is Impermanent Loss Forever?

Impermanent loss is not a permanent loss. Instead, it is a temporary phenomenon that can occur when trading on DeFi platforms that use AMMs and is caused by the difference in price between the time a trade is executed and the time it is settled. If the price of the asset returns to its original level, impermanent loss can potentially be recovered. However, if the price of the asset does not return to its original level, impermanent loss may become a permanent loss.

Why Is It Called Impermanent Loss?

Impermanent loss is called impermanent because it is a temporary phenomenon that can potentially be recovered if the price of the asset returns to its original level. It is not a permanent loss, which is a loss that cannot be recovered.

Can You Make Money From Impermanent Loss?

It is possible to make money from impermanent loss, but it is not guaranteed. If the price of the asset returns to its original level, impermanent loss can potentially be recovered. However, if the price of the asset does not return to its original level, impermanent loss may become a permanent loss. In addition, there are other risks associated with DeFi trading that should be carefully considered.

Is Impermanent Loss Worth It?

Whether or not impermanent loss is worth it depends on your individual circumstances and risk tolerance. DeFi trading carries inherent risks, including the risk of impermanent loss. Therefore, it is important to understand these risks thoroughly and to carefully consider whether DeFi trading is right for you.

Disclaimer
This content is provided for informational purposes only and may cover products that are not available in your region. It is not intended to provide (i) investment advice or an investment recommendation; (ii) an offer or solicitation to buy, sell, or hold digital assets, or (iii) financial, accounting, legal, or tax advice. Digital asset holdings, including stablecoins and NFTs, involve a high degree of risk and can fluctuate greatly. You should carefully consider whether trading or holding digital assets is suitable for you in light of your financial condition. Please consult your legal/tax/investment professional for questions about your specific circumstances. Information (including market data and statistical information, if any) appearing in this post is for general information purposes only. While all reasonable care has been taken in preparing this data and graphs, no responsibility or liability is accepted for any errors of fact or omission expressed herein. Both OKX Web3 Wallet and OKX NFT Marketplace are subject to separate terms of service at www.okx.com.
© 2024 OKX. This article may be reproduced or distributed in its entirety, or excerpts of 100 words or less of this article may be used, provided such use is non-commercial. Any reproduction or distribution of the entire article must also prominently state: “This article is © 2024 OKX and is used with permission.” Permitted excerpts must cite to the name of the article and include attribution, for example “Article Name, [author name if applicable], © 2024 OKX.” No derivative works or other uses of this article are permitted.
Expand
Related articles
View more
View more