v2.4.0-beta.1. remove circleci, cleaning in ws client
This commit is contained in:
107
src/types/websockets.ts
Normal file
107
src/types/websockets.ts
Normal file
@@ -0,0 +1,107 @@
|
||||
import { RestClientOptions } from '../util';
|
||||
|
||||
export type APIMarket = 'inverse' | 'linear' | 'spot' | 'v3';
|
||||
|
||||
// Same as inverse futures
|
||||
export type WsPublicInverseTopic =
|
||||
| 'orderBookL2_25'
|
||||
| 'orderBookL2_200'
|
||||
| 'trade'
|
||||
| 'insurance'
|
||||
| 'instrument_info'
|
||||
| 'klineV2';
|
||||
|
||||
export type WsPublicUSDTPerpTopic =
|
||||
| 'orderBookL2_25'
|
||||
| 'orderBookL2_200'
|
||||
| 'trade'
|
||||
| 'insurance'
|
||||
| 'instrument_info'
|
||||
| 'kline';
|
||||
|
||||
export type WsPublicSpotV1Topic =
|
||||
| 'trade'
|
||||
| 'realtimes'
|
||||
| 'kline'
|
||||
| 'depth'
|
||||
| 'mergedDepth'
|
||||
| 'diffDepth';
|
||||
|
||||
export type WsPublicSpotV2Topic =
|
||||
| 'depth'
|
||||
| 'kline'
|
||||
| 'trade'
|
||||
| 'bookTicker'
|
||||
| 'realtimes';
|
||||
|
||||
export type WsPublicTopics =
|
||||
| WsPublicInverseTopic
|
||||
| WsPublicUSDTPerpTopic
|
||||
| WsPublicSpotV1Topic
|
||||
| WsPublicSpotV2Topic
|
||||
| string;
|
||||
|
||||
// Same as inverse futures
|
||||
export type WsPrivateInverseTopic =
|
||||
| 'position'
|
||||
| 'execution'
|
||||
| 'order'
|
||||
| 'stop_order';
|
||||
|
||||
export type WsPrivateUSDTPerpTopic =
|
||||
| 'position'
|
||||
| 'execution'
|
||||
| 'order'
|
||||
| 'stop_order'
|
||||
| 'wallet';
|
||||
|
||||
export type WsPrivateSpotTopic =
|
||||
| 'outboundAccountInfo'
|
||||
| 'executionReport'
|
||||
| 'ticketInfo';
|
||||
|
||||
export type WsPrivateTopic =
|
||||
| WsPrivateInverseTopic
|
||||
| WsPrivateUSDTPerpTopic
|
||||
| WsPrivateSpotTopic
|
||||
| string;
|
||||
|
||||
export type WsTopic = WsPublicTopics | WsPrivateTopic;
|
||||
|
||||
/** This is used to differentiate between each of the available websocket streams (as bybit has multiple websockets) */
|
||||
export type WsKey =
|
||||
| 'inverse'
|
||||
| 'linearPrivate'
|
||||
| 'linearPublic'
|
||||
| 'spotPrivate'
|
||||
| 'spotPublic';
|
||||
|
||||
export interface WSClientConfigurableOptions {
|
||||
key?: string;
|
||||
secret?: string;
|
||||
livenet?: boolean;
|
||||
|
||||
/**
|
||||
* The API group this client should connect to.
|
||||
*
|
||||
* For the V3 APIs use `v3` as the market (spot/unified margin/usdc/account asset/copy trading)
|
||||
*/
|
||||
market: APIMarket;
|
||||
|
||||
pongTimeout?: number;
|
||||
pingInterval?: number;
|
||||
reconnectTimeout?: number;
|
||||
restOptions?: RestClientOptions;
|
||||
requestOptions?: any;
|
||||
wsUrl?: string;
|
||||
/** If true, fetch server time before trying to authenticate (disabled by default) */
|
||||
fetchTimeOffsetBeforeAuth?: boolean;
|
||||
}
|
||||
|
||||
export interface WebsocketClientOptions extends WSClientConfigurableOptions {
|
||||
livenet: boolean;
|
||||
market: APIMarket;
|
||||
pongTimeout: number;
|
||||
pingInterval: number;
|
||||
reconnectTimeout: number;
|
||||
}
|
||||
Reference in New Issue
Block a user