Impermanent Loss (IL)
If you're planning to get involved in the world of decentralized finance (DeFi), you'll probably be using a liquidity pool (LP). Investing in LPs is a great way to earn passive income; however, it comes with risks. One of the biggest risks is Impermanent Loss (IL).
Impermanent Loss occurs the moment you provide liquidity to a LP and the price of your assets changes compared to when you put them in. The greater the change, the more exposed you are to loss. It means that the dollar value of the LP is lower at the time of withdrawal than when you deposited it.
IL can be defended against by using a LP that contains assets remaining in a relatively small price range and thus will be less exposed to IL. For example, stablecoins will remain in a relatively limited price range, thus there is less risk of IL for this LP.
So why do we put liquidity into a liquidity pool if we are exposed to IL?
Because IL can be mitigated or completely wiped out by trading fees.
Decentralized exchanges (DEXs) charge a certain fee on each trade made (this is usually 0.1 % - 0.5 %) that goes directly to the LP. If there is a large volume of trades in a given pool, it may be profitable to provide liquidity even if the pool is heavily exposed to IL. However, this also depends on the protocol, particular LP, deposited assets, and overall market conditions.
1 ETH (1,000 USD = ETH market price) and USDT. If we deposit e.g. 1 ETH and 1,000 USDT into a pool, which is a total of 2,000 USD, and the price of 1 ETH rises to 2,000 USD, this is when the IL happens. Since the assets are in a 50:50 ratio to each other (due to supply / demand and arbitrage traders), we are left with only 0.7 ETH and 1,412 USDT for a total of 2,812 USD after the withdrawal.
IL can be calculated. Let's take a look:
You put 1 ETH and 1,000 USDT into the LP.
The total liquidity in the pool into which you put the assets is 10 ETH and 10,000 USDT. Thus, the total value of the pool is 20,000 USD. Your share is 10%.
ETH x USDT
10 x 10,000 = 100,000 (total LP value in tokens / coins)
We get the ETH price simply by flipping the tokens / coins and dividing.
USDT / ETH
10,000 / 10 = 1 ,000
Now, the value of ETH has risen to 2,000 USD.
We need to divide the total value of the LP in assets and the current USD value of ETH to get the current number of ETH coins in the LP.
LP value / new ETH price = new number of ETH in LP
√ ( 100,000 / 2,000 ) = 7
To get the new number of USDT tokens we need to multiply the total value of LP in assets with the current ETH price.
For USDT :
LP value x new ETH price = new number of USDT in LP
√ ( 100,000 x 2,000 ) = 14,142
A quick check to see if the calculation was correct:
ETH x USDT = total LP value
7 x 14,142 = 100,000 (resp. 98 994 due to decimal rounding)
Before the price increase, there were 10 ETH and 10,000 USDT in the pool.
After the ETH price increase to 2,000 USDT, the new value in the pool is 7 ETH and 14,142 USDT.
Now we take out 10% deposited in the LP, which is 0.7 ETH and 1,412 USDT.
Now we have USD 1,400 worth ETH and 1,412 USDT in our wallet. The total dollar value is 2,812 USD. If we hadn't put anything into the LP, our value would be 1 ETH (USD 2,000) and 1,000 USDT, which makes a total of 3,000 USD. So the LP would be - 188 USD in our case, which is - 6.2% of the original amount. This doesn't include the fees for withdrawing or depositing into the LP or the reward you get for putting liquidity into the LP, as each protocol has its own terms and conditions.
If you don't want to calculate the IL formula, there are apps that will calculate it for you in a second. They're called IL Calculators.
In the first two lines you type the price of the cryptocurrency when inserted into the LP and in the bottom two lines you type their future price.
Impermanent Loss (IL) is one of the basic concepts that everyone who wants to provide liquidity should understand, especially if they want to grasp the reasons why they may have lost value when they pull out of the LP. If the price of the inserted assets has changed since their insertion, the assets deposited in the LP may be exposed to the Impermanent Loss.