Function hydra_dx_math::xyk::calculate_spot_price
source · pub fn calculate_spot_price(
in_reserve: u128,
out_reserve: u128,
amount: u128
) -> Result<u128, MathError>Expand description
Calculating spot price given reserve of selling asset and reserve of buying asset. Formula : OUT_RESERVE * AMOUNT / IN_RESERVE
in_reserve- reserve amount of selling assout_reserve- reserve amount of buying assetamount- amount
Returns MathError in case of error