kucoin-api
Version:
Complete & robust Node.js SDK for Kucoin's REST APIs and WebSockets, with TypeScript & strong end to end tests.
78 lines (77 loc) • 3.71 kB
TypeScript
/**
* Used to switch how authentication/requests work under the hood
*/
export declare const REST_CLIENT_TYPE_ENUM: {
/** Global & AU: Spot & Margin */
readonly main: "main";
/** Global & AU: Futures */
readonly futures: "futures";
/** Global: Broker */
readonly broker: "broker";
/** Global: Unified Trading Account */
readonly unifiedTradingAccount: "unifiedTradingAccount";
/** Dedicated EU: main (Spot & Margin). No futures at this time. */
readonly mainEU: "mainEU";
};
export type RestClientType = (typeof REST_CLIENT_TYPE_ENUM)[keyof typeof REST_CLIENT_TYPE_ENUM];
export type APIRegion = 'global' | 'EU' | 'AU';
export interface RestClientOptions {
/** Your API key */
apiKey?: string;
/** Your API secret */
apiSecret?: string;
/** Your API passphrase (can be anything) that you set when creating this API key (NOT your account password) */
apiPassphrase?: string;
/**
* Use access token instead of sign, if this is provided.
* For guidance refer to: https://github.com/tiagosiebler/kucoin-api/issues/2
*/
apiAccessToken?: string;
/** The API key version. Defaults to "2" right now. You can see this in your API management page */
apiKeyVersion?: number | string;
/**
* The API region you would like to work with:
* - Global (default)
* - API Docs: https://www.kucoin.com/docs-new/introduction
* - EU:
* - API Docs: https://www.kucoin.com/en-eu/docs-new/introduction/eu
* - Behaves the same as global, but keep in mind that futures may not be available at this time for EU users.
* - AU:
* - API Docs: https://www.kucoin.com/en-au/docs-new/introduction/au
* - Ensures regional market data is retrieved (e.g. correct trading pairs, correct tickers, etc).
* - Also ensures requests for AU users include the required extra header (X-SITE-TYPE: australia).
*/
apiRegion?: APIRegion;
/** Default: false. If true, we'll throw errors if any params are undefined */
strictParamValidation?: boolean;
/**
* Optionally override API protocol + domain. This will override any domain influence from the apiRegion parameter.
* e.g baseUrl: 'https://api.kucoin.com'
**/
baseUrl?: string;
/** Default: true. whether to try and post-process request exceptions (and throw them). */
parseExceptions?: boolean;
customTimestampFn?: () => number;
/**
* 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 = {}>(params: T, strict_validation: boolean | undefined, encodeValues: boolean, prefixWith: string): string;
export declare const APIIDMain = "NODESDK";
export declare const APIIDMainSign = "d28f5b4a-179d-4fcb-9c00-c8319c0bb82c";
export declare const APIIDFutures = "NODESDKFUTURES";
export declare const APIIDFuturesSign = "7f7fb0d6-e600-4ef4-8fe3-41e6aea9af84";
export declare function getRestBaseUrl(useTestnet: boolean, restOptions: RestClientOptions, restClientType: RestClientType): string;