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,258 +0,0 @@
1
- export type TransferAccountType =
2
- | 'CONTRACT'
3
- | 'SPOT'
4
- | 'INVESTMENT'
5
- | 'OPTION'
6
- | 'UNIFIED';
7
-
8
- export type TransferType = 'IN' | 'OUT';
9
-
10
- export type TransferStatus = 'SUCCESS' | 'PENDING' | 'FAILED';
11
-
12
- export type PageDirection = 'Prev' | 'Next';
13
-
14
- export interface InternalTransferRequest {
15
- transfer_id: string;
16
- coin: string;
17
- amount: string;
18
- from_account_type: TransferAccountType;
19
- to_account_type: TransferAccountType;
20
- }
21
-
22
- export interface InternalTransferRequestV3 {
23
- transferId: string;
24
- coin: string;
25
- amount: string;
26
- fromAccountType: string;
27
- toAccountType: string;
28
- }
29
-
30
- export interface QueryInternalTransfersRequestV3 {
31
- transferId?: string;
32
- coin: string;
33
- status?: string;
34
- startTime?: number;
35
- endTime?: number;
36
- limit?: number;
37
- cursor?: string;
38
- }
39
-
40
- export interface SubAccountTransferRequest {
41
- transfer_id: string;
42
- coin: string;
43
- amount: string;
44
- sub_user_id: string;
45
- type: TransferType;
46
- }
47
-
48
- export interface SubAccountTransferRequestV3 {
49
- transferId?: string;
50
- coin?: string;
51
- status?: string;
52
- startTime?: number;
53
- endTime?: number;
54
- limit?: number;
55
- cursor?: string;
56
- }
57
-
58
- export interface TransferQueryRequest {
59
- transfer_id?: string;
60
- coin?: string;
61
- status?: TransferStatus;
62
- start_time?: number;
63
- end_time?: number;
64
- direction?: PageDirection;
65
- limit?: number;
66
- cursor?: string;
67
- }
68
-
69
- export interface EnableUniversalTransferRequest {
70
- /** A comma-separated list of subaccount UIDs, for example "123,45,14,26,46" */
71
- transferable_sub_ids?: string;
72
- }
73
-
74
- export interface UniversalTransferRequest {
75
- transfer_id: string;
76
- coin: string;
77
- amount: string;
78
- from_member_id: string;
79
- to_member_id: string;
80
- from_account_type: TransferAccountType;
81
- to_account_type: TransferAccountType;
82
- }
83
- export interface SupportedDepositListRequest {
84
- coin?: string;
85
- chain?: string;
86
- page_index?: number;
87
- page_size?: number;
88
- }
89
-
90
- export interface DepositRecordsRequest {
91
- start_time?: number;
92
- end_time?: number;
93
- coin?: string;
94
- cursor?: string;
95
- direction?: PageDirection;
96
- limit?: number;
97
- }
98
-
99
- export interface WithdrawalRecordsRequest {
100
- withdraw_id?: number;
101
- start_time?: number;
102
- end_time?: number;
103
- coin?: string;
104
- cursor?: string;
105
- direction?: PageDirection;
106
- limit?: number;
107
- }
108
-
109
- export interface AccountAssetInformationRequest {
110
- /** Account type. Default value: ACCOUNT_TYPE_SPOT */
111
- account_type?: string;
112
- coin?: string;
113
- }
114
-
115
- export interface WithdrawalRequest {
116
- address: string;
117
- amount: string;
118
- coin: string;
119
- chain: string;
120
- tag?: string;
121
- }
122
-
123
- export interface UniversalTransferRequestV3 {
124
- transferId: string;
125
- coin: string;
126
- amount: string;
127
- fromMemberId: string;
128
- toMemberId: string;
129
- fromAccountType: TransferAccountType;
130
- toAccountType: TransferAccountType;
131
- }
132
-
133
- export interface UniversalTransferListRequestV3 {
134
- transferId?: string;
135
- coin: string;
136
- status?: string;
137
- startTime?: number;
138
- endTime?: number;
139
- limit?: number;
140
- cursor?: string;
141
- }
142
-
143
- export interface TransferCoinListRequestV3 {
144
- fromAccountType: TransferAccountType;
145
- toAccountType: TransferAccountType;
146
- }
147
-
148
- export interface SingleAccountCoinBalanceRequestV3 {
149
- memberId?: string;
150
- accountType: TransferAccountType;
151
- coin: string;
152
- withBonus?: '0' | '1';
153
- }
154
-
155
- export interface AccountCoinBalancesRequestV3 {
156
- memberId?: string;
157
- accountType: TransferAccountType;
158
- coin?: string;
159
- withBonus?: '0' | '1';
160
- }
161
-
162
- export interface AssetInfoRequestV3 {
163
- accountType?: TransferAccountType;
164
- coin?: string;
165
- }
166
-
167
- export interface SupportedDepositListRequestV3 {
168
- coin?: string;
169
- chain?: string;
170
- cursor?: string;
171
- limit?: number;
172
- }
173
-
174
- export interface DepositRecordQueryRequestV3 {
175
- startTime?: number;
176
- endTime?: number;
177
- coin?: string;
178
- cursor?: string;
179
- limit?: number;
180
- }
181
-
182
- export interface SubDepositRecordQueryRequestV3 {
183
- subMemberId: number;
184
- startTime?: number;
185
- endTime?: number;
186
- coin?: string;
187
- cursor?: string;
188
- limit?: number;
189
- }
190
-
191
- export interface WithdrawRecordQueryRequestV3 {
192
- withdrawID?: number;
193
- startTime?: number;
194
- endTime?: number;
195
- coin?: string;
196
- withdrawType?: string;
197
- cursor?: string;
198
- limit?: number;
199
- }
200
-
201
- export interface WithdrawCreateRequestV3 {
202
- coin: string;
203
- chain: string;
204
- address: string;
205
- tag?: string;
206
- amount: string;
207
- timestamp: number;
208
- forceChain?: 0 | 1;
209
- }
210
-
211
- export interface QueryDepositAddressRequestV3 {
212
- coin?: string;
213
- chainType?: string;
214
- }
215
-
216
- export interface QuerySubAccountDepositAddressRequestV3 {
217
- coin?: string;
218
- chainType?: string;
219
- subMemberId: string;
220
- }
221
-
222
- export interface CreateSubMemberRequestV3 {
223
- username: string;
224
- memberType: 1 | 6;
225
- switch?: 0 | 1;
226
- note?: string;
227
- }
228
-
229
- export interface CreateSubAPIKeyRequestV3 {
230
- subuid: string;
231
- note?: string;
232
- readOnly: 0 | 1;
233
- ips?: string[];
234
- permissions: {
235
- ContractTrade?: string[];
236
- Spot?: string[];
237
- Wallet?: string[];
238
- Options?: string[];
239
- Derivatives?: string[];
240
- Exchange?: string[];
241
- };
242
- }
243
-
244
- export interface ModifyAPIKeyRequestV3 {
245
- readOnly: number;
246
- ips?: string[];
247
- permissions: {
248
- ContractTrade?: string[];
249
- Spot?: string[];
250
- Wallet?: string[];
251
- Options?: string[];
252
- Derivatives?: string[];
253
- CopyTrading?: string[];
254
- BlockTrade?: string[];
255
- Exchange?: string[];
256
- NFT?: string[];
257
- };
258
- }
@@ -1,139 +0,0 @@
1
- import { OrderSide } from '../shared';
2
- import { UMOrderType } from './unified-margin';
3
- import { USDCOrderFilter, USDCTimeInForce } from './usdc-shared';
4
-
5
- export interface ContractOrderRequest {
6
- symbol: string;
7
- side: OrderSide;
8
- orderType: UMOrderType;
9
- qty: string;
10
- timeInForce: USDCTimeInForce;
11
- price?: string;
12
- triggerDirection?: '1' | '2';
13
- triggerPrice?: string;
14
- triggerBy?: string;
15
- positionIdx?: '0' | '1' | '2';
16
- orderLinkId?: string;
17
- takeProfit?: string;
18
- stopLoss?: string;
19
- tpTriggerBy?: string;
20
- slTriggerBy?: string;
21
- reduceOnly?: boolean;
22
- closeOnTrigger?: boolean;
23
- tpslMode?: 'Partial' | 'Full';
24
- tpOrderType?: UMOrderType;
25
- slOrderType?: UMOrderType;
26
- }
27
-
28
- export interface ContractHistoricOrdersRequest {
29
- orderId?: string;
30
- orderLinkId?: string;
31
- symbol: string;
32
- orderStatus?: string;
33
- orderFilter?: USDCOrderFilter;
34
- limit?: number;
35
- cursor?: string;
36
- }
37
-
38
- export interface ContractCancelOrderRequest {
39
- symbol: string;
40
- orderId?: string;
41
- orderLinkId?: string;
42
- }
43
-
44
- export interface ContractModifyOrderRequest {
45
- symbol: string;
46
- orderId?: string;
47
- orderLinkId?: string;
48
- price?: string;
49
- qty?: string;
50
- triggerPrice?: string;
51
- takeProfit?: string;
52
- stopLoss?: string;
53
- tpTriggerBy?: string;
54
- slTriggerBy?: string;
55
- triggerBy?: string;
56
- tpLimitPrice?: string;
57
- slLimitPrice?: string;
58
- }
59
-
60
- export interface ContractActiveOrdersRequest {
61
- symbol?: string;
62
- orderId?: string;
63
- orderLinkId?: string;
64
- settleCoin?: string;
65
- orderFilter?: USDCOrderFilter;
66
- limit?: number;
67
- }
68
-
69
- export interface ContractPositionsRequest {
70
- symbol?: string;
71
- settleCoin?: string;
72
- dataFilter?: string;
73
- }
74
-
75
- export interface ContractSetAutoAddMarginRequest {
76
- symbol: string;
77
- side: 'Buy' | 'Sell';
78
- autoAddMargin: 1 | 0;
79
- positionIdx?: 0 | 1 | 2;
80
- }
81
-
82
- export interface ContractSetMarginSwitchRequest {
83
- symbol: string;
84
- tradeMode: 0 | 1;
85
- buyLeverage: string;
86
- sellLeverage: string;
87
- }
88
-
89
- export interface ContractSetPositionModeRequest {
90
- symbol?: string;
91
- coin?: string;
92
- mode: 0 | 3;
93
- }
94
-
95
- export interface ContractSetTPSLRequest {
96
- symbol: string;
97
- takeProfit?: string;
98
- stopLoss?: string;
99
- tpslMode?: 'Full' | 'Partial';
100
- tpSize?: string;
101
- slSize?: string;
102
- tpTriggerBy?: string;
103
- slTriggerBy?: string;
104
- trailingStop?: string;
105
- activePrice?: string;
106
- tpLimitPrice?: string;
107
- slLimitPrice?: string;
108
- tpOrderType?: UMOrderType;
109
- slOrderType?: UMOrderType;
110
- /** 0-one-way, 1-buy side, 2-sell side */
111
- positionIdx?: 0 | 1 | 2;
112
- }
113
-
114
- export interface ContractUserExecutionHistoryRequest {
115
- symbol: string;
116
- orderId?: string;
117
- startTime?: number;
118
- endTime?: number;
119
- execType?: 'Trade' | 'AdlTrade' | 'Funding' | 'BustTrade';
120
- limit?: number;
121
- cursor?: string;
122
- }
123
-
124
- export interface ContractClosedPNLRequest {
125
- symbol: string;
126
- startTime?: number;
127
- endTime?: number;
128
- limit?: number;
129
- cursor?: string;
130
- }
131
-
132
- export interface ContractWalletFundRecordRequest {
133
- startTime?: string;
134
- endTime?: string;
135
- coin?: string;
136
- walletFundType?: string;
137
- limit?: string;
138
- cursor?: string;
139
- }
@@ -1,53 +0,0 @@
1
- import { OrderSide } from '../shared';
2
- import { USDCOrderType } from './usdc-shared';
3
-
4
- export interface CopyTradingOrderRequest {
5
- side: OrderSide;
6
- symbol: string;
7
- orderType: USDCOrderType;
8
- price: string;
9
- qty: string;
10
- takeProfit?: string;
11
- stopLoss?: string;
12
- tpTriggerBy?: string;
13
- slTriggerBy?: string;
14
- orderLinkId?: string;
15
- }
16
-
17
- export interface CopyTradingTradingStopRequest {
18
- symbol: string;
19
- parentOrderId: string;
20
- takeProfit?: string;
21
- stopLoss?: string;
22
- tpTriggerBy?: string;
23
- slTriggerBy?: string;
24
- parentOrderLinkId?: string;
25
- }
26
-
27
- export interface CopyTradingOrderListRequest {
28
- symbol?: string;
29
- orderId?: string;
30
- orderLinkId?: string;
31
- copyTradeOrderType?: string;
32
- }
33
-
34
- export interface CopyTradingCancelOrderRequest {
35
- symbol: string;
36
- orderId?: string;
37
- orderLinkId?: string;
38
- }
39
-
40
- export interface CopyTradingCloseOrderRequest {
41
- symbol: string;
42
- orderLinkId?: string;
43
- parentOrderId?: string;
44
- parentOrderLinkId?: string;
45
- }
46
-
47
- export interface CopyTradingTransferRequest {
48
- transferId: string;
49
- coin: string;
50
- amount: string;
51
- fromAccountType: string;
52
- toAccountType: string;
53
- }
@@ -1,18 +0,0 @@
1
- export * from './account-asset';
2
- export * from './copy-trading';
3
- export * from './contract';
4
- export * from './linear';
5
- export * from './inverse';
6
- export * from './spot';
7
- export * from './usdc-perp';
8
- export * from './usdc-options';
9
- export * from './usdc-shared';
10
- export * from './unified-margin';
11
- export * from './v5-account';
12
- export * from './v5-asset';
13
- export * from './v5-market';
14
- export * from './v5-position';
15
- export * from './v5-pre-upgrade';
16
- export * from './v5-trade';
17
- export * from './v5-user';
18
- export * from './v5-spot-leverage-token';
@@ -1,135 +0,0 @@
1
- export interface InverseOrderRequest {
2
- side: string;
3
- symbol: string;
4
- order_type: string;
5
- qty: number;
6
- price?: number;
7
- time_in_force: string;
8
- take_profit?: number;
9
- stop_loss?: number;
10
- reduce_only?: boolean;
11
- tp_trigger_by?: 'LastPrice' | 'MarkPrice' | 'IndexPrice';
12
- sl_trigger_by?: 'LastPrice' | 'MarkPrice' | 'IndexPrice';
13
- close_on_trigger?: boolean;
14
- order_link_id?: string;
15
- }
16
-
17
- export interface InverseActiveOrdersRequest {
18
- symbol: string;
19
- order_status?: string;
20
- direction?: string;
21
- limit?: number;
22
- cursor?: string;
23
- }
24
-
25
- export interface InverseCancelOrderRequest {
26
- symbol: string;
27
- order_id?: string;
28
- order_link_id?: string;
29
- }
30
-
31
- export interface InverseReplaceOrderRequest {
32
- order_id?: string;
33
- order_link_id?: string;
34
- symbol: string;
35
- p_r_qty?: number;
36
- p_r_price?: string;
37
- take_profit?: number;
38
- stop_loss?: number;
39
- tp_trigger_by?: string;
40
- sl_trigger_by?: string;
41
- }
42
-
43
- export interface InverseGetOrderRequest {
44
- order_id?: string;
45
- order_link_id?: string;
46
- symbol: string;
47
- }
48
-
49
- export interface InverseConditionalOrderRequest {
50
- side: string;
51
- symbol: string;
52
- order_type: string;
53
- qty: string;
54
- price?: string;
55
- base_price: string;
56
- stop_px: string;
57
- time_in_force: string;
58
- trigger_by?: string;
59
- close_on_trigger?: boolean;
60
- order_link_id?: string;
61
- }
62
-
63
- export interface InverseActiveConditionalOrderRequest {
64
- symbol: string;
65
- stop_order_status?: string;
66
- direction?: string;
67
- limit?: number;
68
- cursor?: string;
69
- }
70
-
71
- export interface InverseCancelConditionalOrderRequest {
72
- symbol: string;
73
- stop_order_id?: string;
74
- order_link_id?: string;
75
- }
76
-
77
- export interface InverseReplaceConditionalOrderRequest {
78
- stop_order_id?: string;
79
- order_link_id?: string;
80
- symbol: string;
81
- p_r_qty?: number;
82
- p_r_price?: string;
83
- p_r_trigger_price?: string;
84
- }
85
-
86
- export interface InverseChangePositionMarginRequest {
87
- symbol: string;
88
- margin: string;
89
- }
90
-
91
- export interface InverseSetTradingStopRequest {
92
- symbol: string;
93
- take_profit?: number;
94
- stop_loss?: number;
95
- trailing_stop?: number;
96
- tp_trigger_by?: string;
97
- sl_trigger_by?: string;
98
- new_trailing_active?: number;
99
- }
100
-
101
- export interface InverseSetLeverageRequest {
102
- symbol: string;
103
- leverage: number;
104
- leverage_only?: boolean;
105
- }
106
-
107
- export interface InverseGetTradeRecordsRequest {
108
- order_id?: string;
109
- symbol: string;
110
- start_time?: number;
111
- page?: number;
112
- limit?: number;
113
- order?: string;
114
- }
115
-
116
- export interface InverseGetClosedPnlRequest {
117
- symbol: string;
118
- start_time?: number;
119
- end_time?: number;
120
- exec_type?: string;
121
- page?: number;
122
- limit?: number;
123
- }
124
-
125
- export interface InverseSetSlTpPositionModeRequest {
126
- symbol: string;
127
- tp_sl_mode: 'Full' | 'Partial';
128
- }
129
-
130
- export interface InverseSetMarginTypeRequest {
131
- symbol: string;
132
- is_isolated: boolean;
133
- buy_leverage: number;
134
- sell_leverage: number;
135
- }