bitget-api
Version:
Complete Node.js & JavaScript SDK for Bitget V1-V3 REST APIs & WebSockets, with TypeScript & end-to-end tests.
62 lines (61 loc) • 2.58 kB
TypeScript
export interface RestClientOptions {
/** Your API key */
apiKey?: string;
/** Your API secret */
apiSecret?: string;
/** The passphrase you set when creating the API Key (NOT your account password) */
apiPass?: string;
/** Set to `true` to connect to testnet. Uses the live environment by default. */
/**
* Set to `true` to use Bitget's demo trading: https://www.bitget.com/api-doc/common/demotrading/restapi.
*
* Disabled by default.
*/
demoTrading?: boolean;
/** Override the max size of the request window (in ms) */
recvWindow?: number;
/** Default: false. If true, we'll throw errors if any params are undefined */
strictParamValidation?: boolean;
/**
* Default: true.
* If true, query string values will be URI Encoded (encodeURIComponent).
* This prevents sign errors with GET requests containing unusual parameters (spaces, symbols, etc).
*/
encodeQueryStringValues?: boolean;
/**
* Optionally override API protocol + domain
* e.g baseUrl: 'https://api.bitget.com'
**/
baseUrl?: string;
/** Default: true. whether to try and post-process request exceptions (and throw them). */
parseExceptions?: boolean;
/**
* Enable keep alive for REST API requests (via axios).
*/
keepAlive?: boolean;
/**
* When using HTTP KeepAlive, how often to send TCP KeepAlive packets over sockets being kept alive. Default = 1000.
* Only relevant if keepAlive is set to true.
* Default: 1000 (defaults comes from https agent)
*/
keepAliveMsecs?: number;
/**
* Allows you to provide a custom "signMessage" function, e.g. to use node's much faster createHmac method
*
* Look in the examples folder for a demonstration on using node's createHmac instead.
*/
customSignMessageFn?: (message: string, secret: string) => Promise<string>;
}
export declare function serializeParams<T extends Record<string, any> | undefined = object>(params: T, strict_validation?: boolean, encodeValues?: boolean, prefixWith?: string): string;
export declare function getRestBaseUrl(useTestnet: boolean, restInverseOptions: RestClientOptions): string;
export declare function isWsPong(msg: any): boolean;
/**
* Used to switch how authentication/requests work under the hood (primarily for SPOT since it's different there)
*/
export declare const REST_CLIENT_TYPE_ENUM: {
readonly spot: "spot";
readonly futures: "futures";
readonly broker: "broker";
readonly v2: "v2";
readonly v3: "v3";
};