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.
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.
80/20 Pools
Here we will examine the same circumstance as shown in the 50/50 Pools example to compare what effect a change in pool weights can have on a liquidity provider's position.
COMP WETH 80/20
To emphasize the weighting of 80 / 20 as opposed to 50/50 we will observe impermanent loss under the COMP favoring pool conditions to display the benefits of uneven pool weightings. We will in turn hold 1 WETH @ $2000.00 each and 32 COMP @ $250.00 each. ($8000 in COMP and $2000 in WETH).
Our gains will then be determined by the invariant ratio. This 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.
While impermanent loss is still applicable in this scenario in comparison to the 50/50 pool the losses are nearly cut in half (a factor of 0.5825 more precisely). When dealing with very large liquidity positions these small amounts can make a large difference in value and ultimately weighting will protect or expose liquidity providers from impermanent loss depending on their choices; however, if prices return to their initial state or follow the same price change at a certain point the “losses” will revert to zero regardless of weighting.
Multi-token Pools
Balancer's multi-token pools are one of our unique features. Below is an example of how impermanent loss on one of these pools can occur. Inclusive of details on volatility and stable coins.
Advanced Example – Multi Token Pool
An example of a multi token pool and how impermanent loss would occur and then be reverted will be solved below. We will look at a Polygon pool: 25% USDC, 25% WMATIC, 25% BAL, 25% WETH. Initially we will assume we joined with $10,000 in USD evenly amongst the assets.
Initial Conditions:
We will assume USDC stays at a constant value, BAL increase by 15% to $28.75, WMATIC decreases 4% to $1.20, and WETH increase 50% to $3750.00.
New Token Balances can be calculated as follows:
Due to a stable coin (USDC) being a portion of the pool, impermanent loss is nearly inevitable unless all tokens return to their initial value at the time of liquidity provision; therefore, the pool above and any pool with stables and non-stable assets a Liquidity Provider is concerned mostly with volatility and their profit to be made from swap fees or liquidity mining. They are essentially positioning themselves with the expectations of this type of price pattern:
One may provide liquidity to a pool in which USDC and an asset (X) at 14.01 are present in mid-July. Then by the time the chart comes to an end the price is still 14.01 after going through stages of upward and downward price changes. This will yield an amount of swap fees to be collected as profit as well as 0% impermanent loss.
At any point where all prices revert to their initial values, arbitragers will bring the tokens back to their initial balances. With a stable token present this would mean no gains can be made without impermanent loss or swap fees being present. In turn the goal can be considered to have low IL and high swap or liquidity mining for a liquidity provider with these types of positions. Also, it can be viewed to manage exposure to volatile assets.