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,100 +0,0 @@
1
- import { OrderSide } from '../shared';
2
- import {
3
- USDCAPICategory,
4
- USDCOrderFilter,
5
- USDCOrderType,
6
- USDCTimeInForce,
7
- } from './usdc-shared';
8
-
9
- export interface USDCOpenInterestRequest {
10
- symbol: string;
11
- period: string;
12
- limit?: number;
13
- }
14
-
15
- export interface USDCLast500TradesRequest {
16
- category: USDCAPICategory;
17
- symbol?: string;
18
- baseCoin?: string;
19
- limit?: string;
20
- }
21
-
22
- export interface USDCSymbolDirectionLimit {
23
- symbol?: string;
24
- direction?: string;
25
- limit?: string;
26
- }
27
-
28
- export interface USDCSymbolDirectionLimitCursor {
29
- symbol?: string;
30
- direction?: string;
31
- limit?: string;
32
- cursor?: string;
33
- }
34
-
35
- export interface USDCPerpOrderRequest {
36
- symbol: string;
37
- orderType: USDCOrderType;
38
- orderFilter: USDCOrderFilter;
39
- side: OrderSide;
40
- orderPrice?: string;
41
- orderQty: string;
42
- timeInForce?: USDCTimeInForce;
43
- orderLinkId?: string;
44
- reduceOnly?: boolean;
45
- closeOnTrigger?: boolean;
46
- takeProfit?: string;
47
- stopLoss?: string;
48
- tptriggerby?: string;
49
- slTriggerBy?: string;
50
- basePrice?: string;
51
- triggerPrice?: string;
52
- triggerBy?: string;
53
- mmp?: boolean;
54
- }
55
-
56
- export interface USDCPerpModifyOrderRequest {
57
- symbol: string;
58
- orderFilter: USDCOrderFilter;
59
- orderId?: string;
60
- orderLinkId?: string;
61
- orderPrice?: string;
62
- orderQty?: string;
63
- takeProfit?: string;
64
- stopLoss?: string;
65
- tptriggerby?: string;
66
- slTriggerBy?: string;
67
- triggerPrice?: string;
68
- }
69
-
70
- export interface USDCPerpCancelOrderRequest {
71
- symbol: string;
72
- orderFilter: USDCOrderFilter;
73
- orderId?: string;
74
- orderLinkId?: string;
75
- }
76
-
77
- export interface USDCPerpActiveOrdersRequest {
78
- category: 'PERPETUAL';
79
- symbol?: string;
80
- baseCoin?: string;
81
- orderId?: string;
82
- orderLinkId?: string;
83
- orderFilter?: USDCOrderFilter;
84
- direction?: string;
85
- limit?: number;
86
- cursor?: string;
87
- }
88
-
89
- export interface USDCPerpHistoricOrdersRequest {
90
- category: 'PERPETUAL';
91
- symbol?: string;
92
- baseCoin?: string;
93
- orderId?: string;
94
- orderLinkId?: string;
95
- orderStatus?: string;
96
- orderFilter?: USDCOrderFilter;
97
- direction?: string;
98
- limit?: number;
99
- cursor?: string;
100
- }
@@ -1,39 +0,0 @@
1
- export type USDCAPICategory = 'PERPETUAL' | 'OPTION';
2
-
3
- export type USDCOrderType = 'Limit' | 'Market';
4
-
5
- export type USDCTimeInForce =
6
- | 'GoodTillCancel'
7
- | 'ImmediateOrCancel'
8
- | 'FillOrKill'
9
- | 'PostOnly';
10
-
11
- export type USDCOrderFilter = 'Order' | 'StopOrder';
12
-
13
- export interface USDCKlineRequest {
14
- symbol: string;
15
- period: string;
16
- startTime: number;
17
- limit?: string;
18
- }
19
-
20
- export interface USDCTransactionLogRequest {
21
- type: string;
22
- baseCoin?: string;
23
- startTime?: string;
24
- endTime?: string;
25
- direction?: string;
26
- limit?: string;
27
- cursor?: string;
28
- category?: USDCAPICategory;
29
- }
30
-
31
- export interface USDCPositionsRequest {
32
- category: USDCAPICategory;
33
- symbol?: string;
34
- baseCoin?: string;
35
- expDate?: string;
36
- direction?: string;
37
- limit?: string;
38
- cursor?: string;
39
- }
@@ -1,40 +0,0 @@
1
- import { AccountTypeV5, CategoryV5, TransactionTypeV5 } from '../v5-shared';
2
-
3
- export interface GetWalletBalanceParamsV5 {
4
- accountType: AccountTypeV5;
5
- coin?: string;
6
- }
7
-
8
- export interface GetBorrowHistoryParamsV5 {
9
- currency?: string;
10
- startTime?: number;
11
- endTime?: number;
12
- limit?: number;
13
- cursor?: string;
14
- }
15
-
16
- export interface GetFeeRateParamsV5 {
17
- category: CategoryV5;
18
- symbol?: string;
19
- baseCoin?: string;
20
- }
21
-
22
- export interface GetTransactionLogParamsV5 {
23
- accountType?: AccountTypeV5;
24
- category?: CategoryV5;
25
- currency?: string;
26
- baseCoin?: string;
27
- type?: TransactionTypeV5;
28
- startTime?: number;
29
- endTime?: number;
30
- limit?: number;
31
- cursor?: string;
32
- }
33
-
34
- export interface MMPModifyParamsV5 {
35
- baseCoin: string;
36
- window: string;
37
- frozenPeriod: string;
38
- qtyLimit: string;
39
- deltaLimit: string;
40
- }
@@ -1,133 +0,0 @@
1
- import { AccountTypeV5, CategoryV5 } from '../v5-shared';
2
-
3
- export interface GetCoinExchangeRecordParamsV5 {
4
- fromCoin?: string;
5
- toCoin?: string;
6
- limit?: number;
7
- cursor?: string;
8
- }
9
-
10
- export interface GetDeliveryRecordParamsV5 {
11
- category: CategoryV5;
12
- symbol?: string;
13
- expDate?: string;
14
- limit?: number;
15
- cursor?: string;
16
- }
17
-
18
- export interface GetSettlementRecordParamsV5 {
19
- category: CategoryV5;
20
- symbol?: string;
21
- limit?: number;
22
- cursor?: string;
23
- }
24
-
25
- export interface GetAssetInfoParamsV5 {
26
- accountType: AccountTypeV5;
27
- coin?: string;
28
- }
29
-
30
- export interface GetAllCoinsBalanceParamsV5 {
31
- memberId?: string;
32
- accountType: AccountTypeV5;
33
- coin?: string;
34
- withBonus?: number;
35
- }
36
-
37
- export interface GetAccountCoinBalanceParamsV5 {
38
- memberId?: string;
39
- accountType: AccountTypeV5;
40
- coin: string;
41
- withBonus?: number;
42
- withTransferSafeAmount?: 0 | 1;
43
- }
44
-
45
- export interface GetInternalTransferParamsV5 {
46
- transferId?: string;
47
- coin?: string;
48
- status?: string;
49
- startTime?: number;
50
- endTime?: number;
51
- limit?: number;
52
- cursor?: string;
53
- }
54
-
55
- export interface UniversalTransferParamsV5 {
56
- transferId: string;
57
- coin: string;
58
- amount: string;
59
- fromMemberId: number;
60
- toMemberId: number;
61
- fromAccountType: AccountTypeV5;
62
- toAccountType: AccountTypeV5;
63
- }
64
-
65
- export interface GetUniversalTransferRecordsParamsV5 {
66
- transferId?: string;
67
- coin?: string;
68
- status?: string;
69
- startTime?: number;
70
- endTime?: number;
71
- limit?: number;
72
- cursor?: string;
73
- }
74
-
75
- export interface GetAllowedDepositCoinInfoParamsV5 {
76
- coin?: string;
77
- chain?: string;
78
- limit?: number;
79
- cursor?: string;
80
- }
81
-
82
- export interface GetDepositRecordParamsV5 {
83
- coin?: string;
84
- startTime?: number;
85
- endTime?: number;
86
- limit?: number;
87
- cursor?: string;
88
- }
89
-
90
- export interface GetSubAccountDepositRecordParamsV5 {
91
- subMemberId: string;
92
- coin?: string;
93
- startTime?: number;
94
- endTime?: number;
95
- limit?: number;
96
- cursor?: string;
97
- }
98
-
99
- export interface GetInternalDepositRecordParamsV5 {
100
- startTime?: number;
101
- endTime?: number;
102
- coin?: string;
103
- cursor?: string;
104
- limit?: number;
105
- }
106
-
107
- export interface GetWithdrawalRecordsParamsV5 {
108
- withdrawID?: string;
109
- coin?: string;
110
- withdrawType?: number;
111
- startTime?: number;
112
- endTime?: number;
113
- limit?: number;
114
- cursor?: string;
115
- }
116
-
117
- export interface WithdrawParamsV5 {
118
- coin: string;
119
- chain: string;
120
- address: string;
121
- tag?: string;
122
- amount: string;
123
- timestamp: number;
124
- forceChain?: number;
125
- accountType?: 'SPOT' | 'FUND';
126
- }
127
-
128
- export interface CreateSubMemberParamsV5 {
129
- username: string;
130
- memberType: 1 | 6;
131
- switch?: 0 | 1;
132
- note?: string;
133
- }
@@ -1,127 +0,0 @@
1
- import { KlineIntervalV3 } from '../shared';
2
- import { CategoryV5, InstrumentStatusV5, OptionTypeV5 } from '../v5-shared';
3
-
4
- export interface GetKlineParamsV5 {
5
- category: 'spot' | 'linear' | 'inverse';
6
- symbol: string;
7
- interval: KlineIntervalV3;
8
- start?: number;
9
- end?: number;
10
- limit?: number;
11
- }
12
-
13
- export interface GetMarkPriceKlineParamsV5 {
14
- category: 'linear' | 'inverse';
15
- symbol: string;
16
- interval: KlineIntervalV3;
17
- start?: number;
18
- end?: number;
19
- limit?: number;
20
- }
21
-
22
- export interface GetIndexPriceKlineParamsV5 {
23
- category: 'linear' | 'inverse';
24
- symbol: string;
25
- interval: KlineIntervalV3;
26
- start?: number;
27
- end?: number;
28
- limit?: number;
29
- }
30
-
31
- export interface GetPremiumIndexPriceKlineParamsV5 {
32
- category: 'linear';
33
- symbol: string;
34
- interval: KlineIntervalV3;
35
- start?: number;
36
- end?: number;
37
- limit?: number;
38
- }
39
-
40
- export interface GetInstrumentsInfoParamsV5 {
41
- category: CategoryV5;
42
- symbol?: string;
43
- status?: InstrumentStatusV5;
44
- baseCoin?: string;
45
- limit?: number;
46
- cursor?: string;
47
- }
48
-
49
- export interface GetOrderbookParamsV5 {
50
- category: CategoryV5;
51
- symbol: string;
52
- limit?: number;
53
- }
54
-
55
- export interface GetTickersParamsV5 {
56
- category: CategoryV5;
57
- symbol?: string;
58
- baseCoin?: string;
59
- expDate?: string;
60
- }
61
-
62
- export interface GetFundingRateHistoryParamsV5 {
63
- category: 'linear' | 'inverse';
64
- symbol: string;
65
- startTime?: number;
66
- endTime?: number;
67
- limit?: number;
68
- }
69
-
70
- export interface GetPublicTradingHistoryParamsV5 {
71
- category: CategoryV5;
72
- symbol: string;
73
- baseCoin?: string;
74
- optionType?: OptionTypeV5;
75
- limit?: number;
76
- }
77
-
78
- export type OpenInterestIntervalV5 =
79
- | '5min'
80
- | '15min'
81
- | '30min'
82
- | '1h'
83
- | '4h'
84
- | '1d';
85
-
86
- export interface GetOpenInterestParamsV5 {
87
- category: 'linear' | 'inverse';
88
- symbol: string;
89
- intervalTime: OpenInterestIntervalV5;
90
- startTime?: number;
91
- endTime?: number;
92
- limit?: number;
93
- cursor?: string;
94
- }
95
-
96
- export interface GetHistoricalVolatilityParamsV5 {
97
- category: 'option';
98
- baseCoin?: string;
99
- period?: 7 | 14 | 21 | 30 | 60 | 90 | 180 | 270;
100
- startTime?: number;
101
- endTime?: number;
102
- }
103
-
104
- export interface GetInsuranceParamsV5 {
105
- coin?: string;
106
- }
107
-
108
- export interface GetRiskLimitParamsV5 {
109
- category?: 'linear' | 'inverse';
110
- symbol?: string;
111
- }
112
-
113
- export interface GetOptionDeliveryPriceParamsV5 {
114
- category: 'option';
115
- symbol?: string;
116
- baseCoin?: string;
117
- limit?: number;
118
- cursor?: string;
119
- }
120
-
121
- export interface GetDeliveryPriceParamsV5 {
122
- category: 'linear' | 'inverse' | 'option';
123
- symbol?: string;
124
- baseCoin?: string;
125
- limit?: number;
126
- cursor?: string;
127
- }
@@ -1,107 +0,0 @@
1
- import {
2
- CategoryV5,
3
- ExecTypeV5,
4
- OrderTriggerByV5,
5
- OrderTypeV5,
6
- PositionIdx,
7
- TPSLModeV5,
8
- } from '../v5-shared';
9
-
10
- export interface PositionInfoParamsV5 {
11
- category: CategoryV5;
12
- symbol?: string;
13
- baseCoin?: string;
14
- settleCoin?: string;
15
- limit?: number;
16
- cursor?: string;
17
- }
18
-
19
- export interface SetLeverageParamsV5 {
20
- category: 'linear' | 'inverse';
21
- symbol: string;
22
- buyLeverage: string;
23
- sellLeverage: string;
24
- }
25
-
26
- export interface SwitchIsolatedMarginParamsV5 {
27
- category: 'linear' | 'inverse';
28
- symbol: string;
29
- tradeMode: 0 | 1;
30
- buyLeverage: string;
31
- sellLeverage: string;
32
- }
33
-
34
- export interface SetTPSLModeParamsV5 {
35
- category: 'linear' | 'inverse';
36
- symbol: string;
37
- tpSlMode: TPSLModeV5;
38
- }
39
-
40
- export interface SwitchPositionModeParamsV5 {
41
- category: 'linear' | 'inverse';
42
- symbol?: string;
43
- coin?: string;
44
- mode: 0 | 3;
45
- }
46
-
47
- export interface SetRiskLimitParamsV5 {
48
- category: 'linear' | 'inverse';
49
- symbol: string;
50
- riskId: number;
51
- positionIdx?: PositionIdx;
52
- }
53
-
54
- export interface SetTradingStopParamsV5 {
55
- category: CategoryV5;
56
- symbol: string;
57
- takeProfit?: string;
58
- stopLoss?: string;
59
- trailingStop?: string;
60
- tpTriggerBy?: OrderTriggerByV5;
61
- slTriggerBy?: OrderTriggerByV5;
62
- activePrice?: string;
63
- tpslMode?: TPSLModeV5;
64
- tpSize?: string;
65
- slSize?: string;
66
- tpLimitPrice?: string;
67
- slLimitPrice?: string;
68
- tpOrderType?: OrderTypeV5;
69
- slOrderType?: OrderTypeV5;
70
- positionIdx: PositionIdx;
71
- }
72
-
73
- export interface SetAutoAddMarginParamsV5 {
74
- category: 'linear';
75
- symbol: string;
76
- autoAddMargin: 0 | 1;
77
- positionIdx?: PositionIdx;
78
- }
79
-
80
- export interface AddOrReduceMarginParamsV5 {
81
- category: 'linear' | 'inverse';
82
- symbol: string;
83
- margin: string;
84
- positionIDex?: PositionIdx;
85
- }
86
-
87
- export interface GetExecutionListParamsV5 {
88
- category: CategoryV5;
89
- symbol?: string;
90
- orderId?: string;
91
- orderLinkId?: string;
92
- baseCoin?: string;
93
- startTime?: number;
94
- endTime?: number;
95
- execType?: ExecTypeV5;
96
- limit?: number;
97
- cursor?: string;
98
- }
99
-
100
- export interface GetClosedPnLParamsV5 {
101
- category: CategoryV5;
102
- symbol?: string;
103
- startTime?: number;
104
- endTime?: number;
105
- limit?: number;
106
- cursor?: string;
107
- }
@@ -1,37 +0,0 @@
1
- import { ExecTypeV5 } from '../v5-shared';
2
-
3
- export interface GetPreUpgradeOrderHistoryParamsV5 {
4
- category: 'linear' | 'inverse';
5
- symbol?: string;
6
- baseCoin?: string;
7
- orderId?: string;
8
- orderLinkId?: string;
9
- orderFilter?: 'Order' | 'StopOrder';
10
- orderStatus?: string;
11
- startTime?: number;
12
- endTime?: number;
13
- limit?: number;
14
- cursor?: string;
15
- }
16
-
17
- export interface GetPreUpgradeTradeHistoryParamsV5 {
18
- category: 'linear' | 'inverse';
19
- symbol?: string;
20
- orderId?: string;
21
- orderLinkId?: string;
22
- baseCoin?: string;
23
- startTime?: number;
24
- endTime?: number;
25
- execType?: ExecTypeV5;
26
- limit?: number;
27
- cursor?: string;
28
- }
29
-
30
- export interface GetPreUpgradeClosedPnlParamsV5 {
31
- category: 'linear' | 'inverse';
32
- symbol: string;
33
- startTime?: number;
34
- endTime?: number;
35
- limit?: number;
36
- cursor?: string;
37
- }
@@ -1,23 +0,0 @@
1
- import { LTOrderTypeV5 } from '../v5-shared';
2
-
3
- export interface PurchaseSpotLeveragedTokenParamsV5 {
4
- ltCoin: string;
5
- amount: string;
6
- serialNo?: string;
7
- }
8
-
9
- export interface RedeemSpotLeveragedTokenParamsV5 {
10
- ltCoin: string;
11
- quantity: string;
12
- serialNo?: string;
13
- }
14
-
15
- export interface GetSpotLeveragedTokenOrderHistoryParamsV5 {
16
- ltCoin?: string;
17
- orderId?: string;
18
- startTime?: number;
19
- endTime?: number;
20
- limit?: number;
21
- ltOrderType?: LTOrderTypeV5;
22
- serialNo?: string;
23
- }