blog posts

Impermanent

Impermanent Loss Explained

Impermanent loss is one of the most intimate experiences liquidity providers ever have with their money. When you deposit tokens into a liquidity pool and their price changes a few days later, the amount of money lost due to that change is your impermanent loss.

This loss affects you, the liquidity provider but, at the same time, involves so many other people. It’s a messy affair most of us aren’t prepared for when we decide to stake our tokens to earn trading fees on Uniswap.

It takes a special kind of scrutiny to understand impermanent loss and how to determine how much you lose. Some fancy equations and formulas can get to the precise decimal of that amount.

The good news is, we’re going to simplify all that shenanigans. Learn about the presence of impermanent loss when providing liquidity and the risks of using an AMM (automated market maker) in this article.

Automated Market Makers and Liquidity Pools

Let’s start with where it all started.

Decentralized exchanges use a system called automated market maker that allows any token holder to deposit their tokens into a liquidity pool. The token pair is usually Ethereum-based and a stable coin like DAI.

So, when a trader needs to swap Ethereum for DAI, they can come to the pool, put some ETH into it and take the equivalent in DAI, minus a transaction fee (0.3%.) That transaction fee will be paid to the people who have deposited into the pool, aka liquidity providers.

A liquidity pool must contain a 50/50 ratio in the value of both tokens. For example, DAI is pegged to the US dollar so 1 DAI is always $1. If an ETH is worth 100 DAI and there are 10 ETH in the pool, there must be 1000 DAI. Also, note that the token prices in this pool are only affected by the ratio between them and not the prices on external markets.

When depositing into a pool, you must also put an equal amount in value for both tokens. So, if you want to stake 1 ETH, you need to put in 100 DAI as well. Then, if the entire pool contains 10 ETH and 1000 DAI after your deposit, your total share is 10%.

When you decide to withdraw, 10% of the total transaction fees (0.3%) made up to that point is what you’d earn. Let’s say the ETH price remains the same, and there had been 100 ETH worth of trade volumes before your withdrawal. This would result in a 0.3 ETH earning for the liquid providers.

Remember that the value of ETH and DAI must be equal at all times, so 0.3 ETH translates to 0.15 ETH and 15 DAI. The liquidity pool now has 10.15 ETH and 1,015 DAI. With a 10% share at this point, you’ve made a profit.

How Does Impermanent Loss Occur?

So now we know how liquidity providers make an earning in a perfect scenario where prices are a peaceful candlestick. Unfortunately, volatility is a part of life in the crypto realm, and prices change often.

Impermanent loss happens when the price of your token changes after you deposit it in the liquidity pool.

From the above example, if the price of ETH goes up to $200, you’ll now be looking at a 1 ETH per 200 DAI exchange rate.

At this point, you’ll realize had you held on to your 1 ETH and 100 DAI,

you would have had $300, meaning $100 in profit. But since you’ve deposited it into the liquidity pool, you’re stuck with the original price, resulting in a 50% impermanent loss.

The good news is this loss could be temporary. If ETH later goes back down to the original price at your deposit, then you break even.

Estimating Impermanent Loss

Impermanent loss based on sheet value, meaning it can keep changing until an action has taken. When you decide to withdraw after a price change, your loss will become permanent.

This is when things get interesting because you will get a much different figure than what you initially thought. When ETH price goes up, there’

s a window of opportunity for arbitrage traders to swoop in and buy the token for cheap.

Since the new rate for ETH is 200 DAI and the old price in the liquidity pool is 100, traders can replace Ethereum and put in DAI until the ratio reflects the new rate. There is an intense formula behind calculating this ratio, but you can use a web calculator to get the exact amount.

Remember that there are 10 ETH and 1000 DAI in your pool. Now, using the calculator to plug in the new ETH price at 200 DAI, we get a new ratio.

10 ETH/1000 DAI ⇒ 7.07 ETH/1,414.21 DAI.

As you can see, the arbitrage traders have gotten away with 2.93 ETH for 414 DAI. On the other hand, you still have a 10% share of the new ratio. If you withdraw, you’d end up with 0.707 ETH x 200 + 141.421 DAI = $282.

This is still more than what you started with, which is $200, but if you had not deposited, you would have had $300, instead.

Takeaway

All the calculations did not account for the trading fees. You would have earned along the way, regardless of impermanent losses. Most would argue that the earnings would eventually cancel out the price changes.

While that may be true, the problem is we can’t use our income to cover our losses. This is why one should only stake their tokens after thorough consideration, including risk calculations as mentioned above. Start small and only with what you can afford to lose because the bigger your deposit. The bigger the impermanent loss when prices change.

One of the best ways to overcome impermanent loss is to look beyond it. The tokens you’ve committed already have a purpose, which is to earn you trading fees. Let them do their job for the more you put into the equation, the less you might get out of it.