Function hydra_dx_math::lbp::calculate_spot_price[][src]

pub fn calculate_spot_price(
    in_reserve: Balance,
    out_reserve: Balance,
    in_weight: LBPWeight,
    out_weight: LBPWeight,
    amount: Balance
) -> Result<Balance, MathError>
Expand description

Calculating spot price given reserve of selling asset and reserve of buying asset. Formula : BUY_RESERVE * AMOUNT / SELL_RESERVE

  • in_reserve - reserve amount of selling asset
  • out_reserve - reserve amount of buying asset
  • in_weight - pool weight of selling asset
  • out_Weight - pool weight of buying asset
  • amount - amount

Returns None in case of error