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,122 +0,0 @@
1
- import {
2
- AccountMarginModeV5,
3
- AccountTypeV5,
4
- CategoryV5,
5
- TransactionTypeV5,
6
- UnifiedUpdateStatusV5,
7
- } from '../v5-shared';
8
-
9
- export interface WalletBalanceV5Coin {
10
- coin: string;
11
- equity: string;
12
- usdValue: string;
13
- walletBalance: string;
14
- free: string; // spot only
15
- locked: string; // spot only
16
- borrowAmount: string;
17
- availableToBorrow: string;
18
- availableToWithdraw: string;
19
- accruedInterest: string;
20
- totalOrderIM: string;
21
- totalPositionIM: string;
22
- totalPositionMM: string;
23
- unrealisedPnl: string;
24
- cumRealisedPnl: string;
25
- bonus: string;
26
- }
27
-
28
- export interface WalletBalanceV5 {
29
- accountType: AccountTypeV5;
30
- accountLTV: string;
31
- accountIMRate: string;
32
- accountMMRate: string;
33
- totalEquity: string;
34
- totalWalletBalance: string;
35
- totalMarginBalance: string;
36
- totalAvailableBalance: string;
37
- totalPerpUPL: string;
38
- totalInitialMargin: string;
39
- totalMaintenanceMargin: string;
40
- coin: WalletBalanceV5Coin[];
41
- }
42
-
43
- export interface UnifiedAccountUpgradeResultV5 {
44
- unifiedUpdateStatus: UnifiedUpdateStatusV5;
45
- unifiedUpdateMsg: {
46
- msg: string[] | null;
47
- };
48
- }
49
-
50
- export interface BorrowHistoryRecordV5 {
51
- currency: string;
52
- createdTime: number;
53
- borrowCost: string;
54
- hourlyBorrowRate: string;
55
- InterestBearingBorrowSize: string;
56
- costExemption: string;
57
- }
58
-
59
- export interface CollateralInfoV5 {
60
- currency: string;
61
- hourlyBorrowRate: string;
62
- maxBorrowingAmount: string;
63
- freeBorrowingAmount: string;
64
- borrowAmount: string;
65
- availableToBorrow: string;
66
- borrowable: boolean;
67
- marginCollateral: boolean;
68
- collateralRatio: string;
69
- }
70
-
71
- export interface CoinGreeksV5 {
72
- baseCoin: string;
73
- totalDelta: string;
74
- totalGamma: string;
75
- totalVega: string;
76
- totalTheta: string;
77
- }
78
-
79
- export interface FeeRateV5 {
80
- symbol: string;
81
- baseCoin: string;
82
- takerFeeRate: string;
83
- makerFeeRate: string;
84
- }
85
-
86
- export interface AccountInfoV5 {
87
- unifiedMarginStatus: number;
88
- marginMode: AccountMarginModeV5;
89
- updatedTime: string;
90
- }
91
-
92
- export interface TransactionLogV5 {
93
- symbol: string;
94
- category: CategoryV5;
95
- side: string;
96
- transactionTime: string;
97
- type: TransactionTypeV5;
98
- qty: string;
99
- size: string;
100
- currency: string;
101
- tradePrice: string;
102
- funding: string;
103
- fee: string;
104
- cashFlow: string;
105
- change: string;
106
- cashBalance: string;
107
- feeRate: string;
108
- tradeId: string;
109
- orderId: string;
110
- orderLinkId: string;
111
- }
112
-
113
- export interface MMPStateV5 {
114
- baseCoin: string;
115
- mmpEnabled: boolean;
116
- window: string;
117
- frozenPeriod: string;
118
- qtyLimit: string;
119
- deltaLimit: string;
120
- mmpFrozenUntil: string;
121
- mmpFrozen: boolean;
122
- }
@@ -1,170 +0,0 @@
1
- import { AccountTypeV5, OrderSideV5, WithdrawalTypeV5 } from '../v5-shared';
2
-
3
- export interface CoinExchangeRecordV5 {
4
- fromCoin: string;
5
- fromAmount: string;
6
- toCoin: string;
7
- toAmount: string;
8
- exchangeRate: string;
9
- createdTime: string;
10
- exchangeTxId: string;
11
- }
12
-
13
- export interface DeliveryRecordV5 {
14
- deliveryTime: number;
15
- symbol: string;
16
- side: OrderSideV5;
17
- position: string;
18
- deliveryPrice: string;
19
- strike: string;
20
- fee: string;
21
- deliveryRpl: string;
22
- }
23
-
24
- export interface SettlementRecordV5 {
25
- symbol: string;
26
- side: string;
27
- size: number;
28
- sessionAvgPrice: string;
29
- markPrice: string;
30
- realisedPnl: string;
31
- createdTime: string;
32
- }
33
-
34
- export interface AssetInfoAssetV5 {
35
- coin: string;
36
- frozen: string;
37
- free: string;
38
- withdraw: string;
39
- }
40
-
41
- export interface AssetInfoV5 {
42
- status: 'ACCOUNT_STATUS_NORMAL' | 'ACCOUNT_STATUS_UNSPECIFIED';
43
- assets: AssetInfoAssetV5[];
44
- }
45
-
46
- export interface CoinBalanceV5 {
47
- coin: string;
48
- walletBalance: string;
49
- transferBalance: string;
50
- bonus?: string;
51
- }
52
-
53
- export interface AllCoinsBalanceV5 {
54
- accountType: AccountTypeV5;
55
- memberId?: string;
56
- balance: CoinBalanceV5[];
57
- }
58
-
59
- export interface AccountCoinBalanceV5 {
60
- accountType: AccountTypeV5;
61
- bizType: number;
62
- accountId: string;
63
- memberId: string;
64
- balance: {
65
- coin: string;
66
- walletBalance: string;
67
- transferBalance: string;
68
- bonus: string;
69
- };
70
- }
71
-
72
- export interface InternalTransferRecordV5 {
73
- transferId: string;
74
- coin: string;
75
- amount: string;
76
- fromAccountType: AccountTypeV5;
77
- toAccountType: AccountTypeV5;
78
- timestamp: string;
79
- status: string;
80
- }
81
-
82
- export interface UniversalTransferRecordV5 {
83
- transferId: string;
84
- coin: string;
85
- amount: string;
86
- fromMemberId: string;
87
- toMemberId: string;
88
- fromAccountType: AccountTypeV5;
89
- toAccountType: AccountTypeV5;
90
- timestamp: string;
91
- status: string;
92
- }
93
-
94
- export interface AllowedDepositCoinInfoV5 {
95
- coin: string;
96
- chain: string;
97
- coinShowName: string;
98
- chainType: string;
99
- blockConfirmNumber: number;
100
- minDepositAmount: string;
101
- }
102
-
103
- export interface DepositRecordV5 {
104
- coin: string;
105
- chain: string;
106
- amount: string;
107
- txID: string;
108
- status: number;
109
- toAddress: string;
110
- tag: string;
111
- depositFee: string;
112
- successAt: string;
113
- confirmations: string;
114
- txIndex: string;
115
- blockHash: string;
116
- }
117
-
118
- export interface InternalDepositRecordV5 {
119
- id: string;
120
- type: 1;
121
- coin: string;
122
- amount: string;
123
- status: 1 | 2 | 3;
124
- address: string;
125
- createdTime: string;
126
- }
127
-
128
- export interface DepositAddressChainV5 {
129
- chainType: string;
130
- addressDeposit: string;
131
- tagDeposit: string;
132
- chain: string;
133
- }
134
-
135
- export interface DepositAddressResultV5 {
136
- coin: string;
137
- chains: DepositAddressChainV5[];
138
- }
139
-
140
- export interface CoinInfoV5 {
141
- name: number;
142
- coin: string;
143
- remainAmount: string;
144
- chains: {
145
- chain: string;
146
- chainType: string;
147
- confirmation: string;
148
- withdrawFee: string;
149
- depositMin: string;
150
- withdrawMin: string;
151
- minAccuracy: string;
152
- chainDeposit: string;
153
- chainWithdraw: string;
154
- }[];
155
- }
156
-
157
- export interface WithdrawalRecordV5 {
158
- withdrawId: string;
159
- txID: string;
160
- withdrawType: WithdrawalTypeV5;
161
- coin: string;
162
- chain: string;
163
- amount: string;
164
- withdrawFee: string;
165
- status: string;
166
- toAddress: string;
167
- tag: string;
168
- createTime: string;
169
- updateTime: string;
170
- }
@@ -1,271 +0,0 @@
1
- import {
2
- CategoryCursorListV5,
3
- ContractTypeV5,
4
- InstrumentStatusV5,
5
- OptionTypeV5,
6
- OrderSideV5,
7
- } from '../v5-shared';
8
-
9
- /**
10
- * OHLCVT candle used by v5 APIs
11
- *
12
- * - list[0]: startTime string Start time of the candle (ms)
13
- * - list[1]: openPrice string Open price
14
- * - list[2]: highPrice string Highest price
15
- * - list[3]: lowPrice string Lowest price
16
- * - list[4]: closePrice string Close price. Is the last traded price when the candle is not closed
17
- * - list[5]: volume string Trade volume. Unit of contract: pieces of contract. Unit of spot: quantity of coins
18
- * - list[6]: turnover string Turnover. Unit of figure: quantity of quota coin
19
- */
20
- export type OHLCVKlineV5 = [
21
- string,
22
- string,
23
- string,
24
- string,
25
- string,
26
- string,
27
- string,
28
- ];
29
-
30
- /**
31
- * OHLC candle used by v5 APIs
32
- *
33
- * - list[0]: startTime string Start time of the candle (ms)
34
- * - list[1]: openPrice string Open price
35
- * - list[2]: highPrice string Highest price
36
- * - list[3]: lowPrice string Lowest price
37
- * - list[4]: closePrice string Close price. Is the last traded price when the candle is not closed
38
- */
39
- export type OHLCKlineV5 = [string, string, string, string, string];
40
-
41
- export interface LinearInverseInstrumentInfoV5 {
42
- symbol: string;
43
- contractType: ContractTypeV5;
44
- status: InstrumentStatusV5;
45
- baseCoin: string;
46
- quoteCoin: string;
47
- launchTime: string;
48
- deliveryTime?: string;
49
- deliveryFeeRate?: string;
50
- priceScale: string;
51
- leverageFilter: {
52
- minLeverage: string;
53
- maxLeverage: string;
54
- leverageStep: string;
55
- };
56
- priceFilter: {
57
- minPrice: string;
58
- maxPrice: string;
59
- tickSize: string;
60
- };
61
- lotSizeFilter: {
62
- maxOrderQty: string;
63
- minOrderQty: string;
64
- qtyStep: string;
65
- postOnlyMaxOrderQty?: string;
66
- };
67
- unifiedMarginTrade: boolean;
68
- fundingInterval: number;
69
- settleCoin: string;
70
- }
71
-
72
- export interface OptionInstrumentInfoV5 {
73
- symbol: string;
74
- optionsType: OptionTypeV5;
75
- status: InstrumentStatusV5;
76
- baseCoin: string;
77
- quoteCoin: string;
78
- settleCoin: boolean;
79
- launchTime: string;
80
- deliveryTime: string;
81
- deliveryFeeRate: string;
82
- priceFilter: {
83
- minPrice: string;
84
- maxPrice: string;
85
- tickSize: string;
86
- };
87
- lotSizeFilter: {
88
- maxOrderQty: string;
89
- minOrderQty: string;
90
- qtyStep: string;
91
- };
92
- }
93
-
94
- export interface SpotInstrumentInfoV5 {
95
- symbol: string;
96
- baseCoin: string;
97
- quoteCoin: string;
98
- innovation: '0' | '1';
99
- status: InstrumentStatusV5;
100
- lotSizeFilter: {
101
- basePrecision: string;
102
- quotePrecision: string;
103
- minOrderQty: string;
104
- maxOrderQty: string;
105
- minOrderAmt: string;
106
- maxOrderAmt: string;
107
- };
108
- priceFilter: {
109
- tickSize: string;
110
- };
111
- }
112
-
113
- export type InstrumentInfoResponseV5 =
114
- | CategoryCursorListV5<LinearInverseInstrumentInfoV5[], 'linear' | 'inverse'>
115
- | CategoryCursorListV5<OptionInstrumentInfoV5[], 'option'>
116
- | CategoryCursorListV5<SpotInstrumentInfoV5[], 'spot'>;
117
-
118
- export default interface OrderbookLevelV5 {
119
- price: string;
120
- size: string;
121
- }
122
-
123
- export interface OrderbookResponseV5 {
124
- s: string;
125
- b: OrderbookLevelV5[];
126
- a: OrderbookLevelV5[];
127
- ts: number;
128
- u: number;
129
- }
130
-
131
- export interface TickerLinearInverseV5 {
132
- symbol: string;
133
- lastPrice: string;
134
- indexPrice: string;
135
- markPrice: string;
136
- prevPrice24h: string;
137
- price24hPcnt: string;
138
- highPrice24h: string;
139
- lowPrice24h: string;
140
- prevPrice1h: string;
141
- openInterest: string;
142
- openInterestValue: string;
143
- turnover24h: string;
144
- volume24h: string;
145
- fundingRate: string;
146
- nextFundingTime: string;
147
- predictedDeliveryPrice: string;
148
- basisRate: string;
149
- deliveryFeeRate: string;
150
- deliveryTime: string;
151
- ask1Size: string;
152
- bid1Price: string;
153
- ask1Price: string;
154
- bid1Size: string;
155
- }
156
-
157
- export interface TickerOptionV5 {
158
- symbol: string;
159
- bid1Price: string;
160
- bid1Size: string;
161
- bid1Iv: string;
162
- ask1Price: string;
163
- ask1Size: string;
164
- ask1Iv: string;
165
- lastPrice: string;
166
- highPrice24h: string;
167
- lowPrice24h: string;
168
- markPrice: string;
169
- indexPrice: string;
170
- markIv: string;
171
- underlyingPrice: string;
172
- openInterest: string;
173
- turnover24h: string;
174
- volume24h: string;
175
- totalVolume: string;
176
- totalTurnover: string;
177
- delta: string;
178
- gamma: string;
179
- vega: string;
180
- theta: string;
181
- predictedDeliveryPrice: string;
182
- change24h: string;
183
- }
184
-
185
- export interface TickerSpotV5 {
186
- symbol: string;
187
- bid1Price: string;
188
- bid1Size: string;
189
- ask1Price: string;
190
- ask1Size: string;
191
- lastPrice: string;
192
- prevPrice24h: string;
193
- price24hPcnt: string;
194
- highPrice24h: string;
195
- lowPrice24h: string;
196
- turnover24h: string;
197
- volume24h: string;
198
- usdIndexPrice: string;
199
- }
200
-
201
- export interface FundingRateHistoryResponseV5 {
202
- symbol: string;
203
- fundingRate: string;
204
- fundingRateTimestamp: string;
205
- }
206
-
207
- export interface PublicTradeV5 {
208
- execId: string;
209
- symbol: string;
210
- price: string;
211
- size: string;
212
- side: OrderSideV5;
213
- time: string;
214
- isBlockTrade: boolean;
215
- }
216
-
217
- /**
218
- *
219
- * - openInterest string Open interest
220
- * - timestamp string The timestamp (ms)
221
- */
222
- export type OpenInterestV5 = [string, string];
223
-
224
- export interface OpenInterestResponseV5 {
225
- category: 'linear' | 'inverse';
226
- symbol: string;
227
- list: OpenInterestV5[];
228
- nextPageCursor?: string;
229
- }
230
-
231
- export interface HistoricalVolatilityV5 {
232
- period: number;
233
- value: string;
234
- time: string;
235
- }
236
-
237
- export interface InsuranceDataV5 {
238
- coin: string;
239
- balance: string;
240
- value: string;
241
- }
242
-
243
- export interface InsuranceResponseV5 {
244
- updatedTime: string;
245
- list: InsuranceDataV5[];
246
- }
247
-
248
- export interface RiskLimitV5 {
249
- id: number;
250
- symbol: string;
251
- riskLimitValue: string;
252
- maintenanceMargin: number;
253
- initialMargin: number;
254
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
255
- section: any;
256
- isLowestRisk: 0 | 1;
257
- maxLeverage: string;
258
- }
259
-
260
- /** @deprecated use DeliveryPriceV5 instead */
261
- export interface OptionDeliveryPriceV5 {
262
- symbol: string;
263
- deliveryPrice: string;
264
- deliveryTime: string;
265
- }
266
-
267
- export interface DeliveryPriceV5 {
268
- symbol: string;
269
- deliveryPrice: string;
270
- deliveryTime: string;
271
- }
@@ -1,118 +0,0 @@
1
- import {
2
- CategoryV5,
3
- ExecTypeV5,
4
- OrderSideV5,
5
- OrderTypeV5,
6
- PositionIdx,
7
- StopOrderTypeV5,
8
- TPSLModeV5,
9
- TradeModeV5,
10
- } from '../v5-shared';
11
-
12
- export interface PositionV5 {
13
- positionIdx: PositionIdx;
14
- riskId: number;
15
- riskLimitValue: string;
16
- symbol: string;
17
- side: 'Buy' | 'Sell' | 'None';
18
- size: string;
19
- avgPrice: string;
20
- positionValue: string;
21
- tradeMode: TradeModeV5;
22
- autoAddMargin?: number;
23
- positionStatus: 'Normal' | 'Liq' | 'Adl';
24
- leverage?: string;
25
- markPrice: string;
26
- liqPrice: string;
27
- bustPrice?: string;
28
- positionIM?: string;
29
- positionMM?: string;
30
- tpslMode?: TPSLModeV5;
31
- takeProfit?: string;
32
- stopLoss?: string;
33
- trailingStop?: string;
34
- unrealisedPnl: string;
35
- cumRealisedPnl: string;
36
- createdTime: string;
37
- updatedTime: string;
38
- }
39
-
40
- export interface SetRiskLimitResultV5 {
41
- category: CategoryV5;
42
- riskId: number;
43
- riskLimitValue: string;
44
- }
45
-
46
- export interface AddOrReduceMarginResultV5 {
47
- category: CategoryV5;
48
- symbol: string;
49
- positionIdx: PositionIdx;
50
- riskId: number;
51
- riskLimitValue: string;
52
- size: string;
53
- avgPrice: string;
54
- liqPrice: string;
55
- bustPrice: string;
56
- markPrice: string;
57
- positionValue: string;
58
- leverage: string;
59
- autoAddMargin: 0 | 1;
60
- positionStatus: 'Normal' | 'Liq' | 'Adl';
61
- positionIM: string;
62
- positionMM: string;
63
- takeProfit: string;
64
- stopLoss: string;
65
- trailingStop: string;
66
- unrealisedPnl: string;
67
- cumRealisedPnl: string;
68
- createdTime: string;
69
- updatedTime: string;
70
- }
71
-
72
- export interface ExecutionV5 {
73
- symbol: string;
74
- orderId: string;
75
- orderLinkId: string;
76
- side: OrderSideV5;
77
- orderPrice: string;
78
- orderQty: string;
79
- leavesQty: string;
80
- orderType: OrderTypeV5;
81
- stopOrderType?: StopOrderTypeV5;
82
- execFee: string;
83
- execId: string;
84
- execPrice: string;
85
- execQty: string;
86
- execType: ExecTypeV5;
87
- execValue: string;
88
- execTime: string;
89
- isMaker: boolean;
90
- feeRate: string;
91
- tradeIv?: string;
92
- markIv?: string;
93
- markPrice: string;
94
- indexPrice: string;
95
- underlyingPrice?: string;
96
- blockTradeId?: string;
97
- closedSize?: string;
98
- }
99
-
100
- export interface ClosedPnLV5 {
101
- symbol: string;
102
- orderId: string;
103
- side: string;
104
- qty: string;
105
- orderPrice: string;
106
- orderType: OrderTypeV5;
107
- execType: ExecTypeV5;
108
- closedSize: string;
109
- cumEntryValue: string;
110
- avgEntryPrice: string;
111
- cumExitValue: string;
112
- avgExitPrice: string;
113
- closedPnl: string;
114
- fillCount: string;
115
- leverage: string;
116
- createdTime: string;
117
- updatedTime: string;
118
- }