Impermanent Loss
Impermanent Loss — definition
Impermanent Loss (IL) often occurs when you have two independent assets artificially bound together in a defined ratio. When you provide liquidity in a liquidity pool (LP), the two assets are algorithmically bound together by the system to ensure that both sides of your pool share will have the same dollar value. Likely, the price of your deposited assets will fluctuate to some degree compared to when you deposited them, so the system balances the pool to recover the ratio of 50% on each side again. The bigger the difference of divergence between the two assets, the more you are exposed to impermanent loss.
Pools that contain assets that maintain a relatively small price divergence will be less exposed to impermanent loss. For example, pools with two different stablecoins or different wrapped versions of the same coin will move in a relatively small value range.
Impermanent Loss — loss estimation
So, impermanent loss happens when the ratio between the two assets in the pool changes. But how much is it, exactly? Thankfully, it can defined by the following equation (source: https://medium.com/auditless/how-to-calculate-impermanent-loss-full-derivation-803e8b2497b7):
where k is the price ratio of the two assets, with respect to price during entry.
We can plot this on a graph. Note that it doesn’t account for fees earned for providing liquidity.
where the x-axis is the price ratio, k where 1 = 100%
Here’s a summary of what the graph is telling us about losses compared to HODLing:
- 1.25x ratio change = 0.6% loss
- 1.50x ratio change = 2.0% loss
- 1.75x ratio change = 3.8% loss
- 2x ratio change = 5.7% loss
- 3x ratio change = 13.4% loss
- 4x ratio change = 20.0% loss
- 5x ratio change = 25.5% loss
An important note here: As we are talking about the ratio between the two asset values (not the asset values themselves), impermanent loss will occur no matter which direction the ratio changes. As a small example, if we have a ETH / BTC pool, it doesn’t matter if ETH goes 2x and BTC stays the same or the other way around. The impermanent loss will be 5.7% loss in both cases.
Why is it called Impermanent Loss?
Impermanent loss isn’t a very intuitive name. It’s called impermanent loss because the losses are only theoretical until you withdraw from the pool. Your pool share may experience a ratio swing of 5x (25.5% IL loss) only to return to the same ratio as when you entered the pool. If you withdraw your liquidity at that time, you will not have suffered any impermanent loss. In this sense, IL is similar to traditional finance’s unrealized losses. However, when you withdraw your liquidity from the pool at any other time, the loss becomes real and permanent. The fees you earn while in the pool may be able to compensate for those losses, but it’s still a slightly misleading name.
Why do people provide liquidity if they lose money through IL?
Impermanent loss can still be counteracted by trading fees. In fact, even pools with volatile assets — that expose a liquidity provider to heavy amounts of impermanent loss — can be profitable thanks to the trading fees.
THORChain, for instance, charges fees on every trade and about 50% of those fees go to liquidity providers (the other 50% goes to node operators). If there’s a significant amount of trading volume in a given pool, it can be profitable to provide liquidity even if the pool is heavily exposed to impermanent loss. This, however, depends on many factors: the protocol, the specific pool, the deposited assets, and even wider market conditions.
Pool APY and Impermanent Loss
The APY most providers publish take the fees and block rewards into account but can’t really include everyone’s impermanent loss, as IL depends on the individual’s time of entry and is not based on transaction count. Before entering a pool, it is highly recommended to play with the THORChain Forecast Calculator found in the LPU Discord (see below).
A simple example
You enter the RUNE/USDC pool with 1,000.0 Rune at $3.50 and 3,500.0 USDC. As we have entered the pool completely symmetrically, we do not need to rebalance anything. Our initial investment value was therefore $7000.
We are predicting that Rune will appreciate during the 5 months we are in the pool and will be $8 when we exit the pool. USDC, being a stablecoin, will not change and stay at $1. Therefore, the price ratio change, k = ($8/$1) / ($3.50/$1) = 2.29.
The way we can calculate our new pool value is:
- Before IL, new pool value is (1000 Rune x $8) + 3500 USDC = $11,500
- IL based on k = 2.29; IL = 7.97% of $11500 = $917
- Therefore pool value after IL = $11500 - $917 = $10583
We now have to factor in the earnings from trading fees and block rewards. The assumed APY for the RUNE/USDC pool is 80%. For the 5 months in the pool, this is estimated as $3323.50 of earnings, therefore, our final redeemable pool share value is $10583 + $3323.50 = $13906.50.
Since LP is always rebalanced to 50:50 value of the two assets:
- The redeemable amount in our pool share is 869.16 Rune and 6953.25 USDC tokens (Total value: $13906.50)
- Fees are also earned in both currencies in equal dollar value amounts. The total fee earned during our stay is therefore 207.72 Rune and 1661.75 USDC (Total value: $3323.50)
We can now withdraw from the pool with 869.16 Rune and 6953.25 USDC. If we compare the current values with the values we had at the beginning (1’000 runes and 3500 USDC), we can see that, even though we have had 7.97% impermanent loss (k = 2.29 ratio), the fees more than made up for that loss and we were able to gain $2406.50 compared to the HODL values, or “LP gains vs HOLD = 20.9% for 5 months”.
- Assumed APY (based on estimated LP earnings): 80%
- Initial Investment (HODL value at exit): $11500 (1000 Runes + 3500 USDC)
- Gains: $2406.50 ($13906.50 — $11500)
- Time span: 5 Months
- Extrapolated APY (based on Hodl value): 57.8%
THORChain Forecast Calculator
The THORChain Forecast Calculator is a command line Discord bot in the LP University discord that helps you simulate different scenarios related to providing liquidity in THORChain. The main idea of the tool is to calculate returns from a stay in a liquidity pool. Between fees and impermanent loss, finding out how much the real APY will actually be for a pool stay is very complex.
The command will run a function which will calculate a scenario defined by your inputs which are:
- Asset Name — asset which is being pooled along with Rune e.g. BTC, ETH
- Rune Amount — specify amount of Rune you will enter the pool with (this is the number of rune after pool rebalancing)
- Rune Price At Enter — The price of Rune at the time of entering the pool
- Asset Price At Enter — The price of the asset at the time of entering the pool
- Rune Price Prediction — The price of Rune at the time of exiting the pool
- Asset Price Prediction — The price of the asset at the time of exiting the pool
- Time Spent In Pool — The time spent in the pool before withdrawing the liquidity
- Desired APY — you can specify the APY, how much will you earn in fees & block rewards (you can use THORSwap APY as a baseline)
The result shown below is taken from the example above.
As you can see, input and output of the pool are laid out simply as well as the different methods of entry and withdrawal (symmetrically or asymmetrical with either asset). Depending on how you entered the pool, the tool will show the different LP vs. HODL comparison.
Feel free to hop into the TC University Discord to chat about this, or any other THORChain questions that you may have.
Explore THORChain: Website, X, Telegram, Developer Discord.
Explore Maya Protocol, the first friendly fork of THORChain: Website, X, Discord, Telegram.
Decentralized, permissionless, non-custodial, trust-minimized, open-sourced, economic-secured, non-wrapped, native-to-native cross-chain swaps, savings and soon, lending!
Originally published at https://crypto-university.medium.com on August 12, 2021. Updated March 2, 2022.