Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • UnitConverter

Index

Properties

Private UNITS_PER_CURRENCY

UNITS_PER_CURRENCY: {} = UNITS_PER_CURRENCY

Number of smallest units per currency.

Type declaration

  • [key: string]: number

Methods

amountToUnits

  • amountToUnits(__namedParameters: { amount: number; currency: string }): number
  • Parameters

    • __namedParameters: { amount: number; currency: string }
      • amount: number
      • currency: string

    Returns number

init

  • init(): void

unitsToAmount

  • unitsToAmount(__namedParameters: { currency: string; units: number }): number
  • Parameters

    • __namedParameters: { currency: string; units: number }
      • currency: string
      • units: number

    Returns number

Static calculateInboundOutboundAmounts

  • calculateInboundOutboundAmounts(quantity: number, price: number, isBuy: boolean, pairId: string): { inboundAmount: number; inboundCurrency: string; inboundUnits: number; outboundAmount: number; outboundCurrency: string; outboundUnits: number }
  • Calculates the incoming and outgoing currencies and amounts of subunits/satoshis for an order if it is swapped.

    Parameters

    • quantity: number

      The quantity of the order

    • price: number

      The price of the order

    • isBuy: boolean

      Whether the order is a buy

    • pairId: string

    Returns { inboundAmount: number; inboundCurrency: string; inboundUnits: number; outboundAmount: number; outboundCurrency: string; outboundUnits: number }

    An object with the calculated incoming and outgoing values. The quote currency amount is returned as zero if the price is 0 or infinity, indicating a market order.

    • inboundAmount: number
    • inboundCurrency: string
    • inboundUnits: number
    • outboundAmount: number
    • outboundCurrency: string
    • outboundUnits: number

Generated using TypeDoc