A tagged trade amount: either a Quantity or a Volume.

Properties

asQuantity: undefined | Quantity

Returns the quantity, or undefined when this is a volume amount.

asVolume: undefined | Volume

Returns the volume, or undefined when this is a quantity amount.

isQuantity: boolean

Returns true when this amount is a quantity.

isVolume: boolean

Returns true when this amount is a volume.

Methods

  • Returns void

  • Returns a fresh TradeAmount holding the same value.

    Returns TradeAmount

  • Returns void

  • Builds a quantity-denominated trade amount.

    Accepts a Quantity value object or a DecimalInput.

    Errors

    Throws ParamError on an invalid value.

    Parameters

    • value:
          | string
          | number
          | bigint
          | Quantity

    Returns TradeAmount

  • Builds a volume-denominated trade amount.

    Accepts a Volume value object or a DecimalInput.

    Errors

    Throws ParamError on an invalid value.

    Parameters

    • value:
          | string
          | number
          | bigint
          | Volume

    Returns TradeAmount