Class TokenPairAPI

Represents a class for handling TokenPair operations related to the voidnode server.

Hierarchy

  • BaseAPI
    • TokenPairAPI

Constructors

Properties

premia: Premia

The Premia SDK instance.

streamIndex: number = 0

The current index of quote streams. Used to cancel stale streams.

Methods

  • Cancels all ongoing streams.

    Returns Promise<void>

  • Fetches data for a token pair from the voidnode server. Uses caching with a one-day time-to-live.

    Parameters

    • pair: TokenPairOrId

      The token pair or id to fetch the data for.

    Returns Promise<TokenPair>

    The data for the token pair.

  • Fetches data for multiple token pairs. Uses caching with a one-day time-to-live.

    Parameters

    • pairs: TokenPairOrId[]

      An array of token pairs to fetch the data for.

    Returns Promise<TokenPair[]>

    The data for the specified token pairs.

  • Retrieves extended information for multiple token pairs. Uses caching with a one-minute time-to-live.

    Parameters

    • pairs: TokenPairOrId[]

      An array of token pairs to fetch the extended information for.

    Returns Promise<TokenPairExtended[]>

    The extended information for the specified token pairs.

  • Fetches the current spot price of a token pair from the price oracle. Uses caching with a one-minute time-to-live.

    Parameters

    • pair: TokenPairOrId

      The token pair to fetch the spot price for.

    • Optional provider: Provider

      The custom provider to use for this call.

    Returns Promise<bigint>

    The current spot price of the token pair.

  • Gets the strike interval for a token pair based on its spot price.

    Parameters

    • pair: TokenPairOrId

      The token pair to fetch the strike increment for.

    • Optional provider: Provider

      The custom provider to use for this call.

    Returns Promise<bigint>

    The strike increment for the token pair.

Generated using TypeDoc