Options
All
  • Public
  • Public/Protected
  • All
Menu

Class RestClient

Hierarchy

  • RestClient

Index

Constructors

constructor

Properties

Private Readonly #app_id

#app_id: string

Private Readonly #client_id

#client_id: string

Private Readonly #shared_key

#shared_key: string

Readonly url

url: URL

Accessors

Private #headers

  • get #headers(): Headers

Private #token

  • get #token(): string

Methods

fetch

  • fetch<T>(url: string | URL, __namedParameters?: RequestInit): Promise<T>
  • Make a request and parse the body as JSON

    Type parameters

    • T = unknown

    Parameters

    • url: string | URL
    • __namedParameters: RequestInit = {}

    Returns Promise<T>

fetchStream

  • fetchStream(url: string | URL, options?: RequestInit): Promise<JSONStream>
  • Make a request and return JSONStream

    Parameters

    • url: string | URL
    • options: RequestInit = {}

    Returns Promise<JSONStream>

getAccountSummary

getAccountSummaryWithoutDate

getAccounts

getActiveOrders

getCandles

getCrossrate

getCurrencies

getDailyChange

getDailyChanges

getExchangeSymbols

getExchanges

getGroupNearestSymbol

  • Get financial instrument which has the nearest expiration in the group

    Parameters

    Returns Promise<IIntrument>

getGroupSymbols

getGroups

getLastQuote

getOrder

getOrders

getQuoteStream

  • Get the trades stream for the specified financial instrument

    Parameters

    • __namedParameters: ILastQuoteOptions
    • __namedParameters: { signal?: AbortSignal } = {}
      • Optional signal?: AbortSignal

    Returns Promise<JSONStream>

getSymbol

getSymbolSchedule

getSymbolSpecification

getSymbols

getTicks

getTradesStream

  • getTradesStream(__namedParameters: ISymbolIds, __namedParameters?: { signal?: AbortSignal }): Promise<JSONStream>
  • Get the trades stream for the specified financial instrument

    Parameters

    • __namedParameters: ISymbolIds
    • __namedParameters: { signal?: AbortSignal } = {}
      • Optional signal?: AbortSignal

    Returns Promise<JSONStream>

getTransactions

getTypeSymbols

getTypes

modifyOrder

orderUpdatesHttp

  • orderUpdatesHttp(__namedParameters?: IVersion, __namedParameters?: { signal?: AbortSignal }): Promise<JSONStream>
  • Get order updates stream via HTTP

    Parameters

    • __namedParameters: IVersion = {}
    • __namedParameters: { signal?: AbortSignal } = {}
      • Optional signal?: AbortSignal

    Returns Promise<JSONStream>

placeOrder

tradesHttp

  • tradesHttp(__namedParameters?: IVersion, __namedParameters?: { signal?: AbortSignal }): Promise<JSONStream>
  • Get trades updates stream via HTTP

    Parameters

    • __namedParameters: IVersion = {}
    • __namedParameters: { signal?: AbortSignal } = {}
      • Optional signal?: AbortSignal

    Returns Promise<JSONStream>

Static JWT

  • JWT(secret: string, payload: string | Buffer | Record<string, unknown>, header?: string | Buffer | Record<string, unknown>): string
  • Get a JSON Web Token (HMAC + SHA256)

    Parameters

    • secret: string
    • payload: string | Buffer | Record<string, unknown>
    • header: string | Buffer | Record<string, unknown> = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9"

    Returns string

Static base64URL

  • base64URL(input: string | Buffer | Record<string, unknown>): string
  • Convert to Base64URL

    Parameters

    • input: string | Buffer | Record<string, unknown>

    Returns string

Static fetch

  • fetch<T>(url: string | URL, options?: RequestInit): Promise<T>
  • Make a request and parse the body as JSON

    Type parameters

    • T = unknown

    Parameters

    • url: string | URL
    • options: RequestInit = {}

    Returns Promise<T>

Static fetchStream

  • fetchStream(url: string | URL, options?: RequestInit): Promise<JSONStream>
  • Make a request and return a stream

    Parameters

    • url: string | URL
    • options: RequestInit = {}

    Returns Promise<JSONStream>

Static setQuery

  • setQuery(url: URL, query: Record<string, undefined | string | number | boolean>): void
  • Add query to URL

    Parameters

    • url: URL
    • query: Record<string, undefined | string | number | boolean>

    Returns void