ftx-api-typed
Version:
Node.js/typescript connector for FTX's REST APIs and WebSockets
46 lines (45 loc) • 1.89 kB
TypeScript
import { AxiosRequestConfig } from 'axios';
export declare type FtxDomain = 'ftxcom' | 'ftxus';
export interface RestClientOptions {
recv_window?: number;
sync_interval_ms?: number | string;
disable_time_sync?: boolean;
strict_param_validation?: boolean;
baseUrl?: string;
parse_exceptions?: boolean;
subAccountName?: string;
domain?: FtxDomain;
}
export interface WSClientConfigurableOptions {
key?: string;
secret?: string;
subAccountName?: string;
pongTimeout?: number;
pingInterval?: number;
reconnectTimeout?: number;
restOptions?: RestClientOptions;
requestOptions?: AxiosRequestConfig;
wsUrl?: string;
domain?: FtxDomain;
}
export interface WebsocketClientOptions extends WSClientConfigurableOptions {
pongTimeout: number;
pingInterval: number;
reconnectTimeout: number;
}
export declare type GenericAPIResponse<T> = Promise<{
success: boolean;
result: T;
}>;
export declare function serializeParams(params?: object, strict_validation?: boolean): string;
export declare function serializeParamPayload(isGetRequest: boolean, params?: string | object, strictParamValidation?: boolean): string | undefined;
export declare type apiNetwork = 'ftxcom' | 'ftxus';
export declare const programId = "ftxnodeapi";
export declare const programId2 = "ftxnodeapi2";
export declare const programKey = "externalReferralProgram";
export declare function isFtxUS(clientOptions: RestClientOptions | WebsocketClientOptions): boolean;
export declare function getRestBaseUrl(restClientOptions: RestClientOptions): string;
export declare function getWsUrl(options: WebsocketClientOptions): string;
export declare function isPublicEndpoint(endpoint: string): boolean;
export declare function parseRawWsMessage(event: MessageEvent): any;
export declare function objectToFormData(object: Record<string, any>): FormData;