v2.4.0-beta.1. remove circleci, cleaning in ws client

This commit is contained in:
tiagosiebler
2022-09-14 23:12:44 +01:00
parent 04fd7989dc
commit d1ed7971ad
9 changed files with 296 additions and 264 deletions

View File

@@ -1,3 +1,4 @@
export * from './response';
export * from './request';
export * from './shared';
export * from './websockets';

View File

@@ -1,3 +1,14 @@
import { InverseClient } from '../inverse-client';
import { LinearClient } from '../linear-client';
import { SpotClient } from '../spot-client';
import { SpotClientV3 } from '../spot-client-v3';
export type RESTClient =
| InverseClient
| LinearClient
| SpotClient
| SpotClientV3;
export type numberInString = string;
export type OrderSide = 'Buy' | 'Sell';

107
src/types/websockets.ts Normal file
View 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;
}