bybit-api 3.7.1-beta.0 → 3.7.1

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