5. Effective Price Calculation

The Effective Price is the future spot price of a token in a liquidity pool after a transaction has occurred. It reflects the price of the traded token in terms of the anchor token, accounting for the change in token volumes and weights in the pool resulting from the transaction. This price is used to indicate the new market rate for subsequent trades once the pool has adjusted to the most recent transaction.

5.1. Mathematical Foundations

5.1.1 Standard Formula

EffectivePriceTraded=(VolumeAnchor+TokenAnchorInputVolumeTradedāˆ’TokenTradedOutput)ƗWeightTradedWeightAnchorEffectivePrice_{Traded} = ( \frac{Volume_{Anchor} + Token_{Anchor}^{Input}}{Volume_{Traded} - Token_{Traded}^{Output}} ) \times \frac{Weight_{Traded}}{Weight_{Anchor}}

Where

  • EffectivePriceTradedEffectivePrice_{Traded} : Effective price of TokenTradedToken_{Traded} in terms of TokenAnchorToken_{Anchor}.

  • TokenTradedOutputToken_{Traded}^{Output} : Amount of TokenTradedToken_{Traded} being received from the pool.

  • TokenAnchorInputToken_{Anchor}^{Input} : Amount of TokenAnchorToken_{Anchor} being input into the pool.

  • VolumeTradedVolume_{Traded}​ : Current volume of TokenTradedToken_{Traded} in the pool before the transaction.

  • VolumeAnchorVolume_{Anchor}​ : Current volume of TokenAnchorToken_{Anchor} in the pool before the transaction.

  • WeightTradedWeight_{Traded}​ : Current weight of TokenTradedToken_{Traded} in the pool.

  • WeightAnchorWeight_{Anchor}​ : Current weight of TokenAnchor in the pool.

This formula provides the real-time price at which TokenTradedToken_{Traded} can be bought or sold in terms of TokenAnchorToken_{Anchor} immediately after the transaction.

After each transaction, the LBP system recalculates the effective price using the most recent data on token volumes and weights. This ensures that the price reflects the current market conditions, providing transparency and fairness in trading.

5.1.2 Alternative Formula

Alternatively, the effective price of TokenTradedToken_{Traded} can be calculated by considering the ratio vv of TokenAnchorInputToken_{Anchor}^{Input} to VolumeAnchorVolume_{Anchor}. This highlights the exponential nature of the function, which is influenced by the ratio of weights ww.

EffectivePriceTraded=vƗ(1+n)1+wwEffectivePrice_{Traded} =\frac{v \times (1+n)^{1+w}}{w}

Where

  • nn : Ratio of TokenAnchorInputToken_{Anchor}^{Input} to VolumeAnchorVolume_{Anchor} = TokenAnchorInputVolumeAnchor\frac{Token_{Anchor}^{Input}}{Volume_{Anchor}}

  • ww : Ratio of WeightAnchorWeight_{Anchor} to WeightTradedWeight_{Traded} = WeightAnchorWeightTraded\frac{Weight_{Anchor}}{Weight_{Traded}}

  • vv : Ratio of VolumeAnchorVolume_{Anchor} to VolumeTradedVolume_{Traded} = VolumeAnchorVolumeTraded\frac{Volume_{Anchor}}{Volume_{Traded}}

Due to the exponential relationship between effective price and the ratio n, the range of possible maximum effective prices for a typical LBP can be illustrated as follows:

5.2. Slippage and Its Impact on Effective Price

In an LBP, slippage is influenced by several factors, including the size of the trade relative to the pool's liquidity, the current token weights, and the dynamic adjustment of these weights. Larger trades tend to cause more significant changes in the pool's balance, leading to higher slippage.

A positive slippage value indicates that the trader received less of the output token than expected (or paid more for the input token).

5.2.1 Standard Formula

Slippage can be calculated as the percentage difference between the SpotPriceSpotPrice (the price before the trade) and the EffectivePriceEffectivePrice (the price after the trade):

Slippage=(EffectivePriceāˆ’SpotPriceSpotPrice)Ɨ100Slippage=(\frac{Effective Price āˆ’ Spot Price}{Spot Price}) Ɨ 100

5.2.2 Alternative Formula

Alternatively, slippage can be calculated by considering the ratio vv of TokenAnchorInputToken_{Anchor}^{Input} to VolumeAnchorVolume_{Anchor} . This emphasizes the exponential nature of the function, which is influenced by the ratio of weights ww. This also highlights that higher liquidity (larger VolumeAnchorVolume_{Anchor}) reduces the impact of individual trades on price, thereby minimizing slippage and contributing to the overall stability and fairness of the LBP.

Slippage=((1+n)(1+w)āˆ’1)Ɨ100Slippage= ((1+n)^{(1+w)} -1) Ɨ 100

Where

  • nn : Ratio of TokenAnchorInputToken_{Anchor}^{Input} to VolumeAnchorVolume_{Anchor} = TokenAnchorInputVolumeAnchor\frac{Token_{Anchor}^{Input}}{Volume_{Anchor}}

  • ww : Ratio of WeightAnchorWeight_{Anchor} to WeightTradedWeight_{Traded} = WeightAnchorWeightTraded\frac{Weight_{Anchor}}{Weight_{Traded}}

Due to the exponential relationship between slippage and the ratio nn, the range of possible maximum slippage can be expressed as follows:

Last updated