DeFi yield-generating opportunities, such as liquidity mining, have several inherent risks, one of which is impermanent loss.
Impermanent loss in crypto is similar to opportunity cost in stocks. A stock’s price may go below its average price, and those holding it might find their portfolio in loss.
But with time, there’s a possibility that the prices may recover, erasing the losses. Unless the trader sells off their stocks, the loss is only on paper.
Similarly, in DeFi, when a liquidity provider (LP) deposits crypto tokens in a liquidity pool, the change in prices thereafter may result in impermanent loss. Unless the LP removes the liquidity, i.e., withdraws his tokens from the liquidity pool, the loss remains ‘impermanent.’
Become a part of the community
Subscribe to our newsletter to be in-loop with all news from the crypto world
Impermanent loss occurs when the value of tokens in the pool is less than their value on any external platform, whether a CEX or your wallet. Impermanent loss is native to AMM (Automated Market Makers) protocols like UniSwap and Balancer.
Impermanent loss is a much more complex concept than opportunity cost. DeFi investors and liquidity providers must understand how an impermanent loss happens to be able to tread with caution while engaging in liquidity mining and yield farming activities.
In this article, we will try to understand how impermanent loss works with real-world examples, its mechanics, and strategies to tackle impermanent loss in DeFi.
What is Impermanent Loss in DeFi?
Definition and Overview
Impermanent loss (IL) is a temporary loss of funds that occurs when an LP provides liquidity to a decentralised exchange (DEX) or a DeFi protocol.
Liquidity pools are fundamental units of almost all DeFi protocols. It is because of these pools that traders are able to swap cryptocurrencies for another crypto without the need for an order book or central authority overlooking the swap.
Learn more about decentralised finance in this article by NFT.EU.
Impermanent loss refers to a temporary loss in the value of the token pairs deposited by an LP in the liquidity pool. It is the opportunity cost of adding liquidity to a liquidity pool vs holding tokens in a wallet.
Simply put,
Impermanent Loss = Value of tokens when held outright - Current value of your liquidity pool investment
It is to be noted here that impermanent loss is unrealised and can be offset (fully or partially, depending upon the magnitude of loss) by the transaction fees earned to provide liquidity. Your assets may reflect an impermanent loss even when you have an unrealised profit, given the way it is calculated.
Watch this video by Whiteboard Crypto to understand how impermanent loss works.
Many DeFi protocols today take several measures to reduce/eliminate liquidity pool risks. We will discuss those in a later section.
Why Does Impermanent Loss Happen?
LPs can contribute liquidity to a liquidity pool in token pairs. Suppose a UniSwap V3 pool invites token pairs of ETH and DAI in a 50:50 ratio. LPs must provide funds to a standard liquidity pool in this correct ratio at all times.
Most of the time, one asset in the ratio is more volatile than the other. In this case, ETH will be more volatile than DAI, which is a stablecoin. This price volatility in DeFi is a major arbitrage opportunity that traders take advantage of to earn profits. To do so, they start buying one token against the other in the token pair, disturbing the pool ratio.
At this time, an automated market maker (AMM) adjusts the price of the token pair based on demand and supply. As traders swap tokens, the number of tokens changes, too. Soon, the token pair’s number and price within the pool reflect the correct ratio but adjusted values.
That’s when an impermanent loss occurs. It is a loss on paper, but if the LP decides to withdraw its funds, the loss becomes ‘permanent.’
The Role of Liquidity Pools and AMMs
How Liquidity Pools Work in DeFi
Liquidity pools are essentially smart contracts that allow traders to trade coins and tokens even if there are no sellers.
Centralised exchanges or stock exchanges use what we know as order books to match buyers and sellers. However, in DEXs or DeFi liquidity solutions, no central body or order book governs the trades. Instead, we have liquidity pools where liquidity providers pool assets, and buyers and sellers can buy from and sell into that pool.
When traders provide liquidity to these pools to earn yields, it is called DeFi yield farming or liquidity mining.
Liquidity pools use algorithms to determine the prices of the token pairs within. These algorithms, called AMMs, allow trades to happen at all prices and quantities at all times without intermediation or nudging. A liquidity pool generally contains two tokens in a set ratio. The standard pools have a 50:50 ratio for LP tokens, but this ratio can vary depending on the affinity of the token pair to react to market volatility.
Read this guide by Tasty Crypto to understand how liquidity Pools work.
Example: Taking the previous example, suppose an LP provides equal values for both ETH and DAI to a DAI/ETH UniSwap pool. The composition of the deposit looks something like this:
$1 worth of 10,000 DAI and $500 worth of ETH. On an external exchange, say Binance, the ETH price rises to $550. As explained, an arbitrage opportunity arrives here.
As traders jump in to profit from the price difference, more ETH starts leaving the pool. It’s time for AMMs to kick in. Let’s first understand how they work.
Automated Market Makers (AMM) and Impermanent Loss
Automated market makers allow traders to buy and sell coins via liquidity pools using a certain algorithm. The algorithm dictates how expensive an asset is based on the amount of assets available at that time. AMMs work on the simple principle of demand and supply, except that instead of a human, the algorithm sets the prices based on that.
Liquidity providers contribute funds to liquidity pools in a fixed ratio of tokens. Any change in the price of one token creates an arbitrage opportunity for traders who jump in. The traders buy from the platform where the token is priced lower and sell where it is priced higher to profit from the price differential.
When traders start buying one token from an AMM protocol against the other, the disequilibrium in the ratio prompts the AMM algorithm to start adjusting the prices until the equilibrium is restored.
The AMMs always keep the token pairs in a 50:50 ratio, whatever the price. The token being purchased decreases in quantity and its price increases. Conversely, the supply of the other token being used to purchase the first token increases, causing its price to dip. AMM’s algorithm keeps adjusting the price of the tokens based on their demand and supply until equilibrium is restored once again (the standard token ratio is achieved).
Example: Continuing the previous example, UniSwap uses an AMM known as a constant product automatic market maker to correct the prices of LP tokens. Traders start buying cheaper ETH on UniSwap and selling it on Binance. As the ETH supply reduces, its prices go higher. This continues until there’s no more price difference left between UniSwap and Binance.
Using UniSwap AMM’s constant product formula, we arrive at a point where ETH’s price will be $550 on UniSwap. The position looks something like this:
After the arbitrage opportunity concludes, the pool would have 10,488.09 DAI for 19.07 ETH. The average price per ETH is now 524.83 DAI. On any external venue, 1 ETH would sell for $550 now.
If the LP had just helped their assets, they would have $23.41 more ($21,000 - $20,976.59).
This $23.41 is actually the impermanent loss, realised if the LP decides to remove liquidity or reverse if prices are restored to their original.
If storytelling appeals to you, here’s a video by Whiteboard Crypto explaining AMMs in the simplest way possible.
Real-World Examples of Impermanent Loss
The screenshot here shows that the initial deposit in the UniSwap pool for a WETH/MATIC pair was $119.52, while the current pool value is $126.04. At face value, the LP seems to be in profit.
Let’s repeat what we said earlier.
Your assets may reflect an impermanent loss even when you have an unrealised profit, given the way it is calculated.
How To Calculate Impermanent Loss
Simple Formula
Let’s dig into impermanent loss calculation now.
To calculate impermanent loss, we compare the values of the number of deposited tokens. Please note that this position earned $0.06 in swap fees, which will partially offset the impermanent loss.
Here’s a table for your reference. Let’s begin the calculations now.
Step 1: Subtract the initial deposit exchange value from the ending balance exchange value.
Total value of starting deposit = MATIC + WETH
= 63.10+62.77
= $125.87
Total value of ending balance = MATIC + WETH
= 62.42+63.44
= $125.86
Impermanent loss = Total value of starting deposit - Total value of ending balance
= $125.87-$125.86
= $0.01
$0.01 is a small amount that can be offset by the swap fees earned. If the LP decides to remove its liquidity in full, it will still be left with $0.02 in profits.
Tools for Calculating Impermanent Loss
Here are a few useful links for IL calculators that can come in handy for you:
This is just one real-world example. Impermanent loss can be much higher than this. Liquidity pools like UniSwap display only the pool prices, which do not factor into the actual prices in the outside world.
What should matter to the LPs here is the quantity of tokens they can withdraw and their worth on exchanges. These documents from Balancer present some real-world case scenarios of how impermanent loss may impact your profit-taking.
It is always prudent to weigh the risk of impermanent loss against the fees earned for providing liquidity to a pool. Liquidity providers can also earn by engaging in liquidity farming.
Factors Influencing Impermanent Loss
Token Price Volatility
Volatility in crypto markets is one of the major drivers of impermanent loss in liquidity provision. High volatility is directly proportional to high chances of an impermanent loss, as the value of the tokens within the pool can fluctuate wildly.
To mitigate IL risks, LPs should consider the historical price movement of the token pair, the overall market condition, and the subsequent volatility the tokens can experience.
Liquidity Pool Composition
Do you know impermanent loss occurs mostly in pools with a 50:50 composition or in pools where the tokens have equal exposure and have the possibility to diverge wildly?
For instance, in the previous example of the ETH/DAI UniSwap pool, even a small change in ETH value can cause a large IL. A 500% increase in price against the trading pair can result in a 25% loss of liquidity (IL) for the LP.
Therefore, pairs with high correlation or least divergence work best. For instance, a stablecoin liquidity pool made up of DAI and USDC would experience lower levels of IL.
Time Factor in Liquidity Pools
Time is an important consideration in liquidity pool performance. Impermanent loss is a temporary loss until realised and can become zero with time. While calculating the potential of recovering the IL, take note of the duration for which the assets were locked in an AMM pool. Your yield farming strategy should consider a time element to be successful.
How to Mitigate or Avoid Impermanent Loss?
Use Stablecoin Pools
Yield optimisation can be maximum when the AMM pool has two stablecoins. This is because stablecoins have the least divergence and price fluctuations. When price volatility is minimal, arbitrage opportunities won’t arise, and the price differential won’t result in any impermanent loss.
We found this interesting article by De.Fi on strategies to mitigate impermanent loss. Don’t miss the list of extensive guides at the end!
Diversify Liquidity Pools
Besides stablecoin pools, many AMM protocols also provision liquidity pools with the least divergent token pairs in different ratios. For instance, Balancer provides liquidity pools in a 98/2 or 80/20 ratio.
The pool composition strategy involves reducing the LP’s exposure to the more volatile token. Diversifying across multiple pools can also help spread the risk and reduce your combined losses.
Bankless breaks down the different liquidity pools that LPs can contribute to while avoiding IL risks. Here’s the piece that deserves a thorough read.
Consider Impermanent Loss Insurance
Impermanent Loss Protection (ILP) protects your assets against unexpected losses when you provide liquidity to a pool. LPs should on make liquidity provisions for only those funds where the yields (transaction fees and governance tokens as rewards) are greater than the impermanent loss.
Bancor is one of the few platforms providing IL insurance to its liquidity providers. For that, Bancor takes 15% of your earned fees to fund an insurance pool that guarantees you atleast the original amount when you withdraw liquidity.
This article by TokenMinds can be really helpful in understanding the benefits and risks associated with DeFi insurance.
Timing and Market Trends
Market fluctuations are normal in a volatile market like cryptocurrencies. LPs must be prudent enough to withdraw their liquidity before the price diverges too much from the original deposited amount. You can easily invest in LPs with higher trading fees to help offset IL.
DeFi investment risks can be greatly avoided if traders time their entry and exit, monitor market trends and movements, and adapt strategies accordingly.
Popular DeFi Platforms and Their Approaches
Uniswap
UniSwap allows LPs to provide liquidity across many concentrated ranges in a pool to reduce the impact of impermanent loss. UniSwap also has the provision of Hedging against IL, where LPs can purchase the Hedge against the IL and the liquidity pool for underwriters and buyers acts as the counterparty. Read more about the provision here.
Balancer
Balancer takes a flexible approach to pool management and is known for its infinite extendability. You can conceive any pool type with custom logic and parameters. Its predefined pools include boosted stable pools. Balancer uses weighted pools that help offset the impact of impermanent loss for LPs. Read more about the Balancer pool composition here.
Curve Finance
Curve pools have an internal oracle that helps concentrate liquidity around the current market price. Conversely, the algorithm tackles the effects of impermanent loss and tries to reduce it by calculating the pool's fees and ensuring the pool is in profit before re-pegging. However, impermanent loss may still occur. You may read the complete details in these documents.
Conclusion
As an LP participating in a pool, remember to check the protocol's security audits, the token's functionality, team credibility, community feedback, and other relevant factors and make informed decisions. Do your own research, look for less volatile pools, insure your investments, and secure the most optimised passive income in DeFi!
Enjoyed reading this article? Hop on to NFT.EU to read more such articles on blockchain, DeFi, and cryptocurrency.
Discover. Learn. Profit
Subscribe to our newsletter to be in-loop with all news from the crypto world
FAQs
How does impermanent loss occur?
Impermanent loss occurs when a DeFi user contributes tokens to a liquidity pool on a DEX, and the price volatility causes the value of the LP tokens to drop compared to those kept in a wallet. Impermanent loss is the opportunity cost of providing liquidity or holding assets.
What’s the difference between impermanent loss and permanent loss?
Impermanent loss isn’t a realised loss. It reflects in the balances and can be reversed if the token prices go back to normal. However, a permanent loss is a realised loss. Impermanent loss occurs as a result of price fluctuations during liquidity provision, but permanent loss may occur for several reasons, including a rug pull, smart contract vulnerabilities, etc.
Are there tools to calculate impermanent loss?
Yes, there are several calculators available to calculate impermanent loss. Some of them include:
Is impermanent loss unique to certain DeFi platforms?
Impermanent loss is native to AMM protocols. Wherever liquidity pools have token pairs, there will always be some risk of IL. The platforms can take steps to mitigate or eliminate IL, and the LPs can insure their LP tokens against impermanent loss.
What DeFi platforms offer insurance against impermanent loss?
Nadcad Labs, Nexus Mutual, InsurAce, UnoRe, Unslashed Finance, Chainlink, and Risk Harbor are DeFi platforms that provide insurance against impermanent loss and other DeFi risks. Other yield farming platforms, such as Bancor, have built-in insurance mechanisms to protect LPs against IL.
Why is impermanent loss important to understand for DeFi investors?
Liquidity providers contribute liquidity to AMM pools in the hope of earning profits. However, if the pool has a widely diverging token pair, the impermanent loss may far exceed the yields, pushing down the asset value help in a pool.