bybit-api 3.7.1-beta.0 → 3.7.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 (73) hide show
  1. package/README.md +34 -6
  2. package/lib/constants/enum.d.ts +4 -1
  3. package/lib/constants/enum.js +4 -1
  4. package/lib/constants/enum.js.map +1 -1
  5. package/lib/rest-client-v5.d.ts +3 -3
  6. package/lib/rest-client-v5.js.map +1 -1
  7. package/lib/types/request/v5-trade.d.ts +2 -2
  8. package/lib/types/response/v5-market.d.ts +4 -1
  9. package/package.json +1 -13
  10. package/src/account-asset-client-v3.ts +0 -310
  11. package/src/account-asset-client.ts +0 -149
  12. package/src/constants/enum.ts +0 -105
  13. package/src/contract-client.ts +0 -360
  14. package/src/copy-trading-client.ts +0 -159
  15. package/src/index.ts +0 -18
  16. package/src/inverse-client.ts +0 -337
  17. package/src/inverse-futures-client.ts +0 -403
  18. package/src/linear-client.ts +0 -387
  19. package/src/rest-client-v5.ts +0 -1638
  20. package/src/spot-client-v3.ts +0 -303
  21. package/src/spot-client.ts +0 -180
  22. package/src/types/index.ts +0 -5
  23. package/src/types/request/account-asset.ts +0 -258
  24. package/src/types/request/contract.ts +0 -139
  25. package/src/types/request/copy-trading.ts +0 -53
  26. package/src/types/request/index.ts +0 -18
  27. package/src/types/request/inverse.ts +0 -135
  28. package/src/types/request/linear.ts +0 -201
  29. package/src/types/request/spot.ts +0 -89
  30. package/src/types/request/unified-margin.ts +0 -247
  31. package/src/types/request/usdc-options.ts +0 -134
  32. package/src/types/request/usdc-perp.ts +0 -100
  33. package/src/types/request/usdc-shared.ts +0 -39
  34. package/src/types/request/v5-account.ts +0 -40
  35. package/src/types/request/v5-asset.ts +0 -133
  36. package/src/types/request/v5-market.ts +0 -127
  37. package/src/types/request/v5-position.ts +0 -107
  38. package/src/types/request/v5-pre-upgrade.ts +0 -37
  39. package/src/types/request/v5-spot-leverage-token.ts +0 -23
  40. package/src/types/request/v5-trade.ts +0 -133
  41. package/src/types/request/v5-user.ts +0 -21
  42. package/src/types/response/account-asset.ts +0 -236
  43. package/src/types/response/contract.ts +0 -74
  44. package/src/types/response/index.ts +0 -13
  45. package/src/types/response/shared.ts +0 -19
  46. package/src/types/response/spot.ts +0 -17
  47. package/src/types/response/unified-margin.ts +0 -71
  48. package/src/types/response/usdt-perp.ts +0 -58
  49. package/src/types/response/v5-account.ts +0 -122
  50. package/src/types/response/v5-asset.ts +0 -170
  51. package/src/types/response/v5-market.ts +0 -271
  52. package/src/types/response/v5-position.ts +0 -118
  53. package/src/types/response/v5-spot-leverage-token.ts +0 -70
  54. package/src/types/response/v5-trade.ts +0 -103
  55. package/src/types/response/v5-user.ts +0 -58
  56. package/src/types/shared.ts +0 -175
  57. package/src/types/v5-shared.ts +0 -213
  58. package/src/types/websockets.ts +0 -115
  59. package/src/types/ws-events/failed-topic-subscription-confirmation.ts +0 -6
  60. package/src/types/ws-events/succeeded-topic-subscription-confirmation.ts +0 -6
  61. package/src/types/ws-events/topic-subscription-confirmation.ts +0 -7
  62. package/src/unified-margin-client.ts +0 -400
  63. package/src/usdc-option-client.ts +0 -333
  64. package/src/usdc-perpetual-client.ts +0 -312
  65. package/src/util/BaseRestClient.ts +0 -502
  66. package/src/util/WsStore.ts +0 -160
  67. package/src/util/browser-support.ts +0 -29
  68. package/src/util/index.ts +0 -5
  69. package/src/util/logger.ts +0 -26
  70. package/src/util/node-support.ts +0 -9
  71. package/src/util/requestUtils.ts +0 -171
  72. package/src/util/websocket-util.ts +0 -550
  73. package/src/websocket-client.ts +0 -1262
@@ -1,403 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
- import { REST_CLIENT_TYPE_ENUM } from './util/requestUtils';
3
- import {
4
- APIResponseWithTime,
5
- AssetExchangeRecordsReq,
6
- CoinParam,
7
- SymbolInfo,
8
- SymbolIntervalFromLimitParam,
9
- SymbolLimitParam,
10
- SymbolParam,
11
- SymbolPeriodLimitParam,
12
- WalletFundRecordsReq,
13
- WithdrawRecordsReq,
14
- } from './types/shared';
15
- import BaseRestClient from './util/BaseRestClient';
16
-
17
- /**
18
- * REST API client for Inverse Futures APIs (e.g. quarterly futures) (v2)
19
- */
20
- export class InverseFuturesClient extends BaseRestClient {
21
- getClientType() {
22
- return REST_CLIENT_TYPE_ENUM.inverseFutures;
23
- }
24
-
25
- async fetchServerTime(): Promise<number> {
26
- const res = await this.getServerTime();
27
- return Number(res.time_now);
28
- }
29
-
30
- /**
31
- *
32
- * Market Data Endpoints
33
- *
34
- */
35
-
36
- getOrderBook(params: SymbolParam): Promise<APIResponseWithTime<any[]>> {
37
- return this.get('v2/public/orderBook/L2', params);
38
- }
39
-
40
- getKline(
41
- params: SymbolIntervalFromLimitParam
42
- ): Promise<APIResponseWithTime<any[]>> {
43
- return this.get('v2/public/kline/list', params);
44
- }
45
-
46
- /**
47
- * Get latest information for symbol
48
- */
49
- getTickers(
50
- params?: Partial<SymbolParam>
51
- ): Promise<APIResponseWithTime<any[]>> {
52
- return this.get('v2/public/tickers', params);
53
- }
54
-
55
- /**
56
- * Public trading records
57
- */
58
- getTrades(params: SymbolLimitParam): Promise<APIResponseWithTime<any[]>> {
59
- return this.get('v2/public/trading-records', params);
60
- }
61
-
62
- getSymbols(): Promise<APIResponseWithTime<SymbolInfo[]>> {
63
- return this.get('v2/public/symbols');
64
- }
65
-
66
- getMarkPriceKline(
67
- params: SymbolIntervalFromLimitParam
68
- ): Promise<APIResponseWithTime<any[]>> {
69
- return this.get('v2/public/mark-price-kline', params);
70
- }
71
-
72
- getIndexPriceKline(
73
- params: SymbolIntervalFromLimitParam
74
- ): Promise<APIResponseWithTime<any[]>> {
75
- return this.get('v2/public/index-price-kline', params);
76
- }
77
-
78
- getPremiumIndexKline(
79
- params: SymbolIntervalFromLimitParam
80
- ): Promise<APIResponseWithTime<any[]>> {
81
- return this.get('v2/public/premium-index-kline', params);
82
- }
83
-
84
- /**
85
- *
86
- * Market Data : Advanced
87
- *
88
- */
89
-
90
- getOpenInterest(
91
- params: SymbolPeriodLimitParam
92
- ): Promise<APIResponseWithTime<any[]>> {
93
- return this.get('v2/public/open-interest', params);
94
- }
95
-
96
- getLatestBigDeal(
97
- params: SymbolLimitParam
98
- ): Promise<APIResponseWithTime<any[]>> {
99
- return this.get('v2/public/big-deal', params);
100
- }
101
-
102
- getLongShortRatio(
103
- params: SymbolPeriodLimitParam
104
- ): Promise<APIResponseWithTime<any[]>> {
105
- return this.get('v2/public/account-ratio', params);
106
- }
107
-
108
- /**
109
- *
110
- * Account Data Endpoints
111
- *
112
- */
113
-
114
- getApiKeyInfo(): Promise<APIResponseWithTime<any>> {
115
- return this.getPrivate('v2/private/account/api-key');
116
- }
117
-
118
- /**
119
- *
120
- * Wallet Data Endpoints
121
- *
122
- */
123
-
124
- getWalletBalance(
125
- params?: Partial<CoinParam>
126
- ): Promise<APIResponseWithTime<any>> {
127
- return this.getPrivate('v2/private/wallet/balance', params);
128
- }
129
-
130
- getWalletFundRecords(
131
- params?: WalletFundRecordsReq
132
- ): Promise<APIResponseWithTime<any>> {
133
- return this.getPrivate('v2/private/wallet/fund/records', params);
134
- }
135
-
136
- getWithdrawRecords(
137
- params?: WithdrawRecordsReq
138
- ): Promise<APIResponseWithTime<any>> {
139
- return this.getPrivate('v2/private/wallet/withdraw/list', params);
140
- }
141
-
142
- getAssetExchangeRecords(
143
- params?: AssetExchangeRecordsReq
144
- ): Promise<APIResponseWithTime<any>> {
145
- return this.getPrivate('v2/private/exchange-order/list', params);
146
- }
147
-
148
- /**
149
- *
150
- * API Data Endpoints
151
- *
152
- */
153
-
154
- getServerTime(): Promise<APIResponseWithTime<{}>> {
155
- return this.get('v2/public/time');
156
- }
157
-
158
- getApiAnnouncements(): Promise<APIResponseWithTime<any>> {
159
- return this.get('v2/public/announcement');
160
- }
161
-
162
- /**
163
- *
164
- * Account Data Endpoints
165
- *
166
- */
167
-
168
- /**
169
- * Active orders
170
- */
171
-
172
- placeActiveOrder(orderRequest: {
173
- side: string;
174
- symbol: string;
175
- order_type: string;
176
- qty: number;
177
- price?: number;
178
- time_in_force: string;
179
- take_profit?: number;
180
- stop_loss?: number;
181
- reduce_only?: boolean;
182
- close_on_trigger?: boolean;
183
- order_link_id?: string;
184
- }): Promise<APIResponseWithTime<any>> {
185
- return this.postPrivate('futures/private/order/create', orderRequest);
186
- }
187
-
188
- getActiveOrderList(params: {
189
- symbol: string;
190
- order_status?: string;
191
- direction?: string;
192
- limit?: number;
193
- cursor?: string;
194
- }): Promise<APIResponseWithTime<any>> {
195
- return this.getPrivate('futures/private/order/list', params);
196
- }
197
-
198
- cancelActiveOrder(params: {
199
- symbol: string;
200
- order_id?: string;
201
- order_link_id?: string;
202
- }): Promise<APIResponseWithTime<any>> {
203
- return this.postPrivate('futures/private/order/cancel', params);
204
- }
205
-
206
- cancelAllActiveOrders(
207
- params: SymbolParam
208
- ): Promise<APIResponseWithTime<any>> {
209
- return this.postPrivate('futures/private/order/cancelAll', params);
210
- }
211
-
212
- replaceActiveOrder(params: {
213
- order_id?: string;
214
- order_link_id?: string;
215
- symbol: string;
216
- p_r_qty?: string;
217
- p_r_price?: string;
218
- }): Promise<APIResponseWithTime<any>> {
219
- return this.postPrivate('futures/private/order/replace', params);
220
- }
221
-
222
- queryActiveOrder(params: {
223
- order_id?: string;
224
- order_link_id?: string;
225
- symbol: string;
226
- }): Promise<APIResponseWithTime<any>> {
227
- return this.getPrivate('futures/private/order', params);
228
- }
229
-
230
- /**
231
- * Conditional orders
232
- */
233
-
234
- placeConditionalOrder(params: {
235
- side: string;
236
- symbol: string;
237
- order_type: string;
238
- qty: string;
239
- price?: string;
240
- base_price: string;
241
- stop_px: string;
242
- time_in_force: string;
243
- trigger_by?: string;
244
- close_on_trigger?: boolean;
245
- order_link_id?: string;
246
- }): Promise<APIResponseWithTime<any>> {
247
- return this.postPrivate('futures/private/stop-order/create', params);
248
- }
249
-
250
- getConditionalOrder(params: {
251
- symbol: string;
252
- stop_order_status?: string;
253
- direction?: string;
254
- limit?: number;
255
- cursor?: string;
256
- }): Promise<APIResponseWithTime<any>> {
257
- return this.getPrivate('futures/private/stop-order/list', params);
258
- }
259
-
260
- cancelConditionalOrder(params: {
261
- symbol: string;
262
- stop_order_id?: string;
263
- order_link_id?: string;
264
- }): Promise<APIResponseWithTime<any>> {
265
- return this.postPrivate('futures/private/stop-order/cancel', params);
266
- }
267
-
268
- cancelAllConditionalOrders(
269
- params: SymbolParam
270
- ): Promise<APIResponseWithTime<any>> {
271
- return this.postPrivate('futures/private/stop-order/cancelAll', params);
272
- }
273
-
274
- replaceConditionalOrder(params: {
275
- stop_order_id?: string;
276
- order_link_id?: string;
277
- symbol: string;
278
- p_r_qty?: number;
279
- p_r_price?: string;
280
- p_r_trigger_price?: string;
281
- }): Promise<APIResponseWithTime<any>> {
282
- return this.postPrivate('futures/private/stop-order/replace', params);
283
- }
284
-
285
- queryConditionalOrder(params: {
286
- symbol: string;
287
- stop_order_id?: string;
288
- order_link_id?: string;
289
- }): Promise<APIResponseWithTime<any>> {
290
- return this.getPrivate('futures/private/stop-order', params);
291
- }
292
-
293
- /**
294
- * Position
295
- */
296
-
297
- /**
298
- * Get position list
299
- */
300
- getPosition(
301
- params?: Partial<SymbolParam>
302
- ): Promise<APIResponseWithTime<any>> {
303
- return this.getPrivate('futures/private/position/list', params);
304
- }
305
-
306
- changePositionMargin(params: {
307
- symbol: string;
308
- margin: string;
309
- }): Promise<APIResponseWithTime<any>> {
310
- return this.postPrivate(
311
- 'futures/private/position/change-position-margin',
312
- params
313
- );
314
- }
315
-
316
- setTradingStop(params: {
317
- symbol: string;
318
- take_profit?: number;
319
- stop_loss?: number;
320
- trailing_stop?: number;
321
- tp_trigger_by?: string;
322
- sl_trigger_by?: string;
323
- new_trailing_active?: number;
324
- }): Promise<APIResponseWithTime<any>> {
325
- return this.postPrivate('futures/private/position/trading-stop', params);
326
- }
327
-
328
- setUserLeverage(params: {
329
- symbol: string;
330
- buy_leverage: number;
331
- sell_leverage: number;
332
- }): Promise<APIResponseWithTime<any>> {
333
- return this.postPrivate('futures/private/position/leverage/save', params);
334
- }
335
-
336
- /**
337
- * Position mode switch
338
- */
339
- setPositionMode(params: {
340
- symbol: string;
341
- mode: number;
342
- }): Promise<APIResponseWithTime<any>> {
343
- return this.postPrivate('futures/private/position/switch-mode', params);
344
- }
345
-
346
- /**
347
- * Cross/Isolated margin switch. Must set leverage value when switching.
348
- */
349
- setMarginType(params: {
350
- symbol: string;
351
- is_isolated: boolean;
352
- buy_leverage: number;
353
- sell_leverage: number;
354
- }): Promise<APIResponseWithTime<any>> {
355
- return this.postPrivate('futures/private/position/switch-isolated', params);
356
- }
357
-
358
- getTradeRecords(params: {
359
- order_id?: string;
360
- symbol: string;
361
- start_time?: number;
362
- page?: number;
363
- limit?: number;
364
- order?: string;
365
- }): Promise<APIResponseWithTime<any>> {
366
- return this.getPrivate('futures/private/execution/list', params);
367
- }
368
-
369
- getClosedPnl(params: {
370
- symbol: string;
371
- start_time?: number;
372
- end_time?: number;
373
- exec_type?: string;
374
- page?: number;
375
- limit?: number;
376
- }): Promise<APIResponseWithTime<any>> {
377
- return this.getPrivate('futures/private/trade/closed-pnl/list', params);
378
- }
379
-
380
- /**
381
- * Funding
382
- */
383
-
384
- getLastFundingRate(params: SymbolParam): Promise<APIResponseWithTime<any>> {
385
- return this.get('v2/public/funding/prev-funding-rate', params);
386
- }
387
-
388
- getMyLastFundingFee(params: SymbolParam): Promise<APIResponseWithTime<any>> {
389
- return this.getPrivate('v2/private/funding/prev-funding', params);
390
- }
391
-
392
- getPredictedFunding(params: SymbolParam): Promise<APIResponseWithTime<any>> {
393
- return this.getPrivate('v2/private/funding/predicted-funding', params);
394
- }
395
-
396
- /**
397
- * LCP Info
398
- */
399
-
400
- getLcpInfo(params: SymbolParam): Promise<APIResponseWithTime<any>> {
401
- return this.getPrivate('v2/private/account/lcp', params);
402
- }
403
- }