Impermanent Loss

Impermanent Loss, sometimes referred to as divergent loss, can simply be put as the opportunity cost of adding liquidity into an AMM pool vs holding the individual tokens.

Impermanent loss occurs when the prices of two assets experience a divergence in price action. For example if two assets increase by 20% no impermanent loss is noticed; however, if one asset increases in value by 20% then a divergence has taken place and some form of impermanent loss would be noticed in the position. This can be reversed by the other token in the pool also increasing 20% or both tokens converging on the same price movement relative to the original amount the user put in the pool. A basic example of impermanent loss followed by reversal scenario is outlined on the following page.

Impermanent Loss - Relationship shown based on a two token pool with one asset and one stable coin.

50/50 Pools

We will start with a simple 50/50 pool featuring COMP/WETH. We take a time when WETH is worth $2,000 USD and we have 2.5 WETH ($5,000.00). At the same time COMP is worth $250.00; therefore, the corresponding amount is 20 COMP tokens. Our liquidity position is deposited and we receive pool tokens for this $10,000 join.

We check back out our position after a period of time and COMP has doubled, 100% gains straight to $500.00 USD. WETH has only made it up to $2300.00 at this point, gains of just 15%. We know at this point we will face some impermanent loss. We still have strictly gains but due to our liquidity position we are missing out on some of the theoretical gains.

Here we calculate the invariant from the value function:

Our gains will be determined by the invariant ratio, this value can be used for our token balances as well.

Here we can consider the USD values to be the same in the numerator and denominator therefore not needed to determine the ratio between the two.

For the new token balances we consider the invariant ratio compared to the price action of the individual asset. This proportion will yield the new balance of each token in relation to the initial join amount.

Please note these calculations can take place over any time frame. These occurred in roughly 12 days between June 25 and July 07 of 2021. This same price action can take place over the course of 1 year and with 4% or more in swap fees or liquidity mining accumulating the LP position would become the more attractive option.

These calculations are depicted by the following tables.

Initial Liquidity Position Amount: $10,000.00

HODL Total: $15750.00

LP Total $15165.75; with 4% Annual yield $15,772.38

In our prior example COMP and WETH went through divergent price changes. When this happens, we saw the potential loss of value that can be created by the nature of impermanent loss. Now if our prices continue to change, we will look at an example where WETH goes up to a price of $3000.00 and COMP decreases down to $375.00. While these are diverging prices changes this will bring us to a 50% gain for both assets in relation to our original Liquidity Position.

Therefore, because our invariant ratio matches our price action ratio, we have an indicator that there will be no impermanent loss.

This calculation will be done from the point where impermanent loss was experienced to the current state to prove the “loss” is indeed reversible under the proper conditions.

Initially:

After Price Change:

New Token Balances can be calculated as follows:

These balances match our initial liquidity position meaning overall we lost nothing impermanent loss. The price action is still in our favor by 50% for both assets as we hold the same initial number of each. Also, we would have likely collected swap fees for this from swappers making our gains slightly larger.

Through the price action regardless of how dramatic impermanent loss can be reversed as seen above. This can occur countless times as prices of assets in a pool fluctuate in price. The importance of this is understanding the assets you are holding and how comfortable you are with volatility. In theory great volatility will be coupled with large swap volumes, making the swap fees and gains for liquidity providers increase. Weighing the risk of impermanent loss with the accumulation of swap fees or “volatility farming” is the game of a liquidity provider long term.