LP-Swap
Academy

Impermanent loss and how to compute it

We consider an investment into WBNB-CAKE LP tokens. Impermanent Loss (IL) is the difference between the revenue of a pure investment into the volatile assets (WBNB and CAKE) and an investment into the LP tokens.

Recall that the variation of the price of the LP token is proportional to r×s\sqrt{r \times s }, where rr and ss are the variations of the prices of WBNB and CAKE respectively. Therefore an investment in WBNB-CAKE LP tokens generates revenues proportional r×s\sqrt{r \times s }.

However we should also take into account that there is a yield farming interest rLPr^{\mathrm{LP}} per LP token derived from any source - trading fees, subsidies, reward tokens. If this interest is reinvested into the pool for compounding and not removed as payout, then total revenue is given by

r×s×(rLP+1).\sqrt{r\times s}\times (r^{\mathrm{LP}}+1).

On the other hand, for a pure 50/50 investment in WBNB and CAKE, the revenue is proportional to the variations rr and ss of the prices of WBNB and CAKE:

r+s2\frac{r+s}{2}

Impermanent Loss (IL) is the difference between the revenue of an investment into the LP tokens and a pure investment into the volatile assets (WBNB and CAKE):

IL=r×s×(rLP+1)r+s2=r×sr+s2+r×s×rLP.\mathrm{IL}=\sqrt{r\times s}\times (r^{\mathrm{LP}}+1)-\frac{r+s}{2}={\color{blue}\sqrt{r\times s}-\frac{r+s}{2}} + {\color{green}\sqrt{r\times s}\times r^{\mathrm{LP}}}.

The last equality is particularly helpful to quantify Impermanent Loss. If we neglect the yield farming interest, rLP=0r^{\mathrm{LP}}=0, then impermanent loss simply consists in the blue term. By the Arithmetic-Geometric mean inequality, this is always negative: r×sr+s2<0{{\color{blue} \sqrt{r\times s}-\frac{r+s}{2}}<0}.

Therefore, in the absence of yield farming interest, an investment into LP tokens is always loosing against a pure investment into each token of the pair. The higher the difference between the variations rr and ss of the prices of WBNB and CAKE, the bigger will be the Impermanent Loss.

This is why the yield farming interest rLP>0r^{\mathrm{LP}}>0 is crucial, as then the yield farming revenue r×s×rLP{\color{green}\sqrt{r\times s}\times r^{\mathrm{LP}}} can compensate for the loss r×sr+s2<0{{\color{blue} \sqrt{r\times s}-\frac{r+s}{2}}<0}.

Next, let us assume that the price of one token does not change, for instance s=1s=1. This happens for instance when CAKE is replaced with a stable coin. Then the revenue of a pure investment in WBNB is given by the price evolution rr. Therefore the investment in LP tokens beats IL if:

r×(rLP+1)r(rLP+1)2r.\sqrt{r}\times (r^{\mathrm{LP}}+1) \geq r \Longleftrightarrow (r^{\mathrm{LP}}+1)^2\geq r.

Similarly the investment in LP tokens is sub-optimal whenever:

r×(rLP+1)r(rLP+1)2r.\sqrt{r}\times (r^{\mathrm{LP}}+1) \leq r \Longleftrightarrow (r^{\mathrm{LP}}+1)^2\leq r.

Note that the investment in LP token can even tolerate significant drops in asset price down to

r×(rLP+1)1r1(rLP+1)2.\sqrt{r}\times (r^{\mathrm{LP}}+1) \geq 1 \Longleftrightarrow r\geq \frac{1}{(r^{\mathrm{LP}}+1)^2}.

The situation is summarised in this graphic:

Docs
Twitter
Telegram