Scroll Animation
Trading Ideas 9 min read

What is Impermanent Loss?

Author

Proma Nautiyal

Published

March 7, 2023

Impermanent loss (IL) is a phenomenon that can occur in decentralized finance (DeFi) trading, particularly when using automated market makers (AMMs) such as Uniswap or Balancer. It occurs when the price of an asset changes while a trader is holding a position, resulting in a loss of value for the trader.

To understand impermanent loss better it will help to understand concepts like AMMs, liquidity pools, and how changes in token prices lead to a loss, invariably for any investor who is acting as a liquidity provider. 

 

Is this loss real?

Can it be curtailed? 

When and why does this happen?

 

These are some of the questions we are going to tackle in this article. 

 

What causes impermanent loss?

IL happens when the price of one token changes relative to its pair from the time you deposit it to the time you withdraw it. 

The reason why it’s referred to as impermanent loss is that in reality, it is an unrealized opportunity cost; the amount you would have earned or rather not lost had you not deposited in the liquidity pool. So, in effect, an impermanent loss is not a real loss. 

Also, there is a good chance that the token pair might return to their original prices (the price at which they were deposited initially) before withdrawal, leading to zero impermanent loss. 

Many a time the trading fees earned by the liquidity provider depositing into the liquidity pool sets off the loss. 

As you can see, there are multiple factors at play here. So let’s take a look at what causes these changes in the pricing of token pairs and how they are regulated in the market which does not function using order books. 

 

Where does impermanent loss take place?

IL can take place in any decentralized exchange (DEX) that has liquidity providers funding its pools of token pairs. 

DEX allows people to swap tokens with a trusted third party. One of the major benefits of DEX is that, unlike CEX, you are in control of your tokens as they are in your wallet and not held on the exchange. 

DEX primarily uses two blockchain-based techniques to ensure decentralization: liquidity pools and automated market makers (AMM).

What are liquidity pools?

Liquidity pools comprise deposits of two tokens, enforced by smart contracts, that enable token swaps on the DEX. The pairs are usually set at a 50:50 ratio.

For example, if you would like people to swap BTC for ETH in your exchange, you will first need to create a pool where people can make this swap. To create such a pool you will need liquidity (BTC and ETH) in the pool, which is offered by liquidity providers. 

 

How do the liquidity providers benefit?

Liquidity providers depositing token pairs into the liquidity pool stand to earn the transaction fee for every swap that occurs in the pool. This is a way of earning from their crypto holdings. So, if you hold 2% of the liquidity in the pool, you will receive 2% of the total transaction fees in that pool. 

Liquidity providers pay due attention to understanding the fee structure of every pool they deposit into as that gives them an idea as to whether the particular pool is risky or rewarding. As mentioned earlier, the transaction fees are sometimes more than capable of offsetting the risks of IL. 

How does it work? 

As a liquidity provider in the BTC/ETH pool, you will need to deposit both tokens in a 50:50 ratio. So, if 1 BTC = 2 ETH and you are depositing 2 BTC in the pool, you’ll need to match that with 4 ETH. 

You get LP tokens which signify the percentage of your combined deposit in the entire pool and you stand to earn transaction fees in that pool at that percentage. 

How does trading work in liquidity pools?

Once the liquidity pool has enough tokens, traders can start swapping their tokens in that pool. But unlike traditional CEX, liquidity pools on DEX only allow you to swap one token for the other token that is present in the pool.

As stated in our example, a trader can only trade BTC for ETH and vice versa. This is done at the prevailing exchange rate. 

So how are the prices of the tokens maintained in a market which does not match buy or sell orders to an order book?

DEX uses a system called an automated market maker. When the pool is just beginning to operate the AMM uses market rates and marks the prices of the tokens and ensures there are equal amounts of both. As traders start swapping currencies in the pool, the AMM uses a mathematical formula that adjusts the prices likewise and ensures balance in the pool. 

Say there were initially 100 BTC at 1 BTC = 2 ETH, then the initial pool will have 200 ETH at a 1:1 ratio. 

100 BTC = 200 ETH

Now if you were to 2 BTC for 20 ETH, the current pool would have 98 BTC and 220 ETH. This will change the price of BTC from 2 ETH to 2.2 ETH.

If the price of ETH in markets overall is still 2 ETH then arbitrage traders will buy BTC at a discounted price and sell it for ETH in the pool. The arbitrage will continue till the prices fall in line with the market prices. 

In short, while in the pool, it’s the ratio of the tokens that dictates their respective prices. While the liquidity in the pool remains unchanged, the ratio of the tokens keeps changing thereby changing their price. 

 

How do the AMM and depositing in liquidity pools affect IL?

 

Let’s take an example of depositing in a liquidity pool that deals in ETH and DAI swaps. Say, you have deposited 1 ETH and 100 DAI into the liquidity pool, where the token ratio is 50:50 and 1 ETH = 100 DAI. Given the fact that DAI is a decentralized stablecoin that tries to maintain a value equal to $1 for 1 DAI, we can say that the dollar value of your investment would be $200. 

The entire liquidity pool on the other hand consists of 20 ETH and 2000 DAI, which includes your share along with that of others. This gives you a 5% share in the LP. 

Now, let’s say the price of 1 ETH increases to reflect 500 DAI. When this happens, arbitrage traders will start buying ETH from the pool and adding more DAI to it. This will continue till the LP starts reflecting the current market price again. 

The current LP will reflect 10 ETH and 5000 DAI. 

If at this point you decide to withdraw your fund, you will be able to do so at 5% of your own LP, which is 0.05 ETH and 250 DAI. This amounts to $500. Which means you have earned a profit of $300 as against your initial deposit right? 

But think of this. What if you had held the 1 ETH and 100 DAI outside the pool, what would be the value of the same right now in the current market? Your dollar value share of the holding would’ve been $600, which means you earned a loss of $100. This loss which is not realized till you withdraw your share from the LP reflects impermanent loss. 

But of course, you should also take into account the 5% of trading fees in the LP that your earn, which many a time is a substantial amount and could easily cover the $100 IL you might have incurred. 

If we were to plot a graph of how you can estimate IL then it would look something like this. 

 

how does impermanent loss happen

 

Note that the price change in any of the tokens in the pair leads to a loss. Higher the change, the greater the loss. This graph does not take trading fees earned from the LP into account. 

 

Should you participate in a liquidity pool?

Now that you know that irrespective of the token you provide into the pool you stand to earn an IL given there’s even a slight price change and that the trading fees more or less offset these losses, you should make your decision of adding to LPs of AMM wisely. 

Ensure that you aren’t dealing in volatile assets in LP pools, especially if you are risk averse as with volatile assets large-scale price fluctuations are given. 

Start with a smaller amount to check what kind of returns you can expect from the pool. If they are up to your expectations and you can see the trading fees doing you justice you can go ahead and deposit a larger amount. 

IL can be mitigated by providing liquidity across multiple pools and not keeping the positions for long periods, However, it’s important to note that IL is a risk that traders should consider when using AMMs and other DeFi trading platforms.

 

Conclusion

It’s important to note that the IL is not a bug or a flaw in the design of AMMs or DeFi platforms, it is a trade-off that is made to provide decentralized and permissionless access to liquidity. Understanding and managing IL is a crucial part of being a successful trader or liquidity provider in the DeFi space.

 

concepts crypto trading