bybit-api 2.3.2 → 2.4.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/README.md +74 -153
  2. package/lib/account-asset-client.d.ts +42 -0
  3. package/lib/account-asset-client.js +104 -0
  4. package/lib/account-asset-client.js.map +1 -0
  5. package/lib/constants/enum.d.ts +18 -0
  6. package/lib/constants/enum.js +18 -0
  7. package/lib/constants/enum.js.map +1 -1
  8. package/lib/copy-trading-client.d.ts +54 -0
  9. package/lib/copy-trading-client.js +112 -0
  10. package/lib/copy-trading-client.js.map +1 -0
  11. package/lib/index.d.ts +8 -2
  12. package/lib/index.js +8 -2
  13. package/lib/index.js.map +1 -1
  14. package/lib/inverse-client.d.ts +5 -13
  15. package/lib/inverse-client.js +6 -13
  16. package/lib/inverse-client.js.map +1 -1
  17. package/lib/inverse-futures-client.d.ts +4 -12
  18. package/lib/inverse-futures-client.js +5 -12
  19. package/lib/inverse-futures-client.js.map +1 -1
  20. package/lib/linear-client.d.ts +4 -12
  21. package/lib/linear-client.js +5 -12
  22. package/lib/linear-client.js.map +1 -1
  23. package/lib/spot-client-v3.d.ts +105 -0
  24. package/lib/spot-client-v3.js +222 -0
  25. package/lib/spot-client-v3.js.map +1 -0
  26. package/lib/spot-client.d.ts +5 -12
  27. package/lib/spot-client.js +6 -12
  28. package/lib/spot-client.js.map +1 -1
  29. package/lib/types/index.d.ts +1 -1
  30. package/lib/types/index.js +1 -1
  31. package/lib/types/index.js.map +1 -1
  32. package/lib/types/request/account-asset.d.ts +76 -0
  33. package/lib/types/request/account-asset.js +3 -0
  34. package/lib/types/request/account-asset.js.map +1 -0
  35. package/lib/types/request/copy-trading.d.ts +47 -0
  36. package/lib/types/request/copy-trading.js +3 -0
  37. package/lib/types/request/copy-trading.js.map +1 -0
  38. package/lib/types/request/index.d.ts +7 -0
  39. package/lib/types/request/index.js +7 -0
  40. package/lib/types/request/index.js.map +1 -1
  41. package/lib/types/request/spot.d.ts +72 -0
  42. package/lib/types/{spot.js → request/spot.js} +0 -0
  43. package/lib/types/{spot.js.map → request/spot.js.map} +1 -1
  44. package/lib/types/request/unified-margin.d.ts +223 -0
  45. package/lib/types/request/unified-margin.js +3 -0
  46. package/lib/types/request/unified-margin.js.map +1 -0
  47. package/lib/types/request/usdc-options.d.ts +119 -0
  48. package/lib/types/request/usdc-options.js +3 -0
  49. package/lib/types/request/usdc-options.js.map +1 -0
  50. package/lib/types/request/usdc-perp.d.ts +86 -0
  51. package/lib/types/request/usdc-perp.js +3 -0
  52. package/lib/types/request/usdc-perp.js.map +1 -0
  53. package/lib/types/request/usdc-shared.d.ts +29 -0
  54. package/lib/types/request/usdc-shared.js +3 -0
  55. package/lib/types/request/usdc-shared.js.map +1 -0
  56. package/lib/types/shared.d.ts +18 -5
  57. package/lib/types/websockets.d.ts +41 -0
  58. package/lib/types/websockets.js +3 -0
  59. package/lib/types/websockets.js.map +1 -0
  60. package/lib/unified-margin-client.d.ts +137 -0
  61. package/lib/unified-margin-client.js +269 -0
  62. package/lib/unified-margin-client.js.map +1 -0
  63. package/lib/usdc-option-client.d.ts +100 -0
  64. package/lib/usdc-option-client.js +186 -0
  65. package/lib/usdc-option-client.js.map +1 -0
  66. package/lib/usdc-perpetual-client.d.ts +88 -0
  67. package/lib/usdc-perpetual-client.js +181 -0
  68. package/lib/usdc-perpetual-client.js.map +1 -0
  69. package/lib/util/BaseRestClient.d.ts +15 -2
  70. package/lib/util/BaseRestClient.js +93 -29
  71. package/lib/util/BaseRestClient.js.map +1 -1
  72. package/lib/util/WsStore.d.ts +40 -17
  73. package/lib/util/WsStore.js +12 -3
  74. package/lib/util/WsStore.js.map +1 -1
  75. package/lib/util/index.d.ts +5 -0
  76. package/lib/util/index.js +18 -0
  77. package/lib/util/index.js.map +1 -0
  78. package/lib/{logger.d.ts → util/logger.d.ts} +0 -0
  79. package/lib/{logger.js → util/logger.js} +0 -0
  80. package/lib/util/logger.js.map +1 -0
  81. package/lib/util/node-support.d.ts +1 -0
  82. package/lib/util/node-support.js +1 -0
  83. package/lib/util/node-support.js.map +1 -1
  84. package/lib/util/requestUtils.d.ts +6 -2
  85. package/lib/util/requestUtils.js +20 -25
  86. package/lib/util/requestUtils.js.map +1 -1
  87. package/lib/util/websocket-util.d.ts +34 -0
  88. package/lib/util/websocket-util.js +194 -0
  89. package/lib/util/websocket-util.js.map +1 -0
  90. package/lib/websocket-client.d.ts +56 -82
  91. package/lib/websocket-client.js +308 -264
  92. package/lib/websocket-client.js.map +1 -1
  93. package/package.json +1 -1
  94. package/lib/logger.js.map +0 -1
  95. package/lib/types/spot.d.ts +0 -30
@@ -0,0 +1,223 @@
1
+ import { KlineIntervalV3, OrderSide } from '../shared';
2
+ import { USDCOrderFilter, USDCTimeInForce } from './usdc-shared';
3
+ export declare type UMCategory = 'linear' | 'inverse' | 'option';
4
+ export declare type UMOrderType = 'Limit' | 'Market';
5
+ export declare type UMDirection = 'prev' | 'next';
6
+ export interface UMCandlesRequest {
7
+ category: UMCategory;
8
+ symbol: string;
9
+ interval: KlineIntervalV3;
10
+ start: number;
11
+ end: number;
12
+ limit?: number;
13
+ }
14
+ export interface UMInstrumentInfoRequest {
15
+ category: UMCategory;
16
+ symbol?: string;
17
+ baseCoin?: string;
18
+ limit?: string;
19
+ cursor?: string;
20
+ }
21
+ export interface UMFundingRateHistoryRequest {
22
+ category: UMCategory;
23
+ symbol: string;
24
+ startTime?: number;
25
+ endTime?: number;
26
+ limit?: number;
27
+ }
28
+ export interface UMOptionDeliveryPriceRequest {
29
+ category: UMCategory;
30
+ symbol?: string;
31
+ baseCoin?: string;
32
+ direction?: UMDirection;
33
+ limit?: string;
34
+ cursor?: string;
35
+ }
36
+ export interface UMPublicTradesRequest {
37
+ category: UMCategory;
38
+ symbol: string;
39
+ baseCoin?: string;
40
+ optionType?: 'Call' | 'Put';
41
+ limit?: string;
42
+ }
43
+ export interface UMOpenInterestRequest {
44
+ category: UMCategory;
45
+ symbol: string;
46
+ interval: '5min' | '15min' | '30min' | '1h' | '4h' | '1d';
47
+ startTime?: number;
48
+ endTime?: number;
49
+ limit?: number;
50
+ }
51
+ export interface UMOrderRequest {
52
+ category: UMCategory;
53
+ symbol: string;
54
+ side: OrderSide;
55
+ positionIdx?: '0';
56
+ orderType: UMOrderType;
57
+ qty: string;
58
+ price?: string;
59
+ basePrice?: string;
60
+ triggerPrice?: string;
61
+ triggerBy?: string;
62
+ iv?: string;
63
+ timeInForce: USDCTimeInForce;
64
+ orderLinkId?: string;
65
+ takeProfit?: number;
66
+ stopLoss?: number;
67
+ tpTriggerBy?: string;
68
+ slTriggerBy?: string;
69
+ reduceOnly?: boolean;
70
+ closeOnTrigger?: boolean;
71
+ mmp?: boolean;
72
+ }
73
+ export interface UMModifyOrderRequest {
74
+ category: UMCategory;
75
+ symbol: string;
76
+ orderId?: string;
77
+ orderLinkId?: string;
78
+ iv?: string;
79
+ triggerPrice?: string;
80
+ qty?: string;
81
+ price?: string;
82
+ takeProfit?: number;
83
+ stopLoss?: number;
84
+ tpTriggerBy?: string;
85
+ slTriggerBy?: string;
86
+ triggerBy?: string;
87
+ }
88
+ export interface UMCancelOrderRequest {
89
+ category: UMCategory;
90
+ symbol: string;
91
+ orderId?: string;
92
+ orderLinkId?: string;
93
+ orderFilter?: USDCOrderFilter;
94
+ }
95
+ export interface UMActiveOrdersRequest {
96
+ category: UMCategory;
97
+ symbol?: string;
98
+ baseCoin?: string;
99
+ orderId?: string;
100
+ orderLinkId?: string;
101
+ orderFilter?: USDCOrderFilter;
102
+ direction?: UMDirection;
103
+ limit?: number;
104
+ cursor?: string;
105
+ }
106
+ export interface UMHistoricOrdersRequest {
107
+ category: UMCategory;
108
+ symbol?: string;
109
+ baseCoin?: string;
110
+ orderId?: string;
111
+ orderLinkId?: string;
112
+ orderStatus?: string;
113
+ orderFilter?: USDCOrderFilter;
114
+ direction?: UMDirection;
115
+ limit?: number;
116
+ cursor?: string;
117
+ }
118
+ export interface UMBatchOrder {
119
+ symbol: string;
120
+ side: OrderSide;
121
+ positionIdx?: '0';
122
+ orderType: UMOrderType;
123
+ qty: string;
124
+ price?: string;
125
+ iv?: string;
126
+ timeInForce: USDCTimeInForce;
127
+ orderLinkId?: string;
128
+ reduceOnly?: boolean;
129
+ closeOnTrigger?: boolean;
130
+ mmp?: boolean;
131
+ }
132
+ export interface UMBatchOrderReplace {
133
+ symbol: string;
134
+ orderId?: string;
135
+ orderLinkId?: string;
136
+ iv?: string;
137
+ qty?: string;
138
+ price?: string;
139
+ }
140
+ export interface UMBatchOrderCancel {
141
+ symbol: string;
142
+ orderId?: string;
143
+ orderLinkId?: string;
144
+ }
145
+ export interface UMCancelAllOrdersRequest {
146
+ category: UMCategory;
147
+ baseCoin?: string;
148
+ settleCoin?: string;
149
+ symbol?: string;
150
+ orderFilter?: USDCOrderFilter;
151
+ }
152
+ export interface UMPositionsRequest {
153
+ category: UMCategory;
154
+ symbol?: string;
155
+ baseCoin?: string;
156
+ direction?: UMDirection;
157
+ limit?: number;
158
+ cursor?: string;
159
+ }
160
+ export interface UMSetTPSLRequest {
161
+ category: UMCategory;
162
+ symbol: string;
163
+ takeProfit?: string;
164
+ stopLoss?: string;
165
+ trailingStop?: string;
166
+ tpTriggerBy?: string;
167
+ slTriggerBy?: string;
168
+ activePrice?: string;
169
+ slSize?: string;
170
+ tpSize?: string;
171
+ positionIdx?: '0';
172
+ }
173
+ export interface UM7DayTradingHistoryRequest {
174
+ category: UMCategory;
175
+ symbol: string;
176
+ baseCoin?: string;
177
+ orderId?: string;
178
+ orderLinkId?: string;
179
+ startTime?: number;
180
+ endTime?: number;
181
+ direction?: UMDirection;
182
+ limit?: number;
183
+ cursor?: string;
184
+ execType?: string;
185
+ }
186
+ export interface UMOptionsSettlementHistoryRequest {
187
+ category: UMCategory;
188
+ symbol?: string;
189
+ expDate?: string;
190
+ direction?: UMDirection;
191
+ limit?: number;
192
+ cursor?: string;
193
+ }
194
+ export interface UMPerpSettlementHistoryRequest {
195
+ category: UMCategory;
196
+ symbol?: string;
197
+ direction?: UMDirection;
198
+ limit?: number;
199
+ cursor?: string;
200
+ }
201
+ export interface UMTransactionLogRequest {
202
+ category: UMCategory;
203
+ currency: string;
204
+ baseCoin?: string;
205
+ type?: string;
206
+ startTime?: number;
207
+ endTime?: number;
208
+ direction?: UMDirection;
209
+ limit?: number;
210
+ cursor?: string;
211
+ }
212
+ export interface UMExchangeCoinsRequest {
213
+ fromCoin?: string;
214
+ toCoin?: string;
215
+ }
216
+ export interface UMBorrowHistoryRequest {
217
+ currency: string;
218
+ startTime?: number;
219
+ endTime?: number;
220
+ direction?: UMDirection;
221
+ limit?: number;
222
+ cursor?: string;
223
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=unified-margin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unified-margin.js","sourceRoot":"","sources":["../../../src/types/request/unified-margin.ts"],"names":[],"mappings":""}
@@ -0,0 +1,119 @@
1
+ import { OrderSide } from '../shared';
2
+ import { USDCAPICategory, USDCOrderType, USDCTimeInForce } from './usdc-shared';
3
+ export interface USDCOptionsContractInfoRequest {
4
+ symbol?: string;
5
+ status?: 'WAITING_ONLINE' | 'ONLINE' | 'DELIVERING' | 'OFFLINE';
6
+ baseCoin?: string;
7
+ direction?: string;
8
+ limit?: string;
9
+ cursor?: string;
10
+ }
11
+ export interface USDCOptionsDeliveryPriceRequest {
12
+ symbol?: string;
13
+ baseCoin?: string;
14
+ direction?: string;
15
+ limit?: string;
16
+ cursor?: string;
17
+ }
18
+ export interface USDCOptionsRecentTradesRequest {
19
+ category: USDCAPICategory;
20
+ symbol?: string;
21
+ baseCoin?: string;
22
+ optionType?: 'Call' | 'Put';
23
+ limit?: string;
24
+ }
25
+ export interface USDCOptionsHistoricalVolatilityRequest {
26
+ baseCoin?: string;
27
+ period?: string;
28
+ startTime?: string;
29
+ endTime?: string;
30
+ }
31
+ export interface USDCOptionsOrderRequest {
32
+ symbol: string;
33
+ orderType: USDCOrderType;
34
+ side: OrderSide;
35
+ orderPrice?: string;
36
+ orderQty: string;
37
+ iv?: string;
38
+ timeInForce?: USDCTimeInForce;
39
+ orderLinkId?: string;
40
+ reduceOnly?: boolean;
41
+ }
42
+ export interface USDCOptionsModifyOrderRequest {
43
+ symbol: string;
44
+ orderId?: string;
45
+ orderLinkId?: string;
46
+ orderPrice?: string;
47
+ orderQty?: string;
48
+ iv?: string;
49
+ }
50
+ export interface USDCOptionsCancelOrderRequest {
51
+ symbol: string;
52
+ orderId?: string;
53
+ orderLinkId?: string;
54
+ }
55
+ export interface USDCOptionsCancelAllOrdersRequest {
56
+ symbol?: string;
57
+ baseCoin?: string;
58
+ }
59
+ export interface USDCOptionsActiveOrdersRealtimeRequest {
60
+ orderId?: string;
61
+ orderLinkId?: string;
62
+ symbol?: string;
63
+ baseCoin?: string;
64
+ direction?: string;
65
+ limit?: number;
66
+ cursor?: string;
67
+ }
68
+ export interface USDCOptionsActiveOrdersRequest {
69
+ category: 'OPTION';
70
+ symbol?: string;
71
+ baseCoin?: string;
72
+ orderId?: string;
73
+ orderLinkId?: string;
74
+ direction?: string;
75
+ limit?: number;
76
+ cursor?: string;
77
+ }
78
+ export interface USDCOptionsHistoricOrdersRequest {
79
+ category: 'OPTION';
80
+ symbol?: string;
81
+ baseCoin?: string;
82
+ orderId?: string;
83
+ orderLinkId?: string;
84
+ orderStatus?: string;
85
+ direction?: string;
86
+ limit?: number;
87
+ cursor?: string;
88
+ }
89
+ export interface USDCOptionsOrderExecutionRequest {
90
+ category: 'OPTION';
91
+ symbol?: string;
92
+ baseCoin?: string;
93
+ orderId?: string;
94
+ orderLinkId?: string;
95
+ startTime?: string;
96
+ direction?: string;
97
+ limit?: number;
98
+ cursor?: string;
99
+ }
100
+ export interface USDCOptionsDeliveryHistoryRequest {
101
+ symbol: string;
102
+ expDate?: string;
103
+ direction?: string;
104
+ limit?: string;
105
+ cursor?: string;
106
+ }
107
+ export interface USDCOptionsPositionsInfoExpiryRequest {
108
+ expDate?: string;
109
+ direction?: string;
110
+ limit?: string;
111
+ cursor?: string;
112
+ }
113
+ export interface USDCOptionsModifyMMPRequest {
114
+ currency: string;
115
+ windowMs: number;
116
+ frozenPeriodMs: number;
117
+ qtyLimit: string;
118
+ deltaLimit: string;
119
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=usdc-options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usdc-options.js","sourceRoot":"","sources":["../../../src/types/request/usdc-options.ts"],"names":[],"mappings":""}
@@ -0,0 +1,86 @@
1
+ import { OrderSide } from '../shared';
2
+ import { USDCAPICategory, USDCOrderFilter, USDCOrderType, USDCTimeInForce } from './usdc-shared';
3
+ export interface USDCOpenInterestRequest {
4
+ symbol: string;
5
+ period: string;
6
+ limit?: number;
7
+ }
8
+ export interface USDCLast500TradesRequest {
9
+ category: USDCAPICategory;
10
+ symbol?: string;
11
+ baseCoin?: string;
12
+ limit?: string;
13
+ }
14
+ export interface USDCSymbolDirectionLimit {
15
+ symbol?: string;
16
+ direction?: string;
17
+ limit?: string;
18
+ }
19
+ export interface USDCSymbolDirectionLimitCursor {
20
+ symbol?: string;
21
+ direction?: string;
22
+ limit?: string;
23
+ cursor?: string;
24
+ }
25
+ export interface USDCPerpOrderRequest {
26
+ symbol: string;
27
+ orderType: USDCOrderType;
28
+ orderFilter: USDCOrderFilter;
29
+ side: OrderSide;
30
+ orderPrice?: string;
31
+ orderQty: string;
32
+ timeInForce?: USDCTimeInForce;
33
+ orderLinkId?: string;
34
+ reduceOnly?: boolean;
35
+ closeOnTrigger?: boolean;
36
+ takeProfit?: string;
37
+ stopLoss?: string;
38
+ tptriggerby?: string;
39
+ slTriggerBy?: string;
40
+ basePrice?: string;
41
+ triggerPrice?: string;
42
+ triggerBy?: string;
43
+ mmp?: boolean;
44
+ }
45
+ export interface USDCPerpModifyOrderRequest {
46
+ symbol: string;
47
+ orderFilter: USDCOrderFilter;
48
+ orderId?: string;
49
+ orderLinkId?: string;
50
+ orderPrice?: string;
51
+ orderQty?: string;
52
+ takeProfit?: string;
53
+ stopLoss?: string;
54
+ tptriggerby?: string;
55
+ slTriggerBy?: string;
56
+ triggerPrice?: string;
57
+ }
58
+ export interface USDCPerpCancelOrderRequest {
59
+ symbol: string;
60
+ orderFilter: USDCOrderFilter;
61
+ orderId?: string;
62
+ orderLinkId?: string;
63
+ }
64
+ export interface USDCPerpActiveOrdersRequest {
65
+ category: 'PERPETUAL';
66
+ symbol?: string;
67
+ baseCoin?: string;
68
+ orderId?: string;
69
+ orderLinkId?: string;
70
+ orderFilter?: USDCOrderFilter;
71
+ direction?: string;
72
+ limit?: number;
73
+ cursor?: string;
74
+ }
75
+ export interface USDCPerpHistoricOrdersRequest {
76
+ category: 'PERPETUAL';
77
+ symbol?: string;
78
+ baseCoin?: string;
79
+ orderId?: string;
80
+ orderLinkId?: string;
81
+ orderStatus?: string;
82
+ orderFilter?: USDCOrderFilter;
83
+ direction?: string;
84
+ limit?: number;
85
+ cursor?: string;
86
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=usdc-perp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usdc-perp.js","sourceRoot":"","sources":["../../../src/types/request/usdc-perp.ts"],"names":[],"mappings":""}
@@ -0,0 +1,29 @@
1
+ export declare type USDCAPICategory = 'PERPETUAL' | 'OPTION';
2
+ export declare type USDCOrderType = 'Limit' | 'Market';
3
+ export declare type USDCTimeInForce = 'GoodTillCancel' | 'ImmediateOrCancel' | 'FillOrKill' | 'PostOnly';
4
+ export declare type USDCOrderFilter = 'Order' | 'StopOrder';
5
+ export interface USDCKlineRequest {
6
+ symbol: string;
7
+ period: string;
8
+ startTime: number;
9
+ limit?: string;
10
+ }
11
+ export interface USDCTransactionLogRequest {
12
+ type: string;
13
+ baseCoin?: string;
14
+ startTime?: string;
15
+ endTime?: string;
16
+ direction?: string;
17
+ limit?: string;
18
+ cursor?: string;
19
+ category?: USDCAPICategory;
20
+ }
21
+ export interface USDCPositionsRequest {
22
+ category: USDCAPICategory;
23
+ symbol?: string;
24
+ baseCoin?: string;
25
+ expDate?: string;
26
+ direction?: string;
27
+ limit?: string;
28
+ cursor?: string;
29
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=usdc-shared.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usdc-shared.js","sourceRoot":"","sources":["../../../src/types/request/usdc-shared.ts"],"names":[],"mappings":""}
@@ -1,6 +1,14 @@
1
+ import { InverseClient } from '../inverse-client';
2
+ import { LinearClient } from '../linear-client';
3
+ import { SpotClient } from '../spot-client';
4
+ import { SpotClientV3 } from '../spot-client-v3';
5
+ import { USDCOptionClient } from '../usdc-option-client';
6
+ import { USDCPerpetualClient } from '../usdc-perpetual-client';
7
+ export declare type RESTClient = InverseClient | LinearClient | SpotClient | SpotClientV3 | USDCOptionClient | USDCPerpetualClient;
1
8
  export declare type numberInString = string;
2
9
  export declare type OrderSide = 'Buy' | 'Sell';
3
10
  export declare type KlineInterval = '1m' | '3m' | '5m' | '15m' | '30m' | '1h' | '2h' | '4h' | '6h' | '12h' | '1d' | '1w' | '1M';
11
+ export declare type KlineIntervalV3 = '1' | '3' | '5' | '15' | '30' | '60' | '120' | '240' | '360' | '720' | 'D' | 'W' | 'M';
4
12
  export interface APIResponse<T> {
5
13
  ret_code: number;
6
14
  ret_msg: 'OK' | string;
@@ -8,7 +16,12 @@ export interface APIResponse<T> {
8
16
  ext_info: string | null;
9
17
  result: T;
10
18
  }
11
- export interface APIResponseWithTime<T> extends APIResponse<T> {
19
+ export interface APIResponseV3<T> {
20
+ retCode: number;
21
+ retMsg: 'OK' | string;
22
+ result: T;
23
+ }
24
+ export interface APIResponseWithTime<T = {}> extends APIResponse<T> {
12
25
  /** UTC timestamp */
13
26
  time_now: numberInString;
14
27
  }
@@ -18,14 +31,14 @@ export interface APIResponseWithTime<T> extends APIResponse<T> {
18
31
  export interface SymbolParam {
19
32
  symbol: string;
20
33
  }
21
- export interface SymbolLimitParam {
34
+ export interface SymbolLimitParam<TLimit = number> {
22
35
  symbol: string;
23
- limit?: number;
36
+ limit?: TLimit;
24
37
  }
25
- export interface SymbolPeriodLimitParam {
38
+ export interface SymbolPeriodLimitParam<TLimit = number> {
26
39
  symbol: string;
27
40
  period: string;
28
- limit?: number;
41
+ limit?: TLimit;
29
42
  }
30
43
  export interface SymbolFromLimitParam {
31
44
  symbol: string;
@@ -0,0 +1,41 @@
1
+ import { RestClientOptions, WS_KEY_MAP } from '../util';
2
+ /** For spot markets, spotV3 is recommended */
3
+ export declare type APIMarket = 'inverse' | 'linear' | 'spot' | 'spotv3' | 'usdcOption' | 'usdcPerp';
4
+ export declare type WsPublicInverseTopic = 'orderBookL2_25' | 'orderBookL2_200' | 'trade' | 'insurance' | 'instrument_info' | 'klineV2';
5
+ export declare type WsPublicUSDTPerpTopic = 'orderBookL2_25' | 'orderBookL2_200' | 'trade' | 'insurance' | 'instrument_info' | 'kline';
6
+ export declare type WsPublicSpotV1Topic = 'trade' | 'realtimes' | 'kline' | 'depth' | 'mergedDepth' | 'diffDepth';
7
+ export declare type WsPublicSpotV2Topic = 'depth' | 'kline' | 'trade' | 'bookTicker' | 'realtimes';
8
+ export declare type WsPublicTopics = WsPublicInverseTopic | WsPublicUSDTPerpTopic | WsPublicSpotV1Topic | WsPublicSpotV2Topic | string;
9
+ export declare type WsPrivateInverseTopic = 'position' | 'execution' | 'order' | 'stop_order';
10
+ export declare type WsPrivateUSDTPerpTopic = 'position' | 'execution' | 'order' | 'stop_order' | 'wallet';
11
+ export declare type WsPrivateSpotTopic = 'outboundAccountInfo' | 'executionReport' | 'ticketInfo';
12
+ export declare type WsPrivateTopic = WsPrivateInverseTopic | WsPrivateUSDTPerpTopic | WsPrivateSpotTopic | string;
13
+ export declare type WsTopic = WsPublicTopics | WsPrivateTopic;
14
+ /** This is used to differentiate between each of the available websocket streams (as bybit has multiple websockets) */
15
+ export declare type WsKey = typeof WS_KEY_MAP[keyof typeof WS_KEY_MAP];
16
+ export interface WSClientConfigurableOptions {
17
+ key?: string;
18
+ secret?: string;
19
+ testnet?: boolean;
20
+ /**
21
+ * The API group this client should connect to.
22
+ *
23
+ * For the V3 APIs use `v3` as the market (spot/unified margin/usdc/account asset/copy trading)
24
+ */
25
+ market: APIMarket;
26
+ pongTimeout?: number;
27
+ pingInterval?: number;
28
+ reconnectTimeout?: number;
29
+ restOptions?: RestClientOptions;
30
+ requestOptions?: any;
31
+ wsUrl?: string;
32
+ /** If true, fetch server time before trying to authenticate (disabled by default) */
33
+ fetchTimeOffsetBeforeAuth?: boolean;
34
+ }
35
+ export interface WebsocketClientOptions extends WSClientConfigurableOptions {
36
+ testnet?: boolean;
37
+ market: APIMarket;
38
+ pongTimeout: number;
39
+ pingInterval: number;
40
+ reconnectTimeout: number;
41
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=websockets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"websockets.js","sourceRoot":"","sources":["../../src/types/websockets.ts"],"names":[],"mappings":""}