Decentralized exchanges such as Uniswap, SushiSwap or Pancakeswap attract users by two characteristics: Automatic Market Creation Tool (AMM) and Liquidity Pool. These platforms offer democracy when anyone can create markets and earn transaction fees without delegating your money to any third party.
While providing liquidity to these decentralized exchanges is an exciting way to explore the world of distributed finance, it also carries many risks and trade-offs. This risk is called a temporary loss.
You can read more about DEX, AMM and Liquidity Pool here.
What is impermanent loss?
Impermanent Loss or Temporary Loss means a decline in the value of the initial margin cryptocurrency when providing liquidity to the AMM (Auto Market Maker). This happens because the ratio between the pairs you provide liquidity changes when the market is highly volatile.
The bigger the change, the higher your loss. That’s why AMM works best with pairs of tokens of equal value, such as stablecoins and wrapped tokens. If the exchange rate change between token pairs remains in a small range then the temporary loss is negligible.
Conversely, if the exchange rate changes greatly, liquidity providers are best placed to hold tokens instead of contributing capital to the liquidity tank. However, even if there are temporary losses such as ETH/DAI, the supplier still makes a profit because of the transaction fees they have accumulated.
How to calculate impermanent loss
To manage transactions, Uniswap uses a formula:
ETH pool * Token pool = constant value (1)
That is, the amount of tokens that traders receive for their ETH and vice versa are calculated so that after the transaction, the total volume of the two liquidity tanks does not change compared to before the transaction. So, for transactions with very small value compared to the volume of liquidity tanks, we have the formula:ETH price = Token pool / ETH pool (2) From formula (1) and (2), we can calculate the volume of each tank at any given price when assuming total liquidity is constant: ETH pool = √ (constant value/ETH price)Token pool = √ (constant value*ETH price)From these formulas, let’s consider an example: A liquidity tank has 100 ETH and 10,000 DAI.
If a liquidity provider contributes 1 ETH and 100 DAI to the tank then they are having a 1% stake. Since in the AMM, the deposited token pairs must have the equivalent value, the price is 1 ETH = 100 DAI at the time of deposit.
Suppose, after a trading volume, now the price of 1 ETH is 120 DAI. Then applying to the above formulas, we can calculate the share price of that liquidity provider as follows: ETH pool = 91.2871DAI pool = 10954.4511Because the person is holding a 1% stake in the liquidity tank, they have 0.9129 ETH and 109.54 DAI.
Because the DAI price is approximately the same as USD, for the convenience of calculation, we will convert all to DAI. Thus, at the time of the price of 1 ETH = 120 DAI, the total liquidity of this person is 219.09 DAI.
But if the liquidity provider holds their initial 1 ETH and 100 DAI then the total value at this time will be 220 DAI. From there, it can be seen that this person has lost 0.91 DAI from providing liquidity to Uniswap instead of keeping their original ETH and DAI coins.
Temporary losses can also be illustrated as shown as the chart below: It can be calculated that:
- Price change 1.25 times = loss 0.6%
- Price change 1.50 times = loss 2.0%
- Price change 1.75x = loss 3.8%
- Price changed 2 times = loss of 5.7%
- Price changed 3 times = loss of 13.4%
- Price changed 4 times = 20.0% loss
- Price change 5x = loss 25.5%
Note that temporary losses occur when the price changes in any direction. This means that when the price doubles or falls in half, the amount of temporary losses is the same.
How to Avoid?
This loss is called a “Temporary Loss” because when the exchange rate of the deposited asset classes goes back to the beginning, this loss disappears. However, if you withdraw at a time when the exchange rate has fluctuated, this amount of loss becomes permanent. So what are the ways these losses don’t become permanent?
Option 1: Wait for the exchange rate between the currency pairs to return to the original.
As mentioned above, this loss will disappear when the exchange rates of the deposited asset classes return to pre-volatility levels. However, this is a passive way and there is no guarantee that the prices of these asset classes will return to their original levels.
Option 2: Stop providing liquidity when the market is about to move sharply
In many cases, your losses are negligible as you can still make a profit from the trading fees you accumulate. But as the market approaches a period of strong growth, it is possible that the provision of liquidity cannot compensate for temporary losses. At this point, it’s wise to stop providing liquidity.
Option 3: Choose liquidity tanks that have a greater return than a temporary
loss The more liquidity tanks have, the greater the profit you can make. So you can look to AMM’s most profitable liquidity tanks to make up for the losses.
Option 4: Choose low-volatility
liquidity tanks Temporary losses may be limited when the prices of currency pairs remain stable, e.g. USDT/BUSD is such a stablecoin pair. On the contrary, although they do not cause you losses, the profits obtained are usually low.
In summary, if the asset price changes since the deposit, the liquidity provider may suffer a temporary loss. So be careful when depositing money into the AMM, and make sure that you have a clear understanding of the temporary loss before getting too focused on exploiting the yield.