okx-api 3.1.2 → 3.1.4

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 (55) hide show
  1. package/README.md +1 -0
  2. package/dist/cjs/index.d.ts +2 -0
  3. package/dist/cjs/index.js +2 -0
  4. package/dist/cjs/index.js.map +1 -1
  5. package/dist/cjs/rest-client.d.ts +66 -31
  6. package/dist/cjs/rest-client.js +71 -4
  7. package/dist/cjs/rest-client.js.map +1 -1
  8. package/dist/cjs/types/rest/request/account.d.ts +13 -1
  9. package/dist/cjs/types/rest/request/convert.d.ts +4 -0
  10. package/dist/cjs/types/rest/request/dual-investment.d.ts +35 -0
  11. package/dist/cjs/types/rest/request/dual-investment.js +3 -0
  12. package/dist/cjs/types/rest/request/dual-investment.js.map +1 -0
  13. package/dist/cjs/types/rest/request/funding.d.ts +8 -0
  14. package/dist/cjs/types/rest/request/public.d.ts +45 -0
  15. package/dist/cjs/types/rest/request/trade.d.ts +68 -48
  16. package/dist/cjs/types/rest/response/private-account.d.ts +42 -2
  17. package/dist/cjs/types/rest/response/private-dual-investment.d.ts +87 -0
  18. package/dist/cjs/types/rest/response/private-dual-investment.js +3 -0
  19. package/dist/cjs/types/rest/response/private-dual-investment.js.map +1 -0
  20. package/dist/cjs/types/rest/response/private-flexible-loan.d.ts +22 -0
  21. package/dist/cjs/types/rest/response/private-trade.d.ts +30 -6
  22. package/dist/cjs/types/rest/response/public-data.d.ts +147 -0
  23. package/dist/cjs/types/rest/shared.d.ts +1 -1
  24. package/dist/cjs/types/websockets/ws-api-request.d.ts +21 -2
  25. package/dist/cjs/types/websockets/ws-api-response.d.ts +11 -0
  26. package/dist/cjs/types/websockets/ws-events.d.ts +1 -0
  27. package/dist/cjs/types/websockets/ws-request.d.ts +11 -4
  28. package/dist/mjs/index.d.ts +2 -0
  29. package/dist/mjs/index.js +2 -0
  30. package/dist/mjs/index.js.map +1 -1
  31. package/dist/mjs/rest-client.d.ts +66 -31
  32. package/dist/mjs/rest-client.js +71 -4
  33. package/dist/mjs/rest-client.js.map +1 -1
  34. package/dist/mjs/types/rest/request/account.d.ts +13 -1
  35. package/dist/mjs/types/rest/request/convert.d.ts +4 -0
  36. package/dist/mjs/types/rest/request/dual-investment.d.ts +35 -0
  37. package/dist/mjs/types/rest/request/dual-investment.js +2 -0
  38. package/dist/mjs/types/rest/request/dual-investment.js.map +1 -0
  39. package/dist/mjs/types/rest/request/funding.d.ts +8 -0
  40. package/dist/mjs/types/rest/request/public.d.ts +45 -0
  41. package/dist/mjs/types/rest/request/trade.d.ts +68 -48
  42. package/dist/mjs/types/rest/response/private-account.d.ts +42 -2
  43. package/dist/mjs/types/rest/response/private-dual-investment.d.ts +87 -0
  44. package/dist/mjs/types/rest/response/private-dual-investment.js +2 -0
  45. package/dist/mjs/types/rest/response/private-dual-investment.js.map +1 -0
  46. package/dist/mjs/types/rest/response/private-flexible-loan.d.ts +22 -0
  47. package/dist/mjs/types/rest/response/private-trade.d.ts +30 -6
  48. package/dist/mjs/types/rest/response/public-data.d.ts +147 -0
  49. package/dist/mjs/types/rest/shared.d.ts +1 -1
  50. package/dist/mjs/types/websockets/ws-api-request.d.ts +21 -2
  51. package/dist/mjs/types/websockets/ws-api-response.d.ts +11 -0
  52. package/dist/mjs/types/websockets/ws-events.d.ts +1 -0
  53. package/dist/mjs/types/websockets/ws-request.d.ts +11 -4
  54. package/llms.txt +7972 -7170
  55. package/package.json +1 -1
@@ -1,4 +1,5 @@
1
1
  import { AccountLevel, MarginMode, PositionSide, WithdrawState } from '../shared.js';
2
+ import type { InstrumentUpcomingParamChange } from './public-data.js';
2
3
  export interface AccountBalanceDetail {
3
4
  availBal: string;
4
5
  availEq: string;
@@ -164,9 +165,25 @@ export interface AccountBill {
164
165
  earnAmt?: string;
165
166
  earnApr?: string;
166
167
  }
168
+ export interface BillSubTypeDetail {
169
+ subType: string;
170
+ subTypeDesc: string;
171
+ }
172
+ /**
173
+ * @see GET /api/v5/account/subtypes
174
+ */
175
+ export interface AccountBillTypeDefinition {
176
+ type: string;
177
+ typeDesc: string;
178
+ subTypeDetails: BillSubTypeDetail[];
179
+ }
180
+ /**
181
+ * Apply (POST) may return { result, ts }; get link (GET) may return { fileHref, state, ts }.
182
+ */
167
183
  export interface AccountHistoryBill {
168
- fileHref: string;
169
- result: string;
184
+ fileHref?: string;
185
+ result?: string;
186
+ state?: 'finished' | 'ongoing' | 'failed' | string;
170
187
  ts: string;
171
188
  }
172
189
  export interface AccountConfiguration {
@@ -261,6 +278,7 @@ export interface AccountFeeRate {
261
278
  makerU: string;
262
279
  taker: string;
263
280
  takerU: string;
281
+ settle?: string;
264
282
  ts: string;
265
283
  ruleType: string;
266
284
  feeGroup?: FeeGroup[];
@@ -341,6 +359,14 @@ export interface AccountInstrument {
341
359
  instFamily: string;
342
360
  instId: string;
343
361
  instType: string;
362
+ seriesId?: string;
363
+ uly?: string;
364
+ /**
365
+ * FUTURES label (deprecated — prefer `expTime`; may include this_five_years, next_five_years, …).
366
+ */
367
+ alias?: string;
368
+ /** Deprecated; see `instCategory` on public `Instrument` where used. */
369
+ category?: string;
344
370
  lever: string;
345
371
  listTime: string;
346
372
  contTdSwTime: string;
@@ -360,17 +386,31 @@ export interface AccountInstrument {
360
386
  quoteCcy: string;
361
387
  tradeQuoteCcyList: string[];
362
388
  settleCcy: string;
389
+ /** Instrument status: live, suspend, rebase (SWAP only), preopen, test */
363
390
  state: string;
364
391
  stk: string;
365
392
  tickSz: string;
393
+ /** Trading rule types: normal, pre_market, rebase_contract */
366
394
  ruleType: string;
367
395
  auctionEndTime: string;
368
396
  futureSettlement: boolean;
369
397
  instIdCode: number;
398
+ /**
399
+ * Asset category of the instrument's base asset (see public `Instrument.instCategory` for values).
400
+ * 1: Crypto, 3: Stocks, 4: Commodities, 5: Forex, 6: Bonds, "": not available
401
+ */
402
+ instCategory?: string;
370
403
  posLmtAmt: string;
371
404
  posLmtPct: string;
372
405
  maxPlatOILmt: string;
406
+ /** Remaining long position value (USD) the user is permitted to open. Applicable to SWAP/FUTURES. */
407
+ longPosRemainingQuota?: string;
408
+ /** Remaining short position value (USD) the user is permitted to open. Applicable to SWAP/FUTURES. */
409
+ shortPosRemainingQuota?: string;
373
410
  groupId?: string;
411
+ /** ELP maker permission. "0" = not enabled, "1" = enabled but no permission, "2" = enabled with permission */
412
+ elp?: string;
413
+ upcChg?: InstrumentUpcomingParamChange[];
374
414
  }
375
415
  export interface QuickMarginBorrowRepayResult {
376
416
  instId: string;
@@ -0,0 +1,87 @@
1
+ export interface DcdCurrencyPair {
2
+ baseCcy: string;
3
+ quoteCcy: string;
4
+ optType: 'C' | 'P';
5
+ uly: string;
6
+ }
7
+ export interface DcdProduct {
8
+ absYield: string;
9
+ annualizedYield: string;
10
+ baseCcy: string;
11
+ quoteCcy: string;
12
+ expTime: string;
13
+ interestAccrualTime: string;
14
+ listTime: string;
15
+ maxSize: string;
16
+ minSize: string;
17
+ notionalCcy: string;
18
+ optType: 'C' | 'P';
19
+ productId: string;
20
+ quoteTime: string;
21
+ redeemEndTime: string;
22
+ redeemStartTime: string;
23
+ stepSz: string;
24
+ tradeEndTime: string;
25
+ strike: string;
26
+ uly: string;
27
+ }
28
+ export interface DcdQuote {
29
+ absYield: string;
30
+ annualizedYield: string;
31
+ interestAccrualTime: string;
32
+ notionalSz: string;
33
+ notionalCcy: string;
34
+ productId: string;
35
+ quoteId: string;
36
+ validUntil: string;
37
+ idxPx: string;
38
+ }
39
+ export type DcdTradeOrderState = 'initial' | 'pending_book' | 'live' | 'rejected';
40
+ export interface DcdTradeResult {
41
+ quoteId: string;
42
+ ordId: string;
43
+ state: DcdTradeOrderState;
44
+ }
45
+ export interface DcdRedeemQuote {
46
+ ordId: string;
47
+ quoteId: string;
48
+ redeemCcy: string;
49
+ redeemSz: string;
50
+ termRate: string;
51
+ validUntil: string;
52
+ }
53
+ export type DcdRedeemConfirmState = 'pending_redeem_booking' | 'pending_redeem' | 'redeeming' | 'redeemed';
54
+ export interface DcdRedeemResult {
55
+ ordId: string;
56
+ state: DcdRedeemConfirmState;
57
+ }
58
+ export type DcdOrderStatusState = 'initial' | 'live' | 'pending_settle' | 'settled' | 'pending_redeem' | 'redeemed' | 'rejected';
59
+ export interface DcdOrderStatus {
60
+ ordId: string;
61
+ state: DcdOrderStatusState;
62
+ }
63
+ export interface DcdOrderHistoryItem {
64
+ ordId: string;
65
+ quoteId: string;
66
+ state: DcdOrderStatusState;
67
+ productId: string;
68
+ baseCcy: string;
69
+ quoteCcy: string;
70
+ uly: string;
71
+ strike: string;
72
+ notionalSz: string;
73
+ notionalCcy: string;
74
+ absYield: string;
75
+ annualizedYield: string;
76
+ yieldSz: string;
77
+ yieldCcy: string;
78
+ settleSz: string;
79
+ settleCcy: string;
80
+ settlePx: string;
81
+ settleTime: string;
82
+ expTime: string;
83
+ redeemStartTime: string;
84
+ redeemEndTime: string;
85
+ cTime: string;
86
+ uTime: string;
87
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=private-dual-investment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"private-dual-investment.js","sourceRoot":"","sources":["../../../../../src/types/rest/response/private-dual-investment.ts"],"names":[],"mappings":""}
@@ -10,9 +10,16 @@ export interface SupplementaryCollateral {
10
10
  ccy: string;
11
11
  amt: string;
12
12
  }
13
+ export interface GetFlexibleLoanCollateralAssetsRequest {
14
+ ccy?: string;
15
+ /** When the account has multiple active flexible-loan positions. */
16
+ ordId?: string;
17
+ }
13
18
  export interface MaxLoanRequest {
14
19
  borrowCcy: string;
15
20
  supCollateral?: SupplementaryCollateral[];
21
+ /** When multiple active loans exist. */
22
+ ordId?: string;
16
23
  }
17
24
  export interface MaxLoanResponse {
18
25
  borrowCcy: string;
@@ -24,6 +31,8 @@ export interface AdjustCollateralRequest {
24
31
  type: 'add' | 'reduce';
25
32
  collateralCcy: string;
26
33
  collateralAmt: string;
34
+ /** When multiple active loans exist. */
35
+ ordId?: string;
27
36
  }
28
37
  export interface LoanCurrencyData {
29
38
  ccy: string;
@@ -33,9 +42,18 @@ export interface RiskWarningData {
33
42
  instId: string;
34
43
  liqPx: string;
35
44
  }
45
+ export interface GetLoanInfoRequest {
46
+ /** When the account has multiple active flexible loans . */
47
+ ordId?: string;
48
+ }
36
49
  export interface LoanInfo {
50
+ /**
51
+ * Active loan / position id when the account can hold multiple loan orders.
52
+ */
53
+ ordId?: string;
37
54
  loanNotionalUsd: string;
38
55
  loanData: LoanCurrencyData[];
56
+ /** Adjusted collateral value in USD. */
39
57
  collateralNotionalUsd: string;
40
58
  collateralData: LoanCurrencyData[];
41
59
  riskWarningData: RiskWarningData;
@@ -45,6 +63,8 @@ export interface LoanInfo {
45
63
  }
46
64
  export interface LoanHistoryRequest {
47
65
  type?: 'borrowed' | 'repaid' | 'collateral_locked' | 'collateral_released' | 'forced_repayment_buy' | 'forced_repayment_sell' | 'forced_liquidation' | 'partial_liquidation';
66
+ /** When multiple active loans exist. */
67
+ ordId?: string;
48
68
  after?: string;
49
69
  before?: string;
50
70
  limit?: string;
@@ -58,6 +78,8 @@ export interface LoanHistoryItem {
58
78
  }
59
79
  export interface AccruedInterestRequest {
60
80
  ccy?: string;
81
+ /** When multiple active loans exist. */
82
+ ordId?: string;
61
83
  after?: string;
62
84
  before?: string;
63
85
  limit?: string;
@@ -1,4 +1,24 @@
1
1
  import { AlgoOrderState, AlgoOrderType, AlgoPositionSide, numberInString, OrderState, OrderType, PositionSide } from '../shared.js';
2
+ /**
3
+ * Nested rows in `attachAlgoOrds` on orders / history (incl. trailing stop fields)
4
+ */
5
+ export interface AttachAlgoOrderDetail {
6
+ attachAlgoClOrdId?: string;
7
+ tpTriggerPx?: string;
8
+ tpTriggerRatio?: string;
9
+ tpOrdPx?: string;
10
+ tpOrdKind?: string;
11
+ slTriggerPx?: string;
12
+ slTriggerRatio?: string;
13
+ slOrdPx?: string;
14
+ tpTriggerPxType?: string;
15
+ slTriggerPxType?: string;
16
+ sz?: string;
17
+ amendPxOnTriggerType?: string;
18
+ callbackRatio?: string;
19
+ callbackSpread?: string;
20
+ activePx?: string;
21
+ }
2
22
  export interface OrderResult {
3
23
  clOrdId: string;
4
24
  ordId: string;
@@ -52,12 +72,14 @@ export interface OrderDetails {
52
72
  slTriggerPx: string;
53
73
  slTriggerPxType: string;
54
74
  slOrdPx: string;
75
+ attachAlgoOrds?: AttachAlgoOrderDetail[];
55
76
  feeCcy: string;
56
77
  fee: string;
57
78
  rebateCcy: string;
58
79
  rebate: string;
59
80
  tgtCcy: string;
60
81
  category: string;
82
+ outcome?: string;
61
83
  uTime: string;
62
84
  cTime: string;
63
85
  }
@@ -91,7 +113,6 @@ export interface OrderListItem {
91
113
  slOrdPx: string;
92
114
  slTriggerPx: string;
93
115
  slTriggerPxType: string;
94
- attachAlgoOrds: any[];
95
116
  state: OrderState;
96
117
  stpId: string;
97
118
  stpMode: string;
@@ -109,6 +130,8 @@ export interface OrderListItem {
109
130
  algoClOrdId: string;
110
131
  algoId: string;
111
132
  uTime: string;
133
+ attachAlgoOrds?: AttachAlgoOrderDetail[];
134
+ outcome?: string;
112
135
  }
113
136
  export interface HistoricOrder {
114
137
  instType: string;
@@ -141,7 +164,7 @@ export interface HistoricOrder {
141
164
  slTriggerPx: string;
142
165
  slTriggerPxType: string;
143
166
  slOrdPx: string;
144
- attachAlgoOrds: any[];
167
+ attachAlgoOrds?: AttachAlgoOrderDetail[];
145
168
  stpId: string;
146
169
  stpMode: string;
147
170
  feeCcy: string;
@@ -157,6 +180,7 @@ export interface HistoricOrder {
157
180
  cancelSourceReason: string;
158
181
  algoClOrdId: string;
159
182
  algoId: string;
183
+ outcome?: string;
160
184
  uTime: string;
161
185
  cTime: string;
162
186
  }
@@ -194,7 +218,7 @@ export interface AlgoOrderDetailsResult {
194
218
  ccy: string;
195
219
  clOrdId: string;
196
220
  algoId: string;
197
- attachAlgoOrds: any[];
221
+ attachAlgoOrds?: AttachAlgoOrderDetail[];
198
222
  sz: string;
199
223
  closeFraction: string;
200
224
  ordType: AlgoOrderType;
@@ -246,7 +270,7 @@ export interface AlgoOrderListItem {
246
270
  actualSide: string;
247
271
  actualSz: string;
248
272
  algoId: string;
249
- attachAlgoOrds: any[];
273
+ attachAlgoOrds?: AttachAlgoOrderDetail[];
250
274
  cTime: string;
251
275
  callbackRatio: string;
252
276
  callbackSpread: string;
@@ -257,7 +281,7 @@ export interface AlgoOrderListItem {
257
281
  lever: string;
258
282
  moveTriggerPx: string;
259
283
  ordId: string;
260
- ordIdList: any[];
284
+ ordIdList: string[];
261
285
  ordPx: string;
262
286
  ordType: AlgoOrderType;
263
287
  posSide: AlgoPositionSide;
@@ -301,7 +325,7 @@ export interface HistoricAlgoOrder {
301
325
  actualSz: string;
302
326
  algoClOrdId: string;
303
327
  algoId: string;
304
- attachAlgoOrds: any[];
328
+ attachAlgoOrds?: AttachAlgoOrderDetail[];
305
329
  cTime: string;
306
330
  callbackRatio: string;
307
331
  callbackSpread: string;
@@ -72,8 +72,15 @@ export interface Trade {
72
72
  ts: string;
73
73
  source?: string;
74
74
  }
75
+ export interface InstrumentUpcomingParamChange {
76
+ param: 'tickSz' | 'minSz' | 'maxMktSz' | string;
77
+ newValue: string;
78
+ effTime: string;
79
+ }
75
80
  export interface Instrument {
76
81
  instType: InstrumentType;
82
+ /** Series id for EVENTS, e.g. BTC-ABOVE-DAILY. */
83
+ seriesId?: string;
77
84
  instId: string;
78
85
  uly: string;
79
86
  instFamily: string;
@@ -95,7 +102,14 @@ export interface Instrument {
95
102
  lotSz: string;
96
103
  minSz: string;
97
104
  ctType: string;
105
+ /**
106
+ * FUTURES contract label (deprecated — prefer `expTime` for delivery time; removal planned).
107
+ * Includes `this_five_years` / `next_five_years` (X-Perps / 5Y-style contracts).
108
+ */
98
109
  alias: string;
110
+ /**
111
+ * Instrument status: live, suspend, rebase (SWAP only), preopen, test, expired, settling (EVENTS), …
112
+ */
99
113
  state: string;
100
114
  openType?: string;
101
115
  maxLmtSz: string;
@@ -106,15 +120,26 @@ export interface Instrument {
106
120
  maxIcebergSz: string;
107
121
  maxTriggerSz: string;
108
122
  maxStopSz: string;
123
+ /**
124
+ * e.g. `normal`, `pre_market`, `rebase_contract`, `xperp` (perpetual-style expiry futures, some FUTURES only).
125
+ */
109
126
  ruleType: string;
110
127
  auctionEndTime: string;
111
128
  futureSettlement?: boolean;
112
129
  tradeQuoteCcyList?: string[];
113
130
  instIdCode?: number;
131
+ /**
132
+ * Asset category of the instrument's base asset (first segment of `instId`). E.g. BTC-USDT-SWAP → category of BTC.
133
+ * 1: Crypto, 3: Stocks, 4: Commodities, 5: Forex, 6: Bonds, "": not available
134
+ */
135
+ instCategory?: string;
114
136
  posLmtAmt?: string;
115
137
  posLmtPct?: string;
138
+ longPosRemainingQuota?: string;
139
+ shortPosRemainingQuota?: string;
116
140
  maxPlatOILmt?: string;
117
141
  groupId?: string;
142
+ upcChg?: InstrumentUpcomingParamChange[];
118
143
  }
119
144
  export interface EconomicCalendarData {
120
145
  calendarId: string;
@@ -140,17 +165,50 @@ export interface UnitConvertData {
140
165
  sz: string;
141
166
  unit: 'coin' | 'usds';
142
167
  }
168
+ /**
169
+ * @see GET /api/v5/public/funding-rate
170
+ * `instType` is `SWAP` (perp) or `FUTURES` (X-Perp) when applicable.
171
+ */
172
+ export interface PublicFundingRate {
173
+ instType: string;
174
+ instId: string;
175
+ method: string;
176
+ formulaType: string;
177
+ fundingRate: string;
178
+ nextFundingRate: string;
179
+ fundingTime: string;
180
+ nextFundingTime: string;
181
+ minFundingRate: string;
182
+ maxFundingRate: string;
183
+ interestRate: string;
184
+ impactValue: string;
185
+ settState: string;
186
+ settFundingRate: string;
187
+ premium: string;
188
+ ts: string;
189
+ }
143
190
  export interface FundingRateHistory {
191
+ /** Perpetual (`SWAP`) or X-Perp (`FUTURES`). */
144
192
  instType: string;
145
193
  instId: string;
146
194
  fundingRate: string;
147
195
  realizedRate: string;
148
196
  fundingTime: string;
149
197
  method: string;
198
+ formulaType?: string;
150
199
  }
151
200
  export interface SystemTime {
152
201
  ts: string;
153
202
  }
203
+ /**
204
+ * @see GET /api/v5/public/estimated-price
205
+ */
206
+ export interface EstimatedDeliveryExercisePrice {
207
+ instType: string;
208
+ instId: string;
209
+ settlePx: string;
210
+ ts: string;
211
+ }
154
212
  export interface OptionsTradeInfo {
155
213
  instId: string;
156
214
  tradeId: string;
@@ -185,6 +243,14 @@ export interface Announcement {
185
243
  title: string;
186
244
  url: string;
187
245
  }
246
+ /** Public borrow history record (GET /api/v5/finance/savings/lending-rate-history) */
247
+ export interface PublicBorrowHistoryRecord {
248
+ ccy: string;
249
+ amt: string;
250
+ rate: string;
251
+ lendingRate: string;
252
+ ts: string;
253
+ }
188
254
  export interface BasicInterestRate {
189
255
  ccy: string;
190
256
  rate: string;
@@ -217,4 +283,85 @@ export interface InterestRateAndLoanQuota {
217
283
  configCcyList: ConfigCcyItem[];
218
284
  config: LoanQuotaConfig[];
219
285
  }
286
+ /**
287
+ * @see GET /api/v5/public/market-data-history
288
+ */
289
+ export interface MarketDataHistoryFileGroup {
290
+ dateTs: string;
291
+ filename: string;
292
+ sizeMB: string;
293
+ url: string;
294
+ }
295
+ export interface MarketDataHistoryGroupDetail {
296
+ instId: string;
297
+ instFamily: string;
298
+ instType: string;
299
+ dateRangeStart: string;
300
+ dateRangeEnd: string;
301
+ groupSizeMB: string;
302
+ groupDetails: MarketDataHistoryFileGroup[];
303
+ }
304
+ export interface MarketDataHistoryResult {
305
+ dateAggrType: string;
306
+ details: MarketDataHistoryGroupDetail[];
307
+ totalSizeMB: string;
308
+ ts: string;
309
+ }
310
+ /** @see GET /api/v5/finance/staking-defi/eth/product-info */
311
+ export interface EthStakingProductInfo {
312
+ fastRedemptionDailyLimit: string;
313
+ rate: string;
314
+ redemptDays: string;
315
+ minAmt: string;
316
+ }
317
+ /** @see GET /api/v5/finance/staking-defi/sol/product-info */
318
+ export interface SolStakingProductInfo {
319
+ fastRedemptionAvail: string;
320
+ fastRedemptionDailyLimit: string;
321
+ rate: string;
322
+ redemptDays: string;
323
+ minAmt: string;
324
+ }
325
+ /**
326
+ * @see GET /api/v5/public/event-contract/series
327
+ */
328
+ export interface EventContractSettlement {
329
+ method: string;
330
+ closeEarly: boolean;
331
+ srcName: string;
332
+ underlying: string;
333
+ }
334
+ export interface EventContractSeries {
335
+ seriesId: string;
336
+ freq: string;
337
+ title: string;
338
+ category: string;
339
+ settlement: EventContractSettlement;
340
+ }
341
+ /**
342
+ * @see GET /api/v5/public/event-contract/events
343
+ */
344
+ export interface EventContractEvent {
345
+ seriesId: string;
346
+ eventId: string;
347
+ expTime: string;
348
+ state: string;
349
+ fixTime?: string;
350
+ }
351
+ /**
352
+ * @see GET /api/v5/public/event-contract/markets
353
+ */
354
+ export interface EventContractMarket {
355
+ seriesId: string;
356
+ eventId: string;
357
+ instId: string;
358
+ listTime: string;
359
+ expTime: string;
360
+ state: string;
361
+ fixTime: string;
362
+ outcome: string;
363
+ floorStrike: string;
364
+ settleValue: string;
365
+ disputed: boolean;
366
+ }
220
367
  export {};
@@ -9,7 +9,7 @@ export type AlgoOrderState = 'live' | 'pause' | 'partially_effective' | 'effecti
9
9
  export type AlgoPositionSide = 'long' | 'short';
10
10
  export type ContractGridDirection = 'long' | 'short' | 'neutral';
11
11
  export type GridAlgoSubOrderType = 'live' | 'filled';
12
- export type InstrumentType = 'SPOT' | 'MARGIN' | 'SWAP' | 'FUTURES' | 'OPTION';
12
+ export type InstrumentType = 'SPOT' | 'MARGIN' | 'SWAP' | 'FUTURES' | 'OPTION' | 'EVENTS';
13
13
  export type MarginMode = 'cross' | 'isolated';
14
14
  export type OrderSide = 'buy' | 'sell';
15
15
  export type OrderType = 'market' | 'limit' | 'post_only' | 'fok' | 'ioc' | 'optimal_limit_ioc' | 'mmp' | 'mmp_and_post_only' | 'elp';
@@ -1,6 +1,10 @@
1
+ import type { AmendAttachedTrailingStop, AttachAlgoOrdRequest } from '../rest/request/trade.js';
1
2
  import { numberInString, OrderSide, OrderType, PositionSide, TradeMode } from '../rest/shared.js';
2
3
  export interface WSAPIPlaceOrderRequestV5 {
3
- instId: string;
4
+ /** Instrument ID. Deprecated March 2026; use instIdCode for lower latency. */
5
+ instId?: string;
6
+ /** Instrument ID code. Takes precedence over instId if both provided. Use Get instruments to map. */
7
+ instIdCode?: number;
4
8
  tdMode: TradeMode;
5
9
  ccy?: string;
6
10
  clOrdId?: string;
@@ -19,9 +23,22 @@ export interface WSAPIPlaceOrderRequestV5 {
19
23
  banAmend?: boolean;
20
24
  tradeQuoteCcy?: string;
21
25
  stpMode?: 'cancel_maker' | 'cancel_taker' | 'cancel_both';
26
+ /** ELP taker access. true = can trade with ELP orders (speed bump applied). Default false. Only applicable to ioc orders */
27
+ isElpTakerAccess?: boolean;
28
+ /** EVENTS: `"1"` for non-`post_only` orders when required (error 54086 if missing). */
29
+ speedBump?: string;
30
+ /** EVENTS: `yes` or `no`. */
31
+ outcome?: string;
32
+ attachAlgoOrds?: AttachAlgoOrdRequest[];
22
33
  }
23
34
  export interface WSAPIAmendOrderRequestV5 {
24
- instId: string;
35
+ /**
36
+ * If set, ignored for `amend-order` / `batch-amend-orders` — use `ordId`/`clOrdId` to identify the order.
37
+ * Map codes via Get instruments as needed.
38
+ */
39
+ instId?: string;
40
+ /** Use Get instruments to map. */
41
+ instIdCode?: number;
25
42
  cxlOnFail?: boolean;
26
43
  ordId?: string;
27
44
  clOrdId?: string;
@@ -30,6 +47,8 @@ export interface WSAPIAmendOrderRequestV5 {
30
47
  newPx?: string;
31
48
  newPxUsd?: string;
32
49
  newPxVol?: string;
50
+ speedBump?: string;
51
+ attachAlgoOrds?: AmendAttachedTrailingStop[];
33
52
  }
34
53
  export interface WSAPIMassCancelOrdersRequestV5 {
35
54
  instType: string;
@@ -26,3 +26,14 @@ export interface WSAPISpreadCancelOrderResultV5 {
26
26
  sCode: string;
27
27
  sMsg: string;
28
28
  }
29
+ /**
30
+ * @see Ws public channel: estimated-price
31
+ */
32
+ export type WsEstimatedPriceSettleType = 'settlement' | 'delivery' | 'exercise';
33
+ export interface WsEstimatedPriceData {
34
+ instId: string;
35
+ instType: string;
36
+ settlePx: string;
37
+ settleType: WsEstimatedPriceSettleType;
38
+ ts: string;
39
+ }
@@ -18,6 +18,7 @@ export interface WsDataEvent<T = any> {
18
18
  uid?: string;
19
19
  instId?: string;
20
20
  instFamily?: string;
21
+ instType?: string;
21
22
  };
22
23
  data: T;
23
24
  }
@@ -1,3 +1,4 @@
1
+ import type { InstrumentType } from '../rest/shared.js';
1
2
  export interface WsAuthRequestArg {
2
3
  apiKey: string;
3
4
  passphrase: string;
@@ -10,7 +11,7 @@ export type WsPublicKlineChannel = 'candle1Y' | 'candle6M' | 'candle3M' | 'candl
10
11
  export type WsPublicMarkPriceKlineChannel = 'mark-price-candle1Y' | 'mark-price-candle6M' | 'mark-price-candle3M' | 'mark-price-candle1M' | 'mark-price-candle1W' | 'mark-price-candle1D' | 'mark-price-candle2D' | 'mark-price-candle3D' | 'mark-price-candle5D' | 'mark-price-candle12H' | 'mark-price-candle6H' | 'mark-price-candle4H' | 'mark-price-candle2H' | 'mark-price-candle1H' | 'mark-price-candle30m' | 'mark-price-candle15m' | 'mark-price-candle5m' | 'mark-price-candle3m' | 'mark-price-candle1m' | 'mark-price-candle1Yutc' | 'mark-price-candle3Mutc' | 'mark-price-candle1Mutc' | 'mark-price-candle1Wutc' | 'mark-price-candle1Dutc' | 'mark-price-candle2Dutc' | 'mark-price-candle3Dutc' | 'mark-price-candle5Dutc' | 'mark-price-candle12Hutc' | 'mark-price-candle6Hutc';
11
12
  export type WsPublicIndexKlineChannel = 'index-candle1Y' | 'index-candle6M' | 'index-candle3M' | 'index-candle1M' | 'index-candle1W' | 'index-candle1D' | 'index-candle2D' | 'index-candle3D' | 'index-candle5D' | 'index-candle12H' | 'index-candle6H' | 'index-candle4H index -candle2H' | 'index-candle1H' | 'index-candle30m' | 'index-candle15m' | 'index-candle5m' | 'index-candle3m' | 'index-candle1m' | 'index-candle1Yutc' | 'index-candle3Mutc' | 'index-candle1Mutc' | 'index-candle1Wutc' | 'index-candle1Dutc' | 'index-candle2Dutc' | 'index-candle3Dutc' | 'index-candle5Dutc' | 'index-candle12Hutc' | 'index-candle6Hutc';
12
13
  export type WsPublicOrderBooksChannel = 'books' | 'books5' | 'bbo-tbt' | 'books-l2-tbt' | 'books50-l2-tpt';
13
- export type WsPublicChannel = 'instruments' | 'tickers' | 'open-interest' | WsPublicKlineChannel | WsPublicMarkPriceKlineChannel | WsPublicIndexKlineChannel | 'trades' | 'estimated-price' | 'mark-price' | 'price-limit' | WsPublicOrderBooksChannel | 'opt-summary' | 'funding-rate' | 'index-tickers' | 'status' | 'liquidation-orders';
14
+ export type WsPublicChannel = 'instruments' | 'tickers' | 'open-interest' | WsPublicKlineChannel | WsPublicMarkPriceKlineChannel | WsPublicIndexKlineChannel | 'trades' | 'estimated-price' | 'mark-price' | 'price-limit' | WsPublicOrderBooksChannel | 'opt-summary' | 'funding-rate' | 'index-tickers' | 'status' | 'liquidation-orders' | 'event-contract-markets';
14
15
  export type WsBusinessPrivateChannel = 'orders-algo' | 'algo-advance' | 'deposit-info' | 'withdrawal-info' | 'grid-orders-spot' | 'grid-orders-contract' | 'grid-orders-moon' | 'grid-positions' | 'grid-sub-orders' | 'algo-recurring-buy';
15
16
  export type WsBusinessPublicChannel = WsPublicKlineChannel | WsPublicMarkPriceKlineChannel | WsPublicIndexKlineChannel;
16
17
  export type WsBusinessChannel = WsBusinessPrivateChannel | WsBusinessPublicChannel;
@@ -37,7 +38,8 @@ export interface WsPrivateChannelArgWithCcy extends WsBaseRequestArg {
37
38
  channel: 'account' | 'account-greeks' | 'withdrawal-info';
38
39
  ccy?: string;
39
40
  }
40
- export type WsChannelArgInstType = 'SPOT' | 'MARGIN' | 'SWAP' | 'FUTURES' | 'OPTION' | 'ANY';
41
+ /** `ANY` is used by some private subscription args; instruments channel uses `EVENTS` for event contracts. */
42
+ export type WsChannelArgInstType = InstrumentType | 'ANY';
41
43
  export interface WsPrivateChannelArgWithInstFamily extends WsBaseRequestArg {
42
44
  channel: 'positions' | 'orders' | 'orders-algo' | 'liquidation-warning';
43
45
  instType: WsChannelArgInstType;
@@ -73,7 +75,7 @@ export interface WsPublicChannelArgInstId extends WsBaseRequestArg {
73
75
  }
74
76
  export type WsPublicChannelArgInstIdOrFamily = {
75
77
  channel: 'estimated-price';
76
- instType: 'OPTION' | 'FUTURES';
78
+ instType: 'OPTION' | 'FUTURES' | 'SWAP' | 'EVENTS';
77
79
  } & ({
78
80
  instId: string;
79
81
  } | {
@@ -90,4 +92,9 @@ export interface WsPublicChannelArgLiquidationOrders extends WsBaseRequestArg {
90
92
  channel: 'liquidation-orders';
91
93
  instType: 'SWAP' | 'FUTURES';
92
94
  }
93
- export type WsChannelSubUnSubRequestArg = WsPrivateChannelArgTickers | WsPrivateChannelArgWithCcy | WsPrivateChannelArgWithInstFamily | WsPrivateChannelArgAlgo | WsPrivateChannelArgBalanceAndPosition | WsPrivateChannelArgGridOrders | WsPrivateChannelArgGridOther | WsPublicChannelArgInstType | WsPublicChannelArgInstId | WsPublicChannelArgInstIdOrFamily | WsPublicChannelArgOptionSummary | WsPublicChannelArgStatus | WsPublicChannelArgLiquidationOrders;
95
+ /** Event contract market status & floor strikes. @see public WS `event-contract-markets` */
96
+ export interface WsPublicChannelArgEventContractMarkets extends WsBaseRequestArg {
97
+ channel: 'event-contract-markets';
98
+ instType: 'EVENTS';
99
+ }
100
+ export type WsChannelSubUnSubRequestArg = WsPrivateChannelArgTickers | WsPrivateChannelArgWithCcy | WsPrivateChannelArgWithInstFamily | WsPrivateChannelArgAlgo | WsPrivateChannelArgBalanceAndPosition | WsPrivateChannelArgGridOrders | WsPrivateChannelArgGridOther | WsPublicChannelArgInstType | WsPublicChannelArgInstId | WsPublicChannelArgInstIdOrFamily | WsPublicChannelArgOptionSummary | WsPublicChannelArgStatus | WsPublicChannelArgLiquidationOrders | WsPublicChannelArgEventContractMarkets;