LP-Swap

# Evolution of the price of a LP token

How can we relate the variation of the price of the WBNB-CAKE LP token to the variations of the prices of WBNB and CAKE?

This question is of central interest for a liquidity provider because his gain is the sum of the variation of the value of their WBNB-CAKE LP and rewards from providing liquidity.

We introduce the required notations: $p^{\mathrm{LP}}_0$is the initial price of the WBNB-CAKE LP token, while $p^{\mathrm{LP}}_1$ is the price at a given later time. Similarly we have notations $p^{\mathrm{WBNB}}_t,p^{\mathrm{CAKE}}_t,$$x^{\mathrm{WBNB}}_t,x^{\mathrm{CAKE}}_t$ for prices and quantities of both tokens at time $t = 0$ and $t = 1$.

Note that the quantity $Q$ of LP tokens may also vary with time as people add or remove liquidity. However this does not affect the value of each LP token, hence for simplicity we assume $Q$ is constant in what follows.

The price of the WBNB-CAKE LP token later in time is given by

$p^{\mathrm{LP}}_1=1/Q \times (p^{\mathrm{WBNB}}_1\times x^{\mathrm{WBNB}}_1 + p^{\mathrm{CAKE}}_1 \times x^{\mathrm{CAKE}}_1).$

By the arbitrage-free formula at time $t=1$ we have $p^{\mathrm{WBNB}}_1\times x^{\mathrm{WBNB}}_1= p^{\mathrm{CAKE}}_1 \times x^{\mathrm{CAKE}}_1$, hence

$p^{\mathrm{LP}}_1=2/Q \times p^{\mathrm{WBNB}}_1\times x^{\mathrm{WBNB}}_1.$

We can relate $x^{\mathrm{WBNB}}_1$ to the tokens in the pool at the initial time $t=0$ using the constant product rule $x_1^{\mathrm{WBNB}} \times x_1^{\mathrm{CAKE}}=x_0^{\mathrm{WBNB}} \times x_0^{\mathrm{CAKE}}$, which yields:

$x^{\mathrm{WBNB}}_1\times x^{\mathrm{WBNB}}_1 \times \frac{p_1^{\mathrm{WBNB}}}{ p_1^{\mathrm{CAKE}}}= x^{\mathrm{WBNB}}_0 \times x^{\mathrm{CAKE}}_0\\ \Rightarrow x^{\mathrm{WBNB}}_1= \sqrt{\frac{p_1^{\mathrm{CAKE}}}{ p_1^{\mathrm{WBNB}}}\times x^{\mathrm{WBNB}}_0 \times x^{\mathrm{CAKE}}_0},$

so that

$p^{\mathrm{LP}}_1=2/Q \times \sqrt{p^{\mathrm{WBNB}}_1 \times p_1^{\mathrm{CAKE}} \times x^{\mathrm{WBNB}}_0 \times x^{\mathrm{CAKE}}_0}.$

We denote by $r,s\geq 0$ the variations of the prices of WBNB and CAKE, i.e. we have:

$p_1^{\mathrm{WBNB}}= r \times p_0^{\mathrm{WBNB}}\;\;\;\;\text{and}\;\;\;\;p_1^{\mathrm{CAKE}}= s \times p_0^{\mathrm{CAKE}}.$

We can then rewrite the price of the WBNB-CAKE LP token as

$p^{\mathrm{LP}}_1=2/Q \times \sqrt{r \times s \times p^{\mathrm{WBNB}}_0 \times p_0^{\mathrm{CAKE}} \times x^{\mathrm{WBNB}}_0 \times x^{\mathrm{CAKE}}_0}.$

However by the arbitrage-free formula at time $t=0$ we have $p^{\mathrm{WBNB}}_0\times x^{\mathrm{WBNB}}_0= p^{\mathrm{CAKE}}_0 \times x^{\mathrm{CAKE}}_0$, which implies that:

$p^{\mathrm{LP}}_1=2/Q \times \sqrt{r \times s} \times p^{\mathrm{WBNB}}_0 \times x^{\mathrm{WBNB}}_0.$

This leads to the beautiful formula relating the variation of the price of the LP token to that of the single tokens in the pool:

$p^{\mathrm{LP}}_1 = \sqrt{r \times s }\times p^{\mathrm{LP}}_0.$
Docs