bitget-api
Version:
Complete Node.js & JavaScript SDK for Bitget V1-V3 REST APIs & WebSockets, with TypeScript & end-to-end tests.
90 lines (89 loc) • 3.25 kB
TypeScript
import { CancelOrderRequestV3 } from './types/request/v3/trade.js';
import { CancelOrderResponseV3 } from './types/response/v3/trade.js';
import { WSAPIResponse } from './types/websockets/ws-api.js';
import { WSAPIPlaceOrderRequestV3 } from './types/websockets/ws-api-request.js';
import { WSAPIPlaceOrderResponseV3 } from './types/websockets/ws-api-response.js';
import { BitgetInstTypeV3, WSClientConfigurableOptions } from './types/websockets/ws-general.js';
import { DefaultLogger } from './util/logger.js';
import { WebsocketClientV3 } from './websocket-client-v3.js';
/**
* Configurable options specific to only the REST-like WebsocketAPIClient
*/
export interface WSAPIClientConfigurableOptions {
/**
* Default: true
*
* Attach default event listeners, which will console log any high level
* events (opened/reconnecting/reconnected/etc).
*
* If you disable this, you should set your own event listeners
* on the embedded WS Client `wsApiClient.getWSClient().on(....)`.
*/
attachEventListeners: boolean;
}
/**
* This is a minimal Websocket API wrapper around the WebsocketClient.
*
* Note: You can also directly use the sendWSAPIRequest() method to make WS API calls, but some
* may find the below methods slightly more intuitive.
*
* Refer to the WS API promises example for a more detailed example on using sendWSAPIRequest() directly:
* https://github.com/tiagosiebler/bitget-api/blob/master/examples/V3/ws-api-trade-raw.ts
*/
export declare class WebsocketAPIClient {
private wsClient;
private options;
constructor(options?: WSClientConfigurableOptions & Partial<WSAPIClientConfigurableOptions>, logger?: DefaultLogger);
getWSClient(): WebsocketClientV3;
setTimeOffsetMs(newOffset: number): void;
/**
* Submit a new order
*
* https://www.bitget.com/api-doc/uta/websocket/private/Place-Order-Channel
*
* @returns
*/
submitNewOrder(category: BitgetInstTypeV3, params: WSAPIPlaceOrderRequestV3): Promise<WSAPIResponse<[WSAPIPlaceOrderResponseV3], 'place-order'>>;
/**
* Submit a new order
*
* https://www.bitget.com/api-doc/uta/websocket/private/Batch-Place-Order-Channel
*
* @returns
*/
placeBatchOrders(category: BitgetInstTypeV3, params: WSAPIPlaceOrderRequestV3[]): Promise<WSAPIResponse<WSAPIPlaceOrderResponseV3[], 'batch-place'>>;
/**
* Cancel Order
*
* https://www.bitget.com/api-doc/uta/websocket/private/Cancel-Order-Channel
*
* @returns
*/
cancelOrder(category: BitgetInstTypeV3, params: CancelOrderRequestV3): Promise<WSAPIResponse<[CancelOrderResponseV3], 'cancel-order'>>;
/**
* Batch Cancel Order
*
* https://www.bitget.com/api-doc/uta/websocket/private/Batch-Cancel-Order-Channel
*
* @returns
*/
cancelBatchOrders(category: BitgetInstTypeV3, params: CancelOrderRequestV3[]): Promise<WSAPIResponse<CancelOrderResponseV3[], 'batch-cancel'>>;
/**
*
*
*
*
*
*
*
* Private methods for handling some of the convenience/automation provided by the WS API Client
*
*
*
*
*
*
*
*/
private setupDefaultEventListeners;
}