The cryptocurrency industry offers various ways to generate passive income. You can earn money by staking your tokens, locking them in liquidity pools for yield farming, and more. While making money with cryptocurrencies can be relatively straightforward, risks are always present.
One of the most common risks in the decentralized finance (DeFi) sector is impermanent loss. This article explains what impermanent loss is, how to avoid it, provides examples, and shows you the formula for calculating it.
What is Impermanent Loss in Crypto?
Impermanent loss is a temporary loss of value in tokens invested in staking or provided to a liquidity pool. Liquidity pools are essential components of many decentralized finance protocols. They are crucial for automated market maker (AMM) platforms, which are the backbone of the DeFi sector. Popular platforms like Sushiswap, Uniswap, Balancer, and others use AMMs.
Image source: Web3 Portal For Everyone
Investors who lock tokens in a smart contract are called liquidity providers (LPs). During the locking period, their tokens are used on DeFi protocols for trading. The locked tokens are not accessible to the liquidity providers. Modern decentralized crypto exchanges (DEXs) obtain liquidity from AMMs. This allows traders to execute transactions quickly at a predictable and preferred price.
When the locking period ends, the value of the investor’s tokens can fluctuate significantly due to market volatility. As traders swap tokens in the liquidity pool, the balance of these tokens changes. This creates a risk that the token value will decrease so drastically that even with rewards, the total value of the tokens will be lower than before the locking period began.
How Does It Work?
There are several factors that influence the tokens’ value and can lead to an impermanent loss.
Market volatility
Cryptocurrency markets are known for their volatility. We’ve already discussed how volatility can contribute to impermanent loss. If the price of a token drops during the locking period, investors may end up with less than they initially invested, even though the number of tokens can get higher.
Image source: Investopedia
Several factors can cause a cryptocurrency’s price to drop. Many tokens react to Bitcoin’s price movements, decreasing in value when Bitcoin’s price falls. Tokens can also lose value if the development team fails to meet its roadmap goals or if the product’s quality doesn’t meet community expectations. Other reasons for price drops include security breaches, poor public relations, or failure to compete effectively in the market.
AMM pricing algorithms
AMM pricing algorithms typically work to maintain an equal USD value of the assets within a liquidity pool. For example, if an ETH/BNB pool has a total locked value (TVL) of $5,000, it will hold $2,500 worth of ETH coins and an amount of BNB worth $2,500.
To maintain this value parity, the AMM pricing algorithm automatically adjusts the prices of the cryptocurrencies in the pool. The price of an asset in the pool may be significantly higher or lower than its current market price. These discrepancies make the assets on DeFi platforms attractive to arbitrage traders who buy undervalued tokens and replace them with the paired asset.
Redemption of an LP token
As mentioned previously, liquidity providers cannot access the tokens they lock in smart contracts. However, if they want to withdraw their cryptocurrencies, the LP tokens are “burnt.” These LP tokens don’t represent the same amount of tokens the investor initially provided. Instead, they represent the investor’s percentage share of the funds in the pool.
This means that the amount of locked tokens in the pool can change, and the investor will withdraw less than they initially invested. The amount of tokens received back is influenced by the individual percentage share of value in the pool, the prices of the tokens locked in the pool, and the total pool value.
These three mechanisms create the risk of impermanent loss. Potential investors should be aware of these risks and make informed decisions. If the prices move favorably for an investor, impermanent loss may not occur.
An Example of Impermanent Loss
Let’s consider an example to illustrate how impermanent loss can occur in crypto. Imagine Daniel wants to provide liquidity to a Chainlink (LINK)/Tether (USDT) pool. He needs to provide amounts of crypto so that the tokens in the pool have an equal value in USD.
At the time of his deposit, the LINK price is $20. Daniel deposits 100 LINK ($2,000) and 2,000 USDT ($2,000) into the LINK/USDT liquidity pool.
The total value of the pool is 10,000 LINK and 200,000 USDT. Daniel’s share represents 1% of the total value of the pool. Now, let’s say the LINK price increases to $40. This means the LINK/USDT ratio has doubled.
Arbitrage traders begin adding USDT to the pool, taking advantage of the lower LINK price ($20 per unit). This action changes the balance within the pool, and the amount of LINK tokens gets closer in value to the remaining amount of USDT tokens.
The pool now contains 9,438 LINK tokens and 377,520 USDT tokens (these amounts are equal in USD value). If Daniel decides to withdraw his tokens (1% of the total pool value), he will lose approximately 5.7% of his initial investment (over $200).
However, Daniel will also receive a reward in the form of fees from traders who used the LINK/USDT pool. These fees may offset some of the losses, but it’s not guaranteed.
How to Calculate Impermanent Loss?
You can calculate impermanent loss using a dedicated calculator or the formula below.
The formula requires several metrics:
- The initial balance of tokens (your deposit)
- The final balance (your withdrawal)
- The platform’s prices for tokens in the pool
Here’s how to calculate impermanent loss:
1. Calculate the initial total value of your tokens:
- Multiply the quantity of token 1 by its price on the platform.
- Do the same for token 2.
- Sum up these values.
- TV1 (total value of token 1) = initial price of token 1 x quantity you deposit
- TV2 (total value of token 2) = initial price of token 2 x quantity you deposit
- TV1 + TV2 = TVd (total value of your deposit)
2. Calculate the final total value of your tokens:
Repeat the process from step 1, but use the final balance instead of the initial balance. To get the final balance, request a withdrawal on your DeFi platform and choose the 100% rate. You’ll see how much you can withdraw.
TV1 + TV2 = TVf (total value of your final balance)
3. Calculate the discrepancy between the final and initial total values:
TVf – TVd = discrepancy
4. Calculate the total loss or gain:
Add the discrepancy to the rewards (fees) received. If the result is negative, this represents the potential impermanent loss.
Image source: Reddit
A negative result means that holding your tokens in a wallet instead of locking them in a liquidity pool might have been more beneficial.
How to Avoid Impermanent Loss?
Happily, there are certain ways to avoid impermanent loss.
Use tokens with low volatility: To reduce the risk of impermanent loss, consider using stablecoins or pairs of equivalent tokens, such as Ether (ETH) and Wrapped Ether (WETH). Such tokens maintain a relatively stable value, minimizing the potential for significant price fluctuations.
Use large pools: Smaller liquidity pools tend to experience higher volatility than larger ones. Opting for larger pools can help smooth out price swings, reducing the risk of impermanent loss.
Use the asymmetrical ratio: Some platforms, like Balancer, allow users to choose asymmetrical ratios for their deposits. This means you can deposit a smaller percentage of a more volatile asset, reducing the potential impact of its price fluctuations.
Set a trading range: Certain platforms, such as Uniswap, enable users to set trading ranges for their deposited tokens. This helps to moderate the effect of trades on the overall pool balance, minimizing the risk of impermanent loss.
Be patient: If you are facing impermanent loss and need to withdraw your locked tokens, consider waiting for a more favorable market situation. Allowing the market to stabilize can reduce the extent of potential losses.
Conclusion
Impermanent loss is a potential risk when providing liquidity to AMM protocols. While market volatility and AMM pricing algorithms can contribute to this risk, there are strategies to minimize its impact. By understanding these strategies and making informed decisions, you can increase your chances of maximizing your gains and reducing potential losses in the DeFi space.