Explaining Impermanent Loss

Dear POP! Town,

Impermanent loss is arguably one of the most infamous topics in the DeFi space, due to its complexity to both understand and tackle. Given that over the last few days we’ve seen a great deal of questions, discussions and misconceptions surrounding Impermanent Loss (IL) being exchanged in our Telegram Channel, we’ve decided to create an extensive article in order to provide solace and clarity amongst the community.

Before we dive in, let’s determine what exactly is impermanent loss. For this, let’s take a simple citation from the Uniswap V2 Documentation which you can find here:

“There is a risk of losing money during large and sustained movement in the underlying asset price compared to simply holding an asset.”

Impermanent loss refers to the loss endured due to price variance within a liquidity pool. It’s important to understand that impermanent loss is just a part of the exposure held by liquidity providers.

The potential “loss” consists of the following four elements:

  1. Gas costs — especially as a small liquidity provider, it’s easy to spend more on gas than your potential future reward
  2. Impermanent loss — irrespective of the direction that the asset moves in (up or down) you’re exposed to impermanent loss
  3. Price risk — if the asset you’re providing liquidity for goes down in value, so does your liquidity
  4. Slippage — upon adding and removing liquidity there’s a risk of slippage if the slippage variable has been set “too high”

For this article, we will extensively examine all 4 elements, providing numerical data to assist with the explanations. This will be followed up with a conclusion, that will condense the deductions from this article.

Gas costs vs. potential returns

Gas costs are linear by nature, therefore it doesn’t matter if you’re adding $100k worth of liquidity or $1k — the gas costs remain the same. In order to calculate if the gas costs endured are worth the effort of adding liquidity & obtaining rewards, we must first look at the gas costs associated with adding liquidity.

If we assume that adding liquidity costs us ~$40 and staking the LP tokens amounts to ~$15, then we get a total overhead in net costs of ~$55.

Now we need to know how many days it takes to earn back $55 with certain yield percentages. For that, we present the following table:

The table represents how many day(s) it takes to earn back the gas costs associated with providing liquidity depending on APR & amount of USD invested.

There’s a simple and visually obvious conclusion that we can draw from this table, however, let’s summarize it into words:

Depending on the APY + The amount in USD you’re investing, it might not be worth participating in “Liquidity Mining” or “Staking”, when simply considering gas costs.

For example, if we want to earn back our gas fees in exactly a week, what would it look like? Taking the same table used previously, the outcome would look as following:

As you can see, the values displayed are now shown as TRUE/FALSE, depending if you are able to earn back your costs in less than a week (TRUE if yes, FALSE if no).

This makes it easier to draw explicit conclusions. Namely:

  • If the APY < 250%: Investing $1000 isn’t worth it
  • If the APY < 100%: Investing $2500 isn’t worth it
  • If the APY < 25%: Investing $10000 isn’t worth it
  • And obviously: The same in inverse.

Impermanent Loss

Often discussed, but frequently misunderstood. Let’s start with the definition of impermanent loss and a look at a mathematical example:

If ETH is trading at $2000 and we, hypothetically speaking, add $4000 in liquidity consisting of:

1 ETH (@ $2000) + 2000 DAI (@ $1) (= $4000 in Liquidity)

Let’s assume ETH increases by 50% to $3000 per ETH, then we get the following amounts in the liquidity pool:

0.816 ETH (@ $3000) + 2449.5 DAI (@ $1) (= $4899 in Liquidity)

It’s critical to understand that even though we’ve “gained” $899, we have still experienced impermanent loss. In other words, had we NOT provided liquidity, then we would have ended up with:

1 ETH (@ $3000) + 2000 DAI (@ $1) = $5000

From here on forward it’s easy to calculate the impermanent loss, by simply deducting the $ value you would have held (had you not provided liquidity) by the $ value of the liquidity at that point. This is shown below.

$4899 — $5000 = -$101

And in percentages:

-$101 / $5000 = -0.0202 * 100 = -2.02% impermanent loss

Here are a couple of important lessons we can deduce from the example above:

  1. We “lost” 0.184 ETH. In more accurate terms, we sold 0.184 ETH for DAI with a relatively low average price
  2. We didn’t lose money. Instead, we lost money that we “could have made” had we NOT provided liquidity
  3. We’re ignoring fees + incentives for providing liquidity

There’s a high probability that you’ve seen this explanation time & time again, especially since it’s a rather straightforward example that can be well understood when looking at the numbers.

However, things start to get more interesting if we invert the scenario that we just analyzed, and we look at the data for when ETH decreases by 50% after we provide liquidity:

If ETH is trading at $2000 and we, hypothetically speaking, add $4000 in liquidity consisting out of:

1 ETH (@ $2000) + 2000 DAI (@ $1) (= $4000 in Liquidity)

Let’s assume ETH decreases by 50% to $1000 per ETH, then we get the following amounts in the liquidity pool:

1.414 ETH (@ $1000) + 1414.2 DAI (@ $1) (= $2828.4 in Liquidity)

So, let’s first calculate our impermanent loss:

Had we held on to our previous amounts and NOT provided liquidity:

1.0 ETH (@ $1000) + 2000 DAI (@ $1) (= $3000)

And the impermanent loss logically amounts to:

$2828.4 — $3000 = -$171.6

And percentages:

-$171.6 / $3000 = -0.0572 * 100 = -5.72% impermanent loss

But wait! The Uniswap documentation and all other “impermanent loss calculators” say something else! You must be wrong! Here’s the trick: It matters significantly how you calculate percentages, or more over — what the base is.

If we present the famous “percentage change formula” as:

((new — old) / old) = percentage change

Then it’s relatively important what we define as “old”. For very obvious reasons, most documentation refers to “old” as the lowest amount you can take (which is the base of holding). However, that’s not realistic.

Let’s look at these calculations in the table below, so we can patch together the results and understand what they’re indicating.

It’s important that when you look at this table, that you consider “IL in %” to be just a portion of the net loss. In other words, the IL isn’t your total loss or gain by any means! For example, in the -90% scenario shown in the table, your impermanent loss is 42.50%, yet, your account balance is down from $4000 to $1264.9. Therefore, your net realized Profit and Loss (PNL) is -68% (!!).

Things get significantly more complicated when the liquidity you provide is in 2 volatile assets (instead of ETH/Stablecoin). Since we’ve already made an example above about how impermanent loss works, we’re just going to share a table with a couple of examples between two token price movements.

Once again, the table visualizes a couple of simple conclusions, namely:

  • Upside is severely limited by providing liquidity, e.g. A 500% increase in price of asset A only amounts to a net gain of ~144% on the total USD value of the account. This gain can be eroded very quickly if asset B consecutively decreases in value.
  • Impermanent loss is applicable to the USD value of the liquidity position, not necessarily on the absolute token amount of the position. This creates the interesting dynamic that impermanent loss can be “Low” while 90% of the absolute token 1 has been “sold”.
  • An asset increasing by 500% means you lose ~60% of the token 1 supplied, and amounts to a total of ~45% impermanent loss. While “capturing” less than 33% of the gain (~145% upside).

Price risk

As we discussed in the beginning, the impermanent loss isn’t the only loss you’re opening yourself up to when providing liquidity. Another potential risk is the “price risk”, or in other words, the risk of the price going down. This can be derived from the tables we posted above. But regardless, let’s analyze some numbers.

If we go back to our initial example — Providing $4000 worth of liquidity spread over $2000 of ETH and $2000 of DAI, then we can derive the following table with net gain/loss.

This presents a clear cut visualization of the asymmetric risk that a liquidity provider takes on. For example, -95% translates to an effective loss of ~78%, while +100% translates to ~41% gain. An asymmetric risk profile.

More importantly however, if we look at these tables combined we can see that impermanent loss isn’t a standalone risk. In fact, the price risk is equally “worrisome”, which is the result of price moving against you.

This effect is somewhat amplified by liquidity pools with dual volatile assets. For example, let’s examine a table where we create the same negative return profile accompanied by an inverse asset. Inverse meaning: an asset moving up against a falling asset.

In an inverted relationship, token 1 rising by 500% while token 2 falls by 60% equates to ~52% impermanent loss and ~55% net gain (positive). The interesting annotation being that token 1 changed in price by almost 10x more than the net realized gain on the user’s actual USD denoted account.

Slippage

The final “cost” or potential loss to bear is “slippage”. Uniswap has a couple of interesting design quirks, thanks to how the Ethereum network functions. These quirks are in place in order to make a functioning automated market maker on a chain where transaction speed is (relatively) low. The most interesting of these quirks being “Slippage”.

When a user sets up a swap from Ethereum to DAI, they are prompted with a “Slippage” input in percentages. This input directly translates to “The minimum amount of tokens the user will get in return if the price moves in between the submitting of the transaction and its actual execution”.

Slippage is also applicable on adding & removing liquidity and can be set in the Uniswap Interface. We will abstain from mathematically explaining slippage since it’s a very simple construct, however, a slippage of 5% equates to a maximum endured loss of ~5% OR the transaction will fail.

It’s worthwhile to double check the slippage input upon executing a swap, adding or removing liquidity.

Conclusion

While Uniswap, Automated Market Makers and On Chain Trading come with an array of exciting opportunities to explore, as well as an array of inherent advantages, we’re still seeing grand misunderstandings in regards to the functioning of decentralized exchanges and the execution of trades/provision of liquidity. It’s of tremendous value to get comfortable with the mathematics behind the X*Y=K Uniswap formula and the “Constant Product” rule to calculate future value of your liquidity.

As with any investment, in particular in the field of emerging technologies, it’s critical to conduct extensive research in order to understand the vast concepts around your investment. Given DeFi is still an extremely novel space, the rewards can be extremely impressive, however, the losses can be equally brutal. Therefore, it’s up to the investor to make sure they are ready to accept either outcome.

About POP!

POP! is a platform that allows 2 projects to objectively display mutual trust and commitment to each other, by locking their respective tokens together and creating a trustless Mutual Liquidity Pool (MLP). In addition, it grants POP! users the opportunity to provide single-sided liquidity, in the form of their favourite token, by matching them with another POP! user and adding their joint liquidity into the MLP.

Powered by Faculty Group, POP! aims to set a new golden standard with regards to partnerships, and how they are perceived in the digital asset ecosystem.

Website | Gitbook | Telegram | Twitter | Onepager

--

--

--

POP! is a platform that allows 2 projects to prove their partnership and allows single-sided LP funding on Uniswap, by matching providers.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

The Warehouse Group Limited- The Buffettology Workbook

How should you invest in your 20s & 30s?

Is there a place to get my credit score for free?

📊 Create Your Personal Finance System: A Little Guide to Automatise Your Budget – Part 1

How do I know what my credit score is?

A Beginner’s Guide to Penny Stocks

Howard Marks: Investors May See the Lowest Return Period in History

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
POP!

POP!

POP! is a platform that allows 2 projects to prove their partnership and allows single-sided LP funding on Uniswap, by matching providers.

More from Medium

Staking to reduce RISK

How Taproot Improves The Lightning Network

NEW YEAR, NEW POP!

The shuffle — the prelude of our Evaluation Machine