bybit-api 4.7.6 → 4.7.7

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 (39) hide show
  1. package/lib/rest-client-v5.d.ts +71 -1
  2. package/lib/rest-client-v5.js +90 -0
  3. package/lib/rest-client-v5.js.map +1 -1
  4. package/lib/types/request/index.d.ts +1 -0
  5. package/lib/types/request/index.js +1 -0
  6. package/lib/types/request/index.js.map +1 -1
  7. package/lib/types/request/v5-asset.d.ts +2 -0
  8. package/lib/types/request/v5-broker.d.ts +1 -1
  9. package/lib/types/request/v5-earn-liquidity-mining.d.ts +6 -0
  10. package/lib/types/request/v5-event.d.ts +59 -0
  11. package/lib/types/request/v5-event.js +3 -0
  12. package/lib/types/request/v5-event.js.map +1 -0
  13. package/lib/types/request/v5-market.d.ts +1 -0
  14. package/lib/types/request/v5-trade.d.ts +1 -0
  15. package/lib/types/response/index.d.ts +1 -0
  16. package/lib/types/response/index.js +1 -0
  17. package/lib/types/response/index.js.map +1 -1
  18. package/lib/types/response/v5-account.d.ts +1 -0
  19. package/lib/types/response/v5-asset.d.ts +3 -0
  20. package/lib/types/response/v5-broker.d.ts +2 -1
  21. package/lib/types/response/v5-earn-liquidity-mining.d.ts +4 -0
  22. package/lib/types/response/v5-event.d.ts +208 -0
  23. package/lib/types/response/v5-event.js +3 -0
  24. package/lib/types/response/v5-event.js.map +1 -0
  25. package/lib/types/response/v5-market.d.ts +4 -0
  26. package/lib/types/response/v5-position.d.ts +1 -0
  27. package/lib/types/response/v5-user.d.ts +1 -0
  28. package/lib/types/shared-v5.d.ts +7 -3
  29. package/lib/types/websockets/ws-events.d.ts +107 -0
  30. package/lib/types/websockets/ws-general.d.ts +2 -2
  31. package/lib/util/requestUtils.d.ts +2 -2
  32. package/lib/util/websockets/websocket-util.d.ts +5 -4
  33. package/lib/util/websockets/websocket-util.js +17 -0
  34. package/lib/util/websockets/websocket-util.js.map +1 -1
  35. package/lib/websocket-client.d.ts +6 -6
  36. package/lib/websocket-client.js +3 -3
  37. package/lib/websocket-client.js.map +1 -1
  38. package/llms.txt +12311 -11737
  39. package/package.json +1 -1
@@ -34,6 +34,7 @@ __exportStar(require("./v5-earn-fixed-term"), exports);
34
34
  __exportStar(require("./v5-earn-liquidity-mining"), exports);
35
35
  __exportStar(require("./v5-earn-pwm"), exports);
36
36
  __exportStar(require("./v5-earn-token"), exports);
37
+ __exportStar(require("./v5-event"), exports);
37
38
  __exportStar(require("./v5-market"), exports);
38
39
  __exportStar(require("./v5-p2p-trading"), exports);
39
40
  __exportStar(require("./v5-position"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/response/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,6CAA2B;AAC3B,2CAAyB;AACzB,yCAAuB;AACvB,mDAAiC;AACjC,8CAA4B;AAC5B,+CAA6B;AAC7B,gDAA8B;AAC9B,wDAAsC;AACtC,mDAAiC;AACjC,6CAA2B;AAC3B,8CAA4B;AAC5B,4CAA0B;AAC1B,mDAAiC;AACjC,4CAA0B;AAC1B,6DAA2C;AAC3C,uDAAqC;AACrC,6DAA2C;AAC3C,gDAA8B;AAC9B,kDAAgC;AAChC,8CAA4B;AAC5B,mDAAiC;AACjC,gDAA8B;AAC9B,kDAAgC;AAChC,2CAAyB;AACzB,2CAAyB;AACzB,2DAAyC;AACzC,8CAA4B;AAC5B,qDAAmC;AACnC,gDAA8B;AAC9B,6CAA2B;AAC3B,4CAA0B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/response/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,6CAA2B;AAC3B,2CAAyB;AACzB,yCAAuB;AACvB,mDAAiC;AACjC,8CAA4B;AAC5B,+CAA6B;AAC7B,gDAA8B;AAC9B,wDAAsC;AACtC,mDAAiC;AACjC,6CAA2B;AAC3B,8CAA4B;AAC5B,4CAA0B;AAC1B,mDAAiC;AACjC,4CAA0B;AAC1B,6DAA2C;AAC3C,uDAAqC;AACrC,6DAA2C;AAC3C,gDAA8B;AAC9B,kDAAgC;AAChC,6CAA2B;AAC3B,8CAA4B;AAC5B,mDAAiC;AACjC,gDAA8B;AAC9B,kDAAgC;AAChC,2CAAyB;AACzB,2CAAyB;AACzB,2DAAyC;AACzC,8CAA4B;AAC5B,qDAAmC;AACnC,gDAA8B;AAC9B,6CAA2B;AAC3B,4CAA0B"}
@@ -82,6 +82,7 @@ export interface FeeRateV5 {
82
82
  baseCoin: string;
83
83
  takerFeeRate: string;
84
84
  makerFeeRate: string;
85
+ rpiMakerFeeRate?: string;
85
86
  }
86
87
  export interface AccountInfoV5 {
87
88
  unifiedMarginStatus: number;
@@ -82,6 +82,8 @@ export interface UniversalTransferRecordV5 {
82
82
  toAccountType: AccountTypeV5;
83
83
  timestamp: string;
84
84
  status: string;
85
+ withdrawReqId?: string;
86
+ depositReqId?: string;
85
87
  }
86
88
  export interface AllowedDepositCoinInfoV5 {
87
89
  coin: string;
@@ -324,6 +326,7 @@ export interface FundingAccountTransactionRecordV5 {
324
326
  showBusiTypeEn: string;
325
327
  description: string;
326
328
  descriptionEn: string;
329
+ currcCursor?: string;
327
330
  }
328
331
  /** When accountType=Alpha and category is farm, under `coinDetail` in sub-categories. */
329
332
  export interface AssetOverviewCoinExtMapV5 {
@@ -1,6 +1,6 @@
1
1
  interface EarningDetailV5 {
2
2
  userId: string;
3
- bizType: 'SPOT' | 'DERIVATIVES' | 'OPTIONS' | 'CONVERT';
3
+ bizType: 'SPOT' | 'DERIVATIVES' | 'OPTIONS' | 'CONVERT' | 'FIAT_CONVERT';
4
4
  symbol: string;
5
5
  coin: string;
6
6
  earning: string;
@@ -19,6 +19,7 @@ export interface ExchangeBrokerEarningResultV5 {
19
19
  derivatives: TotalEarningCategoryV5[];
20
20
  options: TotalEarningCategoryV5[];
21
21
  convert: TotalEarningCategoryV5[];
22
+ fiatConvert?: TotalEarningCategoryV5[];
22
23
  total: TotalEarningCategoryV5[];
23
24
  };
24
25
  details: EarningDetailV5[];
@@ -29,3 +29,7 @@ export interface LiquidityMiningProductV5 {
29
29
  export interface LiquidityMiningProductResultV5 {
30
30
  products: LiquidityMiningProductV5[];
31
31
  }
32
+ export interface ReinvestLiquidityMiningResultV5 {
33
+ orderId: string;
34
+ orderLinkId: string;
35
+ }
@@ -0,0 +1,208 @@
1
+ export type EventContractTypeV5 = 'Up_Down' | 'UpDown' | 'Target' | 'Range';
2
+ export type EventContractDirectionV5 = 'UP' | 'DOWN' | 'ABOVE' | 'BELOW' | 'RANGE_IN' | 'RANGE_OUT';
3
+ export interface EventInstrumentFeeRateRuleV5 {
4
+ minSecToDelivery: number;
5
+ maxSecToDelivery: number;
6
+ baseMarkup: string;
7
+ }
8
+ export interface EventInstrumentQuotationLimitV5 {
9
+ minSecToDelivery: number;
10
+ maxSecToDelivery: number;
11
+ quoteMaxAmountPerUser: string;
12
+ quoteMinAmountPerUser: string;
13
+ quoteMinAmount: string;
14
+ }
15
+ export interface EventInstrumentLotSizeFilterV5 {
16
+ minOrderAmount: string;
17
+ maxOrderAmount: string;
18
+ orderAmountTickSize: string;
19
+ quoteMaxValidMs: number;
20
+ quoteMinIntervalPerUserMs: number;
21
+ }
22
+ export interface EventInstrumentInfoV5 {
23
+ symbol: string;
24
+ symbolId: number;
25
+ baseCoin: string;
26
+ quoteCoin: string;
27
+ settleCoin: string;
28
+ eventContractType: EventContractTypeV5 | string;
29
+ durationWindow: string | number;
30
+ rvThreshold: string;
31
+ rebate: string;
32
+ takerFeeRate: string;
33
+ makerFeeRate: string;
34
+ launchTime: string;
35
+ deliveryTime: string;
36
+ status: string;
37
+ targetPrice: string;
38
+ lowerBound: string;
39
+ upperBound: string;
40
+ callOptionSymbolId: number;
41
+ putOptionSymbolId: number;
42
+ feeRateRule: EventInstrumentFeeRateRuleV5[];
43
+ lotSizeFilter: EventInstrumentLotSizeFilterV5;
44
+ quotationLimit: EventInstrumentQuotationLimitV5[];
45
+ }
46
+ export interface EventInstrumentInfoResultV5 {
47
+ nextPageCursor: string;
48
+ list: EventInstrumentInfoV5[];
49
+ }
50
+ /** REST Get Orderbook: each entry is [payoutRatio, orderValue] */
51
+ export type EventOrderbookLevelV5 = [string, string];
52
+ export interface EventOrderbookV5 {
53
+ s: string;
54
+ r: EventOrderbookLevelV5[];
55
+ ts: number;
56
+ u: number;
57
+ seq: number;
58
+ cts: number;
59
+ }
60
+ export interface EventOrderHistoryItemV5 {
61
+ orderId: string;
62
+ orderLinkId: string;
63
+ orderStatus: string;
64
+ symbol: string;
65
+ symbolId: string;
66
+ baseCoin: string;
67
+ quoteCoin: string;
68
+ settleCoin: string;
69
+ ecDirection: EventContractDirectionV5 | string;
70
+ ecDurationWindow: string;
71
+ ecTargetPrice: string;
72
+ ecContractType: EventContractTypeV5 | string;
73
+ ecLowerBound: string;
74
+ ecUpperBound: string;
75
+ settleTimeMs: string;
76
+ ecOrderValue: string;
77
+ ecIndexPrice: string;
78
+ orderAvgPayoutRatio: string;
79
+ cumExecValue: string;
80
+ payoutRatio: string;
81
+ tradeFee: string;
82
+ transTime: string;
83
+ createTime: string;
84
+ updateTime: string;
85
+ cumPayout: string;
86
+ cumExecFee: string;
87
+ cancelType: string;
88
+ createType: string;
89
+ rejectReason: string;
90
+ extraFees: string;
91
+ }
92
+ export interface EventOrderHistoryResultV5 {
93
+ list: EventOrderHistoryItemV5[];
94
+ cursor: string;
95
+ }
96
+ export interface EventActiveOrderV5 {
97
+ orderId: string;
98
+ orderLinkId: string;
99
+ symbol: string;
100
+ symbolId: string;
101
+ side: string;
102
+ orderStatus: string;
103
+ payoutRatio: string;
104
+ cumExecValue: string;
105
+ cumExecFee: string;
106
+ leavesValue: string;
107
+ ecContractType: EventContractTypeV5 | string;
108
+ ecDirection: EventContractDirectionV5 | string;
109
+ ecOrderValue: string;
110
+ ecSettleTime: string;
111
+ ecTargetPrice: string;
112
+ ecLowerBound: string;
113
+ ecUpperBound: string;
114
+ ecDurationWindow: string;
115
+ ecIndexPrice: string;
116
+ orderAvgPayoutRatio: string;
117
+ createType: string;
118
+ createdTime: string;
119
+ updatedTime: string;
120
+ }
121
+ export interface EventActiveOrdersResultV5 {
122
+ list: EventActiveOrderV5[];
123
+ nextPageCursor: string;
124
+ }
125
+ export interface EventPositionV5 {
126
+ symbol: string;
127
+ baseCoin: string;
128
+ settleCoin: string;
129
+ side: string;
130
+ ecContractType: EventContractTypeV5 | string;
131
+ ecDirection: EventContractDirectionV5 | string;
132
+ avgPayoutRatio: string;
133
+ positionValue: string;
134
+ ecSettleTime: string;
135
+ cumClosedPnl: string;
136
+ createdTime: string;
137
+ updatedTime: string;
138
+ seq: number;
139
+ }
140
+ export interface EventPositionInfoResultV5 {
141
+ list: EventPositionV5[];
142
+ nextPageCursor: string;
143
+ }
144
+ export interface EventTradeV5 {
145
+ orderId: string;
146
+ orderLinkId: string;
147
+ execId: string;
148
+ symbol: string;
149
+ baseCoin: string;
150
+ settleCoin: string;
151
+ side: string;
152
+ execType: string;
153
+ execPrice: string;
154
+ execValue: string;
155
+ execFee: string;
156
+ execFeeRate: string;
157
+ orderPrice: string;
158
+ feeCoin: string;
159
+ transTime: string;
160
+ timeInForce: string;
161
+ crossSeq: string;
162
+ ecPayout: string;
163
+ ecDurationWindow: string;
164
+ settleTimeMs: string;
165
+ ecOrderValue: string;
166
+ ecContractType: EventContractTypeV5 | string;
167
+ ecDirection: EventContractDirectionV5 | string;
168
+ ecTargetPrice: string;
169
+ ecLowerBound: string;
170
+ ecUpperBound: string;
171
+ extraFees: string;
172
+ }
173
+ export interface EventTradeHistoryResultV5 {
174
+ list: EventTradeV5[];
175
+ cursor: string;
176
+ }
177
+ export interface EventSettlementV5 {
178
+ transId: string;
179
+ symbol: string;
180
+ symbolId: string;
181
+ baseCoin: string;
182
+ settleCoin: string;
183
+ side: string;
184
+ ecContractType: EventContractTypeV5 | string;
185
+ ecDirection: EventContractDirectionV5 | string;
186
+ settlePrice: string;
187
+ entryPrice: string;
188
+ grossPayoutRatio: string;
189
+ ecDurationWindow: string;
190
+ ecTargetPrice: string;
191
+ ecLowerBound: string;
192
+ ecUpperBound: string;
193
+ transTime: string;
194
+ crossSeq: string;
195
+ execFee: string;
196
+ execFeeRate: string;
197
+ payout: string;
198
+ sessionRpl: string;
199
+ orderId: string;
200
+ }
201
+ export interface EventSettlementRecordsResultV5 {
202
+ list: EventSettlementV5[];
203
+ cursor: string;
204
+ }
205
+ export interface EventQuoteResultV5 {
206
+ orderLinkId: string;
207
+ orderId: string;
208
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=v5-event.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v5-event.js","sourceRoot":"","sources":["../../../src/types/response/v5-event.ts"],"names":[],"mappings":""}
@@ -87,6 +87,9 @@ export interface LinearInverseInstrumentInfoV5 {
87
87
  } | null;
88
88
  skipCallAuction?: boolean;
89
89
  displayName: string;
90
+ fullName?: string;
91
+ marketRegion?: string;
92
+ underlyingTicker?: string;
90
93
  }
91
94
  export interface OptionInstrumentInfoV5 {
92
95
  /** The ID of the symbol name. */
@@ -391,6 +394,7 @@ export interface FeeGroupLevelV5 {
391
394
  takerFeeRate: string;
392
395
  makerFeeRate: string;
393
396
  makerRebate: string;
397
+ rpiMakerRebate?: string;
394
398
  }
395
399
  export interface FeeGroupRatesV5 {
396
400
  pro: FeeGroupLevelV5[];
@@ -52,6 +52,7 @@ export interface PositionV5 {
52
52
  positionIMByMp: string;
53
53
  positionMMByMp: string;
54
54
  seq: number;
55
+ netDeltaRatio?: string;
55
56
  }
56
57
  export interface SetRiskLimitResultV5 {
57
58
  category: CategoryV5;
@@ -68,6 +68,7 @@ export interface ApiKeyInfoV5 {
68
68
  parentUid: string;
69
69
  kycLevel: 'LEVEL_DEFAULT' | 'LEVEL_1' | 'LEVEL_2';
70
70
  kycRegion: string;
71
+ isFixApi?: boolean;
71
72
  }
72
73
  export interface UpdateApiKeyResultV5 {
73
74
  id: string;
@@ -1,7 +1,9 @@
1
1
  export type CategoryV5 = 'spot' | 'linear' | 'inverse' | 'option';
2
+ /** Public WS subscribe/routing category. Event Contract uses `'event'`; REST `CategoryV5` does not. */
3
+ export type WSCategoryV5 = CategoryV5 | 'event';
2
4
  export type ContractTypeV5 = 'InversePerpetual' | 'LinearPerpetual' | 'InverseFutures';
3
5
  export type CopyTradingV5 = 'none' | 'both' | 'utaOnly' | 'normalOnly';
4
- export type InstrumentStatusV5 = 'PreLaunch' | 'Trading' | 'Settling' | 'Delivering' | 'Closed';
6
+ export type InstrumentStatusV5 = 'PreLaunch' | 'PendingOpen' | 'Trading' | 'Settling' | 'Delivering' | 'Closed';
5
7
  /**
6
8
  * Region / product class returned as `symbolType` on instruments-info (and account instruments-info).
7
9
  * For `category=linear`, includes e.g. `stock`, `forex`, `commodity`, `xstocks`. Spot may return `''`.
@@ -111,7 +113,7 @@ export type TPSLModeV5 = 'Full' | 'Partial';
111
113
  export type AccountMarginModeV5 = 'ISOLATED_MARGIN' | 'REGULAR_MARGIN' | 'PORTFOLIO_MARGIN';
112
114
  export type UnifiedUpdateStatusV5 = 'FAIL' | 'PROCESS' | 'SUCCESS';
113
115
  export type AccountTypeV5 = 'CONTRACT' | 'SPOT' | 'INVESTMENT' | 'OPTION' | 'UNIFIED' | 'FUND' | 'EARN';
114
- export type TransactionTypeV5 = 'TRANSFER_IN' | 'TRANSFER_OUT' | 'TRADE' | 'SETTLEMENT' | 'DELIVERY' | 'LIQUIDATION' | 'ADL' | 'AIRDROP' | 'BONUS_RECOLLECT' | 'BONUS_RECOLLECT' | 'FEE_REFUND' | 'INTEREST' | 'CURRENCY_BUY' | 'CURRENCY_SELL' | 'BORROWED_AMOUNT_INS_LOAN' | 'PRINCIPLE_REPAYMENT_INS_LOAN' | 'INTEREST_REPAYMENT_INS_LOAN' | 'AUTO_SOLD_COLLATERAL_INS_LOAN' | 'AUTO_BUY_LIABILITY_INS_LOAN' | 'AUTO_PRINCIPLE_REPAYMENT_INS_LOAN' | 'AUTO_INTEREST_REPAYMENT_INS_LOAN' | 'TRANSFER_IN_INS_LOAN' | 'TRANSFER_OUT_INS_LOAN' | 'SPOT_REPAYMENT_SELL' | 'SPOT_REPAYMENT_BUY' | 'TOKENS_SUBSCRIPTION' | 'TOKENS_REDEMPTION' | 'AUTO_DEDUCTION' | 'FLEXIBLE_STAKING_SUBSCRIPTION' | 'FLEXIBLE_STAKING_REDEMPTION' | 'FIXED_STAKING_SUBSCRIPTION' | 'BORROWED_AMOUNT_INS_LOAN' | 'PRINCIPLE_REPAYMENT_INS_LOAN' | 'INTEREST_REPAYMENT_INS_LOAN' | 'AUTO_SOLD_COLLATERAL_INS_LOAN' | 'AUTO_BUY_LIABILITY_INS_LOAN' | 'AUTO_PRINCIPLE_REPAYMENT_INS_LOAN' | 'AUTO_INTEREST_REPAYMENT_INS_LOAN' | 'TRANSFER_IN_INS_LOAN' | 'TRANSFER_OUT_INS_LOAN' | 'SPOT_REPAYMENT_SELL' | 'SPOT_REPAYMENT_BUY' | 'TOKENS_SUBSCRIPTION' | 'TOKENS_REDEMPTION' | 'AUTO_DEDUCTION' | 'FLEXIBLE_STAKING_SUBSCRIPTION' | 'FLEXIBLE_STAKING_REDEMPTION' | 'FIXED_STAKING_SUBSCRIPTION' | 'FLEXIBLE_STAKING_REFUND' | 'FIXED_STAKING_REFUND' | 'PREMARKET_TRANSFER_OUT' | 'PREMARKET_DELIVERY_SELL_NEW_COIN' | 'PREMARKET_DELIVERY_BUY_NEW_COIN' | 'PREMARKET_DELIVERY_PLEDGE_PAY_SELLER' | 'PREMARKET_DELIVERY_PLEDGE_BACK' | 'PREMARKET_ROLLBACK_PLEDGE_BACK' | 'PREMARKET_ROLLBACK_PLEDGE_PENALTY_TO_BUYER' | 'CUSTODY_NETWORK_FEE' | 'CUSTODY_SETTLE_FEE' | 'CUSTODY_LOCK' | 'CUSTODY_UNLOCK' | 'CUSTODY_UNLOCK_REFUND' | 'LOANS_BORROW_FUNDS' | 'LOANS_PLEDGE_ASSET' | 'BONUS_TRANSFER_IN' | 'BONUS_TRANSFER_OUT' | 'PEF_TRANSFER_IN' | 'PEF_TRANSFER_OUT' | 'PEF_PROFIT_SHARE' | 'ONCHAINEARN_SUBSCRIPTION' | 'ONCHAINEARN_REDEMPTION' | 'ONCHAINEARN_REFUND' | 'STRUCTURE_PRODUCT_SUBSCRIPTION' | 'STRUCTURE_PRODUCT_REFUND' | 'CLASSIC_WEALTH_MANAGEMENT_SUBSCRIPTION' | 'PREMIMUM_WEALTH_MANAGEMENT_SUBSCRIPTION' | 'PREMIMUM_WEALTH_MANAGEMENT_REFUND' | 'LIQUIDITY_MINING_SUBSCRIPTION' | 'LIQUIDITY_MINING_REFUND' | 'PWM_SUBSCRIPTION' | 'PWM_REFUND' | 'DEFI_INVESTMENT_SUBSCRIPTION' | 'DEFI_INVESTMENT_REFUND' | 'DEFI_INVESTMENT_REDEMPTION' | 'INSTITUTION_LOAN_IN' | 'INSTITUTION_PAYBACK_PRINCIPAL_OUT' | 'INSTITUTION_PAYBACK_INTEREST_OUT' | 'INSTITUTION_EXCHANGE_SELL' | 'INSTITUTION_EXCHANGE_BUY' | 'INSTITUTION_LIQ_PRINCIPAL_OUT' | 'INSTITUTION_LIQ_INTEREST_OUT' | 'INSTITUTION_LOAN_TRANSFER_IN' | 'INSTITUTION_LOAN_TRANSFER_OUT' | 'INSTITUTION_LOAN_WITHOUT_WITHDRAW' | 'INSTITUTION_LOAN_RESERVE_IN' | 'INSTITUTION_LOAN_RESERVE_OUT' | 'PLATFORM_TOKEN_MNT_LIQRECALLEDMMNT' | 'PLATFORM_TOKEN_MNT_LIQRETURNEDMNT' | 'DIVIDEND_SETTLEMENT';
116
+ export type TransactionTypeV5 = 'TRANSFER_IN' | 'TRANSFER_OUT' | 'TRADE' | 'SETTLEMENT' | 'DELIVERY' | 'LIQUIDATION' | 'ADL' | 'AIRDROP' | 'BONUS_RECOLLECT' | 'BONUS_RECOLLECT' | 'FEE_REFUND' | 'INTEREST' | 'CURRENCY_BUY' | 'CURRENCY_SELL' | 'BORROWED_AMOUNT_INS_LOAN' | 'PRINCIPLE_REPAYMENT_INS_LOAN' | 'INTEREST_REPAYMENT_INS_LOAN' | 'AUTO_SOLD_COLLATERAL_INS_LOAN' | 'AUTO_BUY_LIABILITY_INS_LOAN' | 'AUTO_PRINCIPLE_REPAYMENT_INS_LOAN' | 'AUTO_INTEREST_REPAYMENT_INS_LOAN' | 'TRANSFER_IN_INS_LOAN' | 'TRANSFER_OUT_INS_LOAN' | 'SPOT_REPAYMENT_SELL' | 'SPOT_REPAYMENT_BUY' | 'TOKENS_SUBSCRIPTION' | 'TOKENS_REDEMPTION' | 'AUTO_DEDUCTION' | 'FLEXIBLE_STAKING_SUBSCRIPTION' | 'FLEXIBLE_STAKING_REDEMPTION' | 'FIXED_STAKING_SUBSCRIPTION' | 'BORROWED_AMOUNT_INS_LOAN' | 'PRINCIPLE_REPAYMENT_INS_LOAN' | 'INTEREST_REPAYMENT_INS_LOAN' | 'AUTO_SOLD_COLLATERAL_INS_LOAN' | 'AUTO_BUY_LIABILITY_INS_LOAN' | 'AUTO_PRINCIPLE_REPAYMENT_INS_LOAN' | 'AUTO_INTEREST_REPAYMENT_INS_LOAN' | 'TRANSFER_IN_INS_LOAN' | 'TRANSFER_OUT_INS_LOAN' | 'SPOT_REPAYMENT_SELL' | 'SPOT_REPAYMENT_BUY' | 'TOKENS_SUBSCRIPTION' | 'TOKENS_REDEMPTION' | 'AUTO_DEDUCTION' | 'FLEXIBLE_STAKING_SUBSCRIPTION' | 'FLEXIBLE_STAKING_REDEMPTION' | 'FIXED_STAKING_SUBSCRIPTION' | 'FLEXIBLE_STAKING_REFUND' | 'FIXED_STAKING_REFUND' | 'PREMARKET_TRANSFER_OUT' | 'PREMARKET_DELIVERY_SELL_NEW_COIN' | 'PREMARKET_DELIVERY_BUY_NEW_COIN' | 'PREMARKET_DELIVERY_PLEDGE_PAY_SELLER' | 'PREMARKET_DELIVERY_PLEDGE_BACK' | 'PREMARKET_ROLLBACK_PLEDGE_BACK' | 'PREMARKET_ROLLBACK_PLEDGE_PENALTY_TO_BUYER' | 'CUSTODY_NETWORK_FEE' | 'CUSTODY_SETTLE_FEE' | 'CUSTODY_LOCK' | 'CUSTODY_UNLOCK' | 'CUSTODY_UNLOCK_REFUND' | 'LOANS_BORROW_FUNDS' | 'LOANS_PLEDGE_ASSET' | 'BONUS_TRANSFER_IN' | 'BONUS_TRANSFER_OUT' | 'PEF_TRANSFER_IN' | 'PEF_TRANSFER_OUT' | 'PEF_PROFIT_SHARE' | 'ONCHAINEARN_SUBSCRIPTION' | 'ONCHAINEARN_REDEMPTION' | 'ONCHAINEARN_REFUND' | 'STRUCTURE_PRODUCT_SUBSCRIPTION' | 'STRUCTURE_PRODUCT_REFUND' | 'CLASSIC_WEALTH_MANAGEMENT_SUBSCRIPTION' | 'PREMIMUM_WEALTH_MANAGEMENT_SUBSCRIPTION' | 'PREMIMUM_WEALTH_MANAGEMENT_REFUND' | 'LIQUIDITY_MINING_SUBSCRIPTION' | 'LIQUIDITY_MINING_REFUND' | 'PWM_SUBSCRIPTION' | 'PWM_REFUND' | 'DEFI_INVESTMENT_SUBSCRIPTION' | 'DEFI_INVESTMENT_REFUND' | 'DEFI_INVESTMENT_REDEMPTION' | 'INSTITUTION_LOAN_IN' | 'INSTITUTION_PAYBACK_PRINCIPAL_OUT' | 'INSTITUTION_PAYBACK_INTEREST_OUT' | 'INSTITUTION_EXCHANGE_SELL' | 'INSTITUTION_EXCHANGE_BUY' | 'INSTITUTION_LIQ_PRINCIPAL_OUT' | 'INSTITUTION_LIQ_INTEREST_OUT' | 'INSTITUTION_LOAN_TRANSFER_IN' | 'INSTITUTION_LOAN_TRANSFER_OUT' | 'INSTITUTION_LOAN_WITHOUT_WITHDRAW' | 'INSTITUTION_LOAN_RESERVE_IN' | 'INSTITUTION_LOAN_RESERVE_OUT' | 'PLATFORM_TOKEN_MNT_LIQRECALLEDMMNT' | 'PLATFORM_TOKEN_MNT_LIQRETURNEDMNT' | 'DIVIDEND_SETTLEMENT' | 'FORWARD_SPLIT_SETTLE' | 'REVERSE_SPLIT_SETTLE';
115
117
  export type PermissionTypeV5 = 'ContractTrade' | 'Spot' | 'Wallet' | 'Options' | 'Derivatives' | 'Exchange' | 'NFT';
116
118
  /**
117
119
  * Leveraged token status:
@@ -131,7 +133,9 @@ export type LTOrderTypeV5 = '1' | '2';
131
133
  * Leveraged token order status: '1': completed, '2': in progress, '3': failed
132
134
  */
133
135
  export type LTOrderStatusV5 = '1' | '2' | '3';
134
- export type ExecTypeV5 = 'Trade' | 'AdlTrade' | 'Funding' | 'BustTrade' | 'Settle' | 'BlockTrade' | 'MovePosition' | 'CorporateAction' | 'UNKNOWN';
136
+ export type ExecTypeV5 = 'Trade' | 'AdlTrade' | 'Funding' | 'BustTrade' | 'Settle' | 'BlockTrade' | 'MovePosition'
137
+ /** @deprecated Removed from Bybit execType; kept for older payloads. */
138
+ | 'CorporateAction' | 'ForwardSplitSettle' | 'ReverseSplitSettle' | 'Dividend' | 'UNKNOWN';
135
139
  /**
136
140
  * Withdraw type. 0(default): on chain. 1: off chain. 2: all.
137
141
  */
@@ -62,6 +62,22 @@ export interface WSTradeV5 {
62
62
  iv?: string;
63
63
  }
64
64
  export type WSTradeEventV5 = WSPublicTopicEventV5<string, 'snapshot', WSTradeV5[]>;
65
+ export interface WSEventOrderbookV5 {
66
+ s: string;
67
+ r: [string, string][];
68
+ u: number;
69
+ seq: number;
70
+ }
71
+ export type WSEventOrderbookEventV5 = WSPublicTopicEventV5<string, 'delta' | 'snapshot', WSEventOrderbookV5>;
72
+ export interface WSEventPublicTradeV5 {
73
+ T: number;
74
+ s: string;
75
+ r: string;
76
+ a: string;
77
+ i: string;
78
+ seq: number;
79
+ }
80
+ export type WSEventPublicTradeEventV5 = WSPublicTopicEventV5<string, 'snapshot', WSEventPublicTradeV5[]>;
65
81
  /**
66
82
  * WSTickerV5 is the data structure for the "linear" ticker channel
67
83
  * */
@@ -204,8 +220,25 @@ export interface WSPositionV5 {
204
220
  /** Position open timestamp (ms). Default `0` when not set. */
205
221
  openTime: number;
206
222
  seq: number;
223
+ netDeltaRatio?: string;
207
224
  }
208
225
  export type WSPositionEventV5 = WSPrivateTopicEventV5<'position', WSPositionV5[]>;
226
+ export interface WSEventPositionV5 {
227
+ symbol: string;
228
+ baseCoin: string;
229
+ settleCoin: string;
230
+ side: string;
231
+ ecContractType: string;
232
+ ecDirection: string;
233
+ avgPayoutRatio: string;
234
+ positionValue: string;
235
+ ecSettleTime: string;
236
+ cumClosedPnl: string;
237
+ createdTime: string;
238
+ updatedTime: string;
239
+ seq: number;
240
+ }
241
+ export type WSEventPositionEventV5 = WSPrivateTopicEventV5<'position.event', WSEventPositionV5[]>;
209
242
  export interface WSAccountOrderV5 {
210
243
  category: CategoryV5;
211
244
  orderId: string;
@@ -260,6 +293,41 @@ export interface WSAccountOrderV5 {
260
293
  rpiMatchedQty?: string;
261
294
  }
262
295
  export type WSAccountOrderEventV5 = WSPrivateTopicEventV5<'order', WSAccountOrderV5[]>;
296
+ export interface WSEventOrderV5 {
297
+ category: 'event' | string;
298
+ orderId: string;
299
+ orderLinkId: string;
300
+ symbol: string;
301
+ symbolId: number;
302
+ side: string;
303
+ baseCoin: string;
304
+ quoteCoin: string;
305
+ settleCoin: string;
306
+ orderStatus: string;
307
+ ecContractType: string;
308
+ ecDirection: string;
309
+ ecDurationWindow: number;
310
+ ecTargetPrice: string;
311
+ ecLowerBound: string;
312
+ ecUpperBound: string;
313
+ ecOrderValue: string;
314
+ ecIndexPrice: string;
315
+ ecSettleTime: string;
316
+ payoutRatio: string;
317
+ orderAvgPayoutRatio: string;
318
+ cumExecValue: string;
319
+ cumExecFee: string;
320
+ leavesValue: string;
321
+ cumPayout: string;
322
+ createType: number;
323
+ cancelType: string;
324
+ rejectReason: string;
325
+ extraFees: unknown[];
326
+ transTime: string;
327
+ createdTime: string;
328
+ updatedTime: string;
329
+ }
330
+ export type WSEventOrderEventV5 = WSPrivateTopicEventV5<'order' | 'order.event', WSEventOrderV5[]>;
263
331
  export interface WSExecutionV5 {
264
332
  category: CategoryV5;
265
333
  symbol: string;
@@ -296,6 +364,45 @@ export interface WSExecutionV5 {
296
364
  marketUnit: string;
297
365
  }
298
366
  export type WSExecutionEventV5 = WSPrivateTopicEventV5<'execution', WSExecutionV5[]>;
367
+ export interface WSEventExecutionV5 {
368
+ category: 'event' | string;
369
+ transId: string;
370
+ execId: string;
371
+ orderId: string;
372
+ orderLinkId: string;
373
+ symbol: string;
374
+ symbolId: number;
375
+ baseCoin: string;
376
+ quoteCoin: string;
377
+ settleCoin: string;
378
+ side: string;
379
+ feeCoin: string;
380
+ execType: string;
381
+ execPrice: string;
382
+ execValue: string;
383
+ execFee: string;
384
+ execFeeRate: string;
385
+ orderPrice: string;
386
+ ecContractType: number | string;
387
+ ecDirection: number | string;
388
+ ecDurationWindow: number;
389
+ ecTargetPrice: string;
390
+ ecLowerBound: string;
391
+ ecUpperBound: string;
392
+ ecOrderValue: string;
393
+ ecIndexPrice?: string;
394
+ ecPayout: string;
395
+ entryPrice: string;
396
+ settlePrice: string;
397
+ grossPayoutRatio: string;
398
+ sessionRpl: string;
399
+ transTime: string;
400
+ settleTimeMs: string;
401
+ crossSeq: string;
402
+ timeInForce: string;
403
+ extraFees: unknown[];
404
+ }
405
+ export type WSEventExecutionEventV5 = WSPrivateTopicEventV5<'execution' | 'execution.event', WSEventExecutionV5[]>;
299
406
  export interface WSExecutionFastV5 {
300
407
  category: CategoryV5;
301
408
  symbol: string;
@@ -59,8 +59,8 @@ export interface WSClientConfigurableOptions {
59
59
  apiRegion?: APIRegion;
60
60
  /**
61
61
  * Site ID sent as `x-site-id` during the Node.js WebSocket handshake.
62
- * Required for eligible international accounts that use the global stream domain,
63
- * e.g. `BRA_BTL` for Brazil or `ARG_BTL` for Argentina.
62
+ * Brazil and Argentina internal accounts now use `stream.bybit.com` without this header.
63
+ * Keep passing it only if a remaining site still requires `x-site-id`.
64
64
  */
65
65
  siteId?: string;
66
66
  /**
@@ -53,8 +53,8 @@ export interface RestClientOptions {
53
53
  /**
54
54
  * Site ID sent as the `x-site-id` header on every REST request.
55
55
  * WebSocket clients expose the same top-level `siteId` option.
56
- * Required for eligible international accounts that use the global API domain,
57
- * e.g. `BRA_BTL` for Brazil or `ARG_BTL` for Argentina.
56
+ * Brazil and Argentina internal accounts now use `api.bybit.com` without this header.
57
+ * Keep passing it only if a remaining site still requires `x-site-id`.
58
58
  * @see https://bybit-exchange.github.io/docs/v5/guide#authentication
59
59
  */
60
60
  siteId?: string;
@@ -1,5 +1,5 @@
1
1
  import WebSocket from 'isomorphic-ws';
2
- import { APIMarket, CategoryV5, WebsocketClientOptions, WsKey, WsTopic } from '../../types';
2
+ import { APIMarket, WebsocketClientOptions, WSCategoryV5, WsKey, WsTopic } from '../../types';
3
3
  import { WSAPIRequest } from '../../types/websockets/ws-api';
4
4
  import { DefaultLogger } from '../logger';
5
5
  export declare const WS_KEY_MAP: {
@@ -7,6 +7,7 @@ export declare const WS_KEY_MAP: {
7
7
  readonly v5LinearPublic: "v5LinearPublic";
8
8
  readonly v5InversePublic: "v5InversePublic";
9
9
  readonly v5OptionPublic: "v5OptionPublic";
10
+ readonly v5EventPublic: "v5EventPublic";
10
11
  readonly v5Private: "v5Private";
11
12
  /**
12
13
  * The V5 Websocket API (for sending orders over WS)
@@ -25,7 +26,7 @@ export declare const PUBLIC_WS_KEYS: string[];
25
26
  export interface WsTopicRequest<TWSTopic extends string = string, TWSPayload = unknown> {
26
27
  topic: TWSTopic;
27
28
  payload?: TWSPayload;
28
- category?: CategoryV5;
29
+ category?: WSCategoryV5;
29
30
  }
30
31
  /**
31
32
  * Conveniently allow users to request a topic either as string topics or objects (containing string topic + params)
@@ -47,10 +48,10 @@ type PublicPrivateNetwork = 'public' | 'private';
47
48
  * For the unified keys, the "split" happens using the symbol. Symbols suffixed with USDT are obviously USDT topics.
48
49
  * For the v5 endpoints, the subscribe/unsubscribe call must specify the category the subscription should route to.
49
50
  */
50
- type PublicOnlyWsKeys = 'v5SpotPublic' | 'v5LinearPublic' | 'v5InversePublic' | 'v5OptionPublic';
51
+ type PublicOnlyWsKeys = 'v5SpotPublic' | 'v5LinearPublic' | 'v5InversePublic' | 'v5OptionPublic' | 'v5EventPublic';
51
52
  export declare const WS_BASE_URL_MAP: Record<APIMarket, Record<PublicPrivateNetwork, NetworkMapV3>> & Record<PublicOnlyWsKeys, Record<'public', NetworkMapV3>> & Record<typeof WS_KEY_MAP.v5PrivateTrade, Record<PublicPrivateNetwork, NetworkMapV3>>;
52
53
  export declare function isPrivateWsTopic(topic: string): boolean;
53
- export declare function getWsKeyForTopic(market: APIMarket, topic: string, isPrivate?: boolean, category?: CategoryV5): WsKey;
54
+ export declare function getWsKeyForTopic(market: APIMarket, topic: string, isPrivate?: boolean, category?: WSCategoryV5): WsKey;
54
55
  export declare function getWsUrl(wsKey: WsKey, wsClientOptions: WebsocketClientOptions, logger: DefaultLogger): string;
55
56
  export declare function getMaxTopicsPerSubscribeEvent(market: APIMarket, wsKey: WsKey): number | null;
56
57
  export declare const WS_ERROR_ENUM: {
@@ -15,6 +15,7 @@ exports.WS_KEY_MAP = {
15
15
  v5LinearPublic: 'v5LinearPublic',
16
16
  v5InversePublic: 'v5InversePublic',
17
17
  v5OptionPublic: 'v5OptionPublic',
18
+ v5EventPublic: 'v5EventPublic',
18
19
  v5Private: 'v5Private',
19
20
  /**
20
21
  * The V5 Websocket API (for sending orders over WS)
@@ -30,6 +31,7 @@ exports.PUBLIC_WS_KEYS = [
30
31
  exports.WS_KEY_MAP.v5LinearPublic,
31
32
  exports.WS_KEY_MAP.v5InversePublic,
32
33
  exports.WS_KEY_MAP.v5OptionPublic,
34
+ exports.WS_KEY_MAP.v5EventPublic,
33
35
  ];
34
36
  /** Used to automatically determine if a sub request should be to the public or private ws (when there's two) */
35
37
  const PRIVATE_TOPICS = [
@@ -71,11 +73,13 @@ const PRIVATE_TOPICS = [
71
73
  'position.linear',
72
74
  'position.inverse',
73
75
  'position.option',
76
+ 'position.event',
74
77
  'execution',
75
78
  'execution.spot',
76
79
  'execution.linear',
77
80
  'execution.inverse',
78
81
  'execution.option',
82
+ 'execution.event',
79
83
  // v5 fast execution topics are private
80
84
  'execution.fast',
81
85
  'execution.fast.linear',
@@ -87,6 +91,7 @@ const PRIVATE_TOPICS = [
87
91
  'order.linear',
88
92
  'order.inverse',
89
93
  'order.option',
94
+ 'order.event',
90
95
  'wallet',
91
96
  'greeks',
92
97
  // v5 DCP topics
@@ -141,6 +146,12 @@ exports.WS_BASE_URL_MAP = {
141
146
  testnet: 'wss://stream-testnet.bybit.com/v5/public/option',
142
147
  },
143
148
  },
149
+ v5EventPublic: {
150
+ public: {
151
+ livenet: 'wss://stream.bybit.com/v5/public/event',
152
+ testnet: 'wss://stream-testnet.bybit.com/v5/public/event',
153
+ },
154
+ },
144
155
  };
145
156
  const WS_MAINNET_REGION_DOMAIN_MAP = {
146
157
  TK: 'stream.bybit.tr',
@@ -173,6 +184,9 @@ function getWsKeyForTopic(market, topic, isPrivate, category) {
173
184
  case 'option': {
174
185
  return exports.WS_KEY_MAP.v5OptionPublic;
175
186
  }
187
+ case 'event': {
188
+ return exports.WS_KEY_MAP.v5EventPublic;
189
+ }
176
190
  case undefined: {
177
191
  throw new Error('Category cannot be undefined');
178
192
  }
@@ -229,6 +243,9 @@ function getWsUrl(wsKey, wsClientOptions, logger) {
229
243
  case exports.WS_KEY_MAP.v5OptionPublic: {
230
244
  return resolveUrl('/v5/public/option', exports.WS_BASE_URL_MAP.v5OptionPublic.public[networkKey]);
231
245
  }
246
+ case exports.WS_KEY_MAP.v5EventPublic: {
247
+ return resolveUrl('/v5/public/event', exports.WS_BASE_URL_MAP.v5EventPublic.public[networkKey]);
248
+ }
232
249
  default: {
233
250
  logger.error('getWsUrl(): Unhandled wsKey: ', {
234
251
  category: 'bybit-ws',