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 (in dollars) of a WBNB-CAKE LP token depends on five parameters: the price of WBNB, the price of CAKE, the quantity of CAKE in the pool, the quantity of WBNB in the pool, and the total number 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: