Function calcSpotPrice

  • Calculate the spot price for an asset given the balance in and out and weights. Usefull for clientside calculations when rpc calls are costly or not needed.

    Note

    Use sdk.context.api.rpc.swaps.getSpotPrice(s) for higher accuracy and verifiability.

    Returns

    Decimal

    Parameters

    • tokenBalanceIn: BigNumber

      BigNumber - the balance of the asset swapped into the pool

    • tokenWeightIn: BigNumber

      BigNumber - the weight of in asset

    • tokenBalanceOut: BigNumber

      BigNumber - the balance of the asset swapped out of the pool

    • tokenWeightOut: BigNumber

      BigNumber - the weight of out asset

    • swapFee: BigNumber

      BigNumber - the fee of the swap

    Returns Decimal

Generated using TypeDoc