Recall that LP tokens, for instance WBNB-CAKE LP tokens, are given to liquidity providers in exchange for the pair of tokens WBNB and CAKE they lock into the pool. How do we calculate the value, or price in dollar, of a WBNB-CAKE LP token? Perhaps counter-intuitively, the answer is not the mean price of WBNB and CAKE.

The price $p^{\mathrm{LP}}$ (in dollars) of a WBNB-CAKE LP token depends on five parameters: the price $p^{\mathrm{WBNB}}$ of WBNB, the price $p^{\mathrm{CAKE}}$ of CAKE, the quantity $x^{\mathrm{CAKE}}$ of CAKE in the pool, the quantity $x^{\mathrm{WBNB}}$ of WBNB in the pool, and the total number $Q$ of WBNB-CAKE LP tokens representing the pool.

The WBNB-CAKE LP tokens represent equal shares of the pool. So from the total value inside the pool we deduce the price of each WBNB-CAKE LP token:

$p^{\mathrm{LP}}=\frac{p^{\mathrm{WBNB}}\times x^{\mathrm{WBNB}} + p^{\mathrm{CAKE}} \times x^{\mathrm{CAKE}}}{Q}$