What is Impermanent Loss in Crypto Explained with Example | How to Calculate & Avoid it

Welcome to whiteboard programming, where we 
simplify programming with easy-to-understand   whiteboard videos, and today, I'll be sharing 
with you what is impermanent loss in crypto Well,   impermanent losses are one of the risks 
concerned with Liquidity Pools in DeFi.   And to state its definition, it refers to the 
difference in value between funds held in an AMM   and funds held in your wallet. Impermanent 
loss occurs when the value of the funds   staked to the AMM fluctuates drastically. The 
more significant the price fluctuations is,   the greater the impermanent loss can be. Confused? 
Let's understand this concept one step at a time   with an example.

I'm assuming that you are aware 
of a basic understanding of concepts like Defi   and yield farming, if not, no worries, I've got 
you covered with my these 2 videos, link for each   can be found in the description below. So, yield 
farming — also called liquidity mining — in DeFi   has been at the heart of the market's explosion, 
led by automated-market-making (or AMM) protocols.   Some projects like Uniswap, SushiSwap, and 
Balancer are known as decentralized exchanges,   and they rely on such AMM protocols. Their 
platforms allow traders to easily swap tokens   in a completely decentralized and seamless manner. 
This complete cycle is made possible by liquidity   providers — i.e., users who deposit particular 
crypto assets to the platform, thereby providing   liquidity for other assets to be exchanged. 
The Liquidity Providers are incentivized to   deposit or lock-in, their assets because they earn 
transaction fees generated by the traders swapping   tokens on the given platform.

And if seen from 
the perspective of Liquidity Providers — those   locking their tokens into the DeFi protocol — 
the transaction fees they earn are like a yield.   And the value of this yield fluctuates, as it 
depends on the protocol's usage and volume. With   this being the foundational understanding, let's 
dig deeper into How AMM liquidity pools work.   In order for users of an AMM-powered protocol to 
swap tokens, there need to be pools of liquidity   available to them. For example, if a John wants to 
sell 1 ETH for USDT… and, for simplicity's sake,   if we say 1 ETH is trading for 1,000 USDT and 
there's no platform fees, then there needs to   be a liquidity pool that can take the 1 ETH 
and give 1,000 USDT and vice versa. So, as   trading volumes surge, so does the need for such 
liquidity, and that is where those who are looking   to be Liquidity Providers come in. These users can 
deposit the two digital currencies of a pair — in   this case, is ETH and USDT— to the protocol's 
relevant pool(s) in a predetermined ratio, which,   in the most cases is 50/50.

Now, to understand 
things better let's take another example,   if a Liquidity Provider with 10 ETH wishes to add 
liquidity to an ETH/USDT pool with a 50/50 ratio,   they will need to deposit 10 ETH and 10,000 
USDT (by still assuming 1 ETH = 1,000 USDT).   If the pool they commit to has a total of 100,000 
USDT worth of assets (50 ETH and 50,000 USDT),   their share will be equal to 
20% by this simple equation…   Also, the percentage of the Liquidity Providers 
share in a given pool is important to note because   when the Liquidity Provider commits or deposits 
their assets to the pool via a smart contract,   they will automatically be issued Liquidity 
Prool's tokens.

These tokens entitle the   Liquidity Provider to withdraw their share of 
the pool at any time which is 20% of the pool   in our stated example. Now, this is where the 
concept of impermanent loss comes into play.   Since Liquidity Providers are entitled to their 
share of the pool and not a specific number of   tokens, they are exposed to another layer of 
risk — which we call impermanent loss and it   happens when the price of your deposited assets 
changes compared to when you deposited them.   Remember here, the bigger this change is, the more 
you are exposed to impermanent loss and in this   case, the loss means less dollar value at the time 
of withdrawal than at the time of deposit.

Also,   do note that it is called as “impermanent” 
because as long as the cryptos can return   to the price when they were deposited on the 
AMM, no loss occurs, and the Liquidity Provider   also gets 100% of the trading fees. Next, let's 
understand how to calculate impermanent loss,   so, in our example, the price of 1 ETH was 1,000 
USDT at the time, but let's say the price doubles   and 1 ETH starts trading for 2,000 USDT.

Since 
the pool is adjusted by an algorithm, it uses   a formula to manage assets. The most basic and 
widely used one is the constant product formula,   which is popularized by Uniswap. In simple 
terms, the formula states: ETH liquidity x token   liquidity = constant product Using figures from 
our example (based on 50 ETH and 50,000 USDT),   we get: 50 x 50,000 = 2,500,000 Similarly, the 
price of ETH in the pool can be obtained with   this formula: token liquidity / ETH liquidity = 
ETH price And on applying our example figures,   we get: 50,000 / 50 = 1,000 USDT (i.e., the 
price of 1 ETH). Now, when the price of ETH   changes to 2,000 USDT, we can use these formulas 
to ascertain the ratio of ETH and USDT held in the   pool with these equations further, on applying 
data from our example here along with the new   price of 2,000 USDT per ETH gets us the following 
so, we can confirm the accuracy of this by using   the very first equation (ETH liquidity x token 
liquidity = constant product) to arrive at the   same constant product of 2,500,000, which can be 
seen as follows: 35.355 x 70,710.6 = ~2,500,000   (which proves as the same as our original constant 
product).

Hence, after the price change, assuming   all other factors remain constant, the pool will 
have roughly 35 ETH and 70,710 USDT, compared to   the original 50 ETH and 50,000 USDT. If at this 
time, the Liquidity Provider wishes to withdraw   their assets from the pool, they will exchange 
their Liquidity Provider tokens for the 20%   share they own. Taking their share from the 
updated amounts of each asset in the pool,   they will get 7 ETH (i.e., 20% of 35 ETH) 
and 14,142 USDT (i.e., 20% of 70,710 USDT).   Now, the total value of the assets withdrawn 
equals: (7 ETH x 2,000 USDT) + 14,142   USDT = 28,142 USDT.

However, if the user 
simply held their 10 ETH and 10,000 USDT,   instead of depositing these assets into a DeFi 
protocol, they actually would have gained more…   Assuming ETH doubled in price from 1,000 USDT to 
2,000 USDT, the user's non-deposited assets would   have been valued at 30,000 USDT, simply as (10 ETH 
x 2,000 USDT) + 10,000 USDT = 30,000 USDT. That   difference of 1,858 USDT— which can occur because 
of the way AMM platforms manage asset ratios   is what is known as impermanent loss. So, 
now that, we know what is impermanent loss   and how to calculate it, let's talk about 
how you can avoid impermanent loss… Well,   although, there is no way to avoid impermanent 
loss, Liquidity Providers can still take a few   measures to mitigate the risk. 1. Use Stablecoin 
Pairs: Now, by providing liquidity in stablecoin   pairs is the best bet against impermanent loss. 
Since stable coins value doesn’t fluctuate much,   they present low arbitrage opportunities, thus 
decreasing the risks.

However, at the same time,   Liquidity providers who hold stablecoins 
cannot enjoy the rise in the crypto market. 2.   Avoid Volatile Pairs: Instead of choosing 
cryptos with an unstable or volatile history,   pick up pairs that don’t expose liquidity to 
impermanent loss. 3. Thoroughly Search The Market:   Crypto markets are highly volatile. Hence, it 
is normal that deposited assets move up or down   in value. However, Liquidity providers must 
know when to pull out their cryptocurrencies   before the price deviates too far away from 
the initial rate. Lastly, as a conclusion,   I'd like to say that impermanent loss is the sole 
reason why big financial institutions don’t enter   the liquidity pools. This issue should be solved 
if AMMs are to achieve widespread adoption among   businesses and individuals worldwide. And though, 
various forks of Uniswap have come up in recent   months that try to solve the issue, we are yet to 
see a clear winner who can help avoid this loss   of liquidity.

With that, I hope this video was 
helpful to you and served, if you love my content,   feel free to smash that like button, and if 
you haven't already subscribed to my channel,   please do as it keeps me motivated and helps 
me create more content like this for you!.

You May Also Like