Impermanent loss- what is it?
Impermanent Loss (IL) is a risk faced by Liquidity Providers when they provide their assets to a liquidity pool.
It represents the potential disparity in gains compared to simply holding the assets. The extent of impermanent loss exposure depends on the magnitude of price changes in the pool.
Photo from Unsplash
The concept of impermanent loss becomes relevant when the assets’ prices fluctuate, causing a difference in value between being a liquidity provider and holding the assets outside the pool. If the asset prices return to their original levels, the impermanent loss can be reversed.
However, if the funds are withdrawn from the liquidity pool before the assets’ prices return to their original levels, the impermanent loss becomes permanent. Therefore, the timing of withdrawal significantly impacts whether the impermanent loss is realized or not.
While assets are staked in a liquidity pool, the Liquidity Providers earn fees from individuals who exchange their assets within the pool.
How to calculate the Impermanent Loss?
In most liquidity pools, an Automated Market Maker (AMM) algorithm is used to maintain the pool’s overall value by adjusting token prices in response to supply and demand. As tokens are exchanged in the pool, the quantity of tokens changes, leading to a concept known as “price impact,” where each purchase affects the price of the purchased token.
So, impermanent loss happens when the ratio between the two assets in the pool changes.
Several informative articles elucidate the concept and offer examples, yet they consistently present a formula for impermanent loss without providing its derivation.
(source: https://medium.com/auditless/how-to-calculate-impermanent-loss-full-derivation-803e8b2497b7)
where k is the price ratio of the two assets, with respect to price during entry.
We can visualize this on a graph, but it’s important to note that the graph doesn’t take into account the fees earned from providing liquidity.
where the x-axis is the price ratio, k where 1 = 100%
Let’s have an example:
Suppose you decide to provide liquidity to a decentralized exchange (DEX) by depositing 1 Ethereum (ETH) and 1000 US dollars (USD) worth of a stablecoin like DAI into a liquidity pool. The value of 1 ETH is $2000 at the time of deposit.
After a while, the price of Ethereum increases to $2500, while the price of the stablecoin remains stable at $1. This price change leads to an imbalance in the liquidity pool, as the value of the ETH you provided has increased compared to the stablecoin.
At this point, if you decide to withdraw your liquidity from the pool, you will receive less value compared to holding the original assets outside the pool. Let’s calculate the impermanent loss:
- Original Value of Assets: 1 ETH * $2000 (ETH price) = $2000 1000 DAI * $1 (DAI price) = $1000
- Total Value: $2000 + $1000 = $3000
- Value after Price Change: 1 ETH * $2500 (new ETH price) = $2500 1000 DAI * $1 (DAI price remains the same) = $1000
- Total Value: $2500 + $1000 = $3500
- Impermanent Loss: $3500 (new value) — $3000 (original value) = $500
In this example, you experienced a $500 impermanent loss by providing liquidity to the pool. However, if you keep your assets in the pool and the prices return to their original levels, the impermanent loss will be reversed, and you will regain the original value of your assets. But if you withdraw your liquidity while the prices are still imbalanced, the impermanent loss becomes permanent.
What is a liquidity pool?
In a liquidity pool, the assets’ prices are derived from the asset’s ratio within the pool itself, distinguishing it from traditional exchanges that rely on order books for price determination.
The liquidity pool employs an algorithm that ensures constant availability to buy an asset, regardless of price fluctuations, time of day, or the presence of buyers or sellers to meet current demands. Essentially, it functions as a pool of funds comprising the assets you aim to trade for, facilitated by smart contracts, and each transaction within the pool incurs a tax.
Why become a liquidity provider?
When you deposit funds into a liquidity pool, you become a liquidity provider, and as more people trade with the pool, the transaction fees go to the liquidity providers. However, as the pool attracts more participants, the share of fees per provider decreases. With increased funds in the pool, it becomes more resistant to price fluctuations, resulting in lower price impact and less influence from large buyers.
Despite the presence of impermanent loss, trading fees can act as a countermeasure to reduce its impact. Interestingly, even in liquidity pools involving highly volatile assets, which expose liquidity providers to significant impermanent loss, the potential for profitability remains due to the revenue generated from trading fees.
Managing impermanent loss?
While impermanent loss is always possible in liquidity pools, you can manage it and mitigate some of its risks.
Investing in a liquidity pool with stable coins is one possible strategy because the volatility of these coins are low by design. A yield aggregator that reinvests your fees and profits can also reduce the impact of impermanent loss.
Nevertheless, it is important to realize that IL happens no matter which direction the price changes. The only thing impermanent loss cares about is the price ratio relative to the price deposit
Summary:
Impermanent loss occurs due to the rebalancing movements within a liquidity pool, presenting a risk for liquidity providers who stake their assets in the pool.
This loss remains impermanent as long as the assets are kept in the pool; it becomes permanent only upon withdrawal.
Thanks to the DeFi Talents program (https://web3-talents.io/defi-talents), a 18-week mentoring program to empower talent for leadership in the decentralized finance space.”