okx-api 3.1.4 → 3.1.6

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 (77) hide show
  1. package/README.md +1 -0
  2. package/dist/cjs/index.d.ts +4 -0
  3. package/dist/cjs/index.js +4 -0
  4. package/dist/cjs/index.js.map +1 -1
  5. package/dist/cjs/rest-client.d.ts +47 -12
  6. package/dist/cjs/rest-client.js +61 -6
  7. package/dist/cjs/rest-client.js.map +1 -1
  8. package/dist/cjs/types/rest/client.d.ts +1 -0
  9. package/dist/cjs/types/rest/request/account.d.ts +28 -0
  10. package/dist/cjs/types/rest/request/affiliate.d.ts +52 -0
  11. package/dist/cjs/types/rest/request/affiliate.js +3 -0
  12. package/dist/cjs/types/rest/request/affiliate.js.map +1 -0
  13. package/dist/cjs/types/rest/request/public.d.ts +9 -0
  14. package/dist/cjs/types/rest/request/stable-rewards.d.ts +27 -0
  15. package/dist/cjs/types/rest/request/stable-rewards.js +3 -0
  16. package/dist/cjs/types/rest/request/stable-rewards.js.map +1 -0
  17. package/dist/cjs/types/rest/request/trade.d.ts +6 -0
  18. package/dist/cjs/types/rest/response/private-account.d.ts +38 -2
  19. package/dist/cjs/types/rest/response/private-affiliate.d.ts +106 -0
  20. package/dist/cjs/types/rest/response/private-affiliate.js +3 -0
  21. package/dist/cjs/types/rest/response/private-affiliate.js.map +1 -0
  22. package/dist/cjs/types/rest/response/private-stable-rewards.d.ts +57 -0
  23. package/dist/cjs/types/rest/response/private-stable-rewards.js +3 -0
  24. package/dist/cjs/types/rest/response/private-stable-rewards.js.map +1 -0
  25. package/dist/cjs/types/rest/response/private-trade.d.ts +3 -0
  26. package/dist/cjs/types/rest/response/public-data.d.ts +21 -1
  27. package/dist/cjs/types/shared.d.ts +3 -2
  28. package/dist/cjs/types/websockets/ws-api-request.d.ts +6 -0
  29. package/dist/cjs/types/websockets/ws-api-response.d.ts +4 -0
  30. package/dist/cjs/types/websockets/ws-events.d.ts +2 -1
  31. package/dist/cjs/types/websockets/ws-general.d.ts +1 -0
  32. package/dist/cjs/types/websockets/ws-request.d.ts +1 -1
  33. package/dist/cjs/util/requestUtils.js +3 -0
  34. package/dist/cjs/util/requestUtils.js.map +1 -1
  35. package/dist/cjs/util/websocket-util.js +17 -1
  36. package/dist/cjs/util/websocket-util.js.map +1 -1
  37. package/dist/cjs/websocket-client.js +2 -1
  38. package/dist/cjs/websocket-client.js.map +1 -1
  39. package/dist/mjs/index.d.ts +4 -0
  40. package/dist/mjs/index.js +4 -0
  41. package/dist/mjs/index.js.map +1 -1
  42. package/dist/mjs/rest-client.d.ts +47 -12
  43. package/dist/mjs/rest-client.js +61 -6
  44. package/dist/mjs/rest-client.js.map +1 -1
  45. package/dist/mjs/types/rest/client.d.ts +1 -0
  46. package/dist/mjs/types/rest/request/account.d.ts +28 -0
  47. package/dist/mjs/types/rest/request/affiliate.d.ts +52 -0
  48. package/dist/mjs/types/rest/request/affiliate.js +2 -0
  49. package/dist/mjs/types/rest/request/affiliate.js.map +1 -0
  50. package/dist/mjs/types/rest/request/public.d.ts +9 -0
  51. package/dist/mjs/types/rest/request/stable-rewards.d.ts +27 -0
  52. package/dist/mjs/types/rest/request/stable-rewards.js +2 -0
  53. package/dist/mjs/types/rest/request/stable-rewards.js.map +1 -0
  54. package/dist/mjs/types/rest/request/trade.d.ts +6 -0
  55. package/dist/mjs/types/rest/response/private-account.d.ts +38 -2
  56. package/dist/mjs/types/rest/response/private-affiliate.d.ts +106 -0
  57. package/dist/mjs/types/rest/response/private-affiliate.js +2 -0
  58. package/dist/mjs/types/rest/response/private-affiliate.js.map +1 -0
  59. package/dist/mjs/types/rest/response/private-stable-rewards.d.ts +57 -0
  60. package/dist/mjs/types/rest/response/private-stable-rewards.js +2 -0
  61. package/dist/mjs/types/rest/response/private-stable-rewards.js.map +1 -0
  62. package/dist/mjs/types/rest/response/private-trade.d.ts +3 -0
  63. package/dist/mjs/types/rest/response/public-data.d.ts +21 -1
  64. package/dist/mjs/types/shared.d.ts +3 -2
  65. package/dist/mjs/types/websockets/ws-api-request.d.ts +6 -0
  66. package/dist/mjs/types/websockets/ws-api-response.d.ts +4 -0
  67. package/dist/mjs/types/websockets/ws-events.d.ts +2 -1
  68. package/dist/mjs/types/websockets/ws-general.d.ts +1 -0
  69. package/dist/mjs/types/websockets/ws-request.d.ts +1 -1
  70. package/dist/mjs/util/requestUtils.js +3 -0
  71. package/dist/mjs/util/requestUtils.js.map +1 -1
  72. package/dist/mjs/util/websocket-util.js +17 -1
  73. package/dist/mjs/util/websocket-util.js.map +1 -1
  74. package/dist/mjs/websocket-client.js +2 -1
  75. package/dist/mjs/websocket-client.js.map +1 -1
  76. package/llms.txt +5352 -4718
  77. package/package.json +2 -4
@@ -167,3 +167,31 @@ export interface BillsHistoryArchiveRequest {
167
167
  /** Comma-separated bill type ids, e.g. 1,2,3. If omitted, all types. */
168
168
  type?: string;
169
169
  }
170
+ export interface MovePositionLegFrom {
171
+ posId: string;
172
+ side: 'buy' | 'sell';
173
+ sz: string;
174
+ }
175
+ export interface MovePositionLegTo {
176
+ tdMode?: 'cross' | 'isolated';
177
+ posSide?: PositionSide;
178
+ ccy?: string;
179
+ }
180
+ export interface MovePositionLeg {
181
+ from: MovePositionLegFrom;
182
+ to: MovePositionLegTo;
183
+ }
184
+ export interface MovePositionsRequest {
185
+ fromAcct: string;
186
+ toAcct: string;
187
+ legs: MovePositionLeg[];
188
+ clientId: string;
189
+ }
190
+ export interface GetMovePositionsHistoryRequest {
191
+ blockTdId?: string;
192
+ clientId?: string;
193
+ beginTs?: string;
194
+ endTs?: string;
195
+ limit?: string;
196
+ state?: 'filled' | 'pending';
197
+ }
@@ -0,0 +1,52 @@
1
+ export type AffiliatePeriodType = 'last_7d' | 'last_30d' | 'this_month' | 'last_month' | 'total' | 'today' | 'this_week' | 'custom';
2
+ export type AffiliateCommissionCategory = 'SPOT' | 'DERIVATIVE' | 'BSC';
3
+ export type AffiliateKycStatus = 'unverified' | 'verified';
4
+ export type AffiliateLinkType = 'standard' | 'co_inviter';
5
+ export type AffiliateLinkStatus = 'normal' | 'abnormal';
6
+ export type AffiliateInviteeListOrderBy = 'cTime' | 'depAmt' | 'vol' | 'fee' | 'rebate';
7
+ export type AffiliateSubAffiliateListOrderBy = 'cTime' | 'depAmt' | 'vol' | 'fee' | 'rebate';
8
+ export type AffiliateOrderDir = 'asc' | 'desc';
9
+ export interface GetAffiliatePerformanceSummaryRequest {
10
+ periodType?: AffiliatePeriodType;
11
+ /** Required when periodType=custom, together with end. Inclusive. */
12
+ begin?: string;
13
+ /** Required when periodType=custom, together with begin. Inclusive. */
14
+ end?: string;
15
+ }
16
+ export interface GetInviteeDetailRequest {
17
+ uid: string;
18
+ }
19
+ export interface GetAffiliateInviteeListRequest {
20
+ page?: string;
21
+ limit?: string;
22
+ periodType?: AffiliatePeriodType;
23
+ /** Required when periodType=custom, together with end. Inclusive. */
24
+ begin?: string;
25
+ /** Required when periodType=custom, together with begin. Inclusive. */
26
+ end?: string;
27
+ keyword?: string;
28
+ commissionCategory?: AffiliateCommissionCategory;
29
+ orderBy?: AffiliateInviteeListOrderBy;
30
+ orderDir?: AffiliateOrderDir;
31
+ kycStatus?: AffiliateKycStatus;
32
+ subAffiliateUid?: string;
33
+ }
34
+ export interface GetAffiliateLinkListRequest {
35
+ page?: string;
36
+ limit?: string;
37
+ linkType?: AffiliateLinkType;
38
+ linkStatus?: AffiliateLinkStatus;
39
+ }
40
+ export interface GetAffiliateCoInviterLinkListRequest {
41
+ page?: string;
42
+ limit?: string;
43
+ linkStatus?: AffiliateLinkStatus;
44
+ }
45
+ export interface GetAffiliateSubAffiliateListRequest {
46
+ page?: string;
47
+ limit?: string;
48
+ keyword?: string;
49
+ commissionCategory?: AffiliateCommissionCategory;
50
+ orderBy?: AffiliateSubAffiliateListOrderBy;
51
+ orderDir?: AffiliateOrderDir;
52
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=affiliate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"affiliate.js","sourceRoot":"","sources":["../../../../../src/types/rest/request/affiliate.ts"],"names":[],"mappings":""}
@@ -98,3 +98,12 @@ export interface GetEventContractMarketsRequest {
98
98
  before?: string;
99
99
  after?: string;
100
100
  }
101
+ export interface GetInsuranceFundRequest {
102
+ instType?: string;
103
+ type?: 'liquidation_balance_deposit' | 'bankruptcy_loss' | 'platform_revenue' | 'adl';
104
+ instFamily?: string;
105
+ ccy?: string;
106
+ before?: string;
107
+ after?: string;
108
+ limit?: string;
109
+ }
@@ -0,0 +1,27 @@
1
+ export interface GetStableRewardsProductInfoRequest {
2
+ ccy: string;
3
+ }
4
+ export interface RequestStableRewardsQuoteRequest {
5
+ ccy: string;
6
+ settleCcy: string;
7
+ action: 'subscribe' | 'redeem';
8
+ amt: string;
9
+ }
10
+ export interface SubmitStableRewardsTradeRequest {
11
+ quoteId: string;
12
+ }
13
+ export interface GetStableRewardsBalanceRequest {
14
+ ccy?: string;
15
+ }
16
+ export interface GetStableRewardsApyHistoryRequest {
17
+ ccy: string;
18
+ days?: string;
19
+ }
20
+ export interface GetStableRewardsSubscribeRedeemHistoryRequest {
21
+ ccy: string;
22
+ type?: 'subscribe' | 'redeem';
23
+ status?: 'pending' | 'success' | 'failed';
24
+ after?: string;
25
+ before?: string;
26
+ limit?: string;
27
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=stable-rewards.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stable-rewards.js","sourceRoot":"","sources":["../../../../../src/types/rest/request/stable-rewards.ts"],"names":[],"mappings":""}
@@ -213,6 +213,12 @@ export interface OrderRequest {
213
213
  reduceOnly?: boolean;
214
214
  /** A spot buy on BTC-USDT with "base_ccy" would mean the QTY (sz) is in USDT */
215
215
  tgtCcy?: 'base_ccy' | 'quote_ccy';
216
+ /**
217
+ * Maximum acceptable slippage for spot and spot margin market-side orders, where tgtCcy is the received currency (base_ccy for buy, quote_ccy for sell).
218
+ * Range: 0 to 0.05 (0% to 5%, inclusive). Up to 2 decimal places, e.g. 0.01 (1%) and 0.0123 (1.23%). Defaults to 0.00% if not specified.
219
+ * Only applicable to SPOT and SPOT margin market orders. Cannot be amended on an existing order.
220
+ */
221
+ slippagePct?: string;
216
222
  banAmend?: boolean;
217
223
  /** Price amendment type: "0" = do not allow amendment, "1" = allow amendment within price limit. Default is "0" */
218
224
  pxAmendType?: '0' | '1';
@@ -267,6 +267,7 @@ export interface FeeGroup {
267
267
  taker: string;
268
268
  maker: string;
269
269
  groupId: string;
270
+ elpMaker?: string;
270
271
  }
271
272
  export interface AccountFeeRate {
272
273
  category: never;
@@ -362,7 +363,7 @@ export interface AccountInstrument {
362
363
  seriesId?: string;
363
364
  uly?: string;
364
365
  /**
365
- * FUTURES label (deprecated prefer `expTime`; may include this_five_years, next_five_years, ).
366
+ * FUTURES label (deprecated: prefer `expTime`; may include this_five_years, next_five_years, ...).
366
367
  */
367
368
  alias?: string;
368
369
  /** Deprecated; see `instCategory` on public `Instrument` where used. */
@@ -386,7 +387,7 @@ export interface AccountInstrument {
386
387
  quoteCcy: string;
387
388
  tradeQuoteCcyList: string[];
388
389
  settleCcy: string;
389
- /** Instrument status: live, suspend, rebase (SWAP only), preopen, test */
390
+ /** Instrument status: live, suspend, rebase (SWAP only), post_only (SWAP only), preopen, test */
390
391
  state: string;
391
392
  stk: string;
392
393
  tickSz: string;
@@ -403,6 +404,8 @@ export interface AccountInstrument {
403
404
  posLmtAmt: string;
404
405
  posLmtPct: string;
405
406
  maxPlatOILmt: string;
407
+ /** Platform-wide maximum position value (coins) for this instrument. Applicable to SWAP/FUTURES. @see 2026-05-19 changelog */
408
+ maxPlatOICoinLmt?: string;
406
409
  /** Remaining long position value (USD) the user is permitted to open. Applicable to SWAP/FUTURES. */
407
410
  longPosRemainingQuota?: string;
408
411
  /** Remaining short position value (USD) the user is permitted to open. Applicable to SWAP/FUTURES. */
@@ -532,3 +535,36 @@ export interface UnmatchedInfo {
532
535
  export interface PrecheckSetDeltaNeutralResult {
533
536
  unmatchedInfoCheck: UnmatchedInfo[];
534
537
  }
538
+ export interface MovePositionLegResultFrom {
539
+ posId: string;
540
+ instId: string;
541
+ px: string;
542
+ side: string;
543
+ sz: string;
544
+ sCode: string;
545
+ sMsg: string;
546
+ }
547
+ export interface MovePositionLegResultTo {
548
+ instId: string;
549
+ px: string;
550
+ side: string;
551
+ sz: string;
552
+ tdMode: string;
553
+ posSide: string;
554
+ ccy: string;
555
+ sCode: string;
556
+ sMsg: string;
557
+ }
558
+ export interface MovePositionLegResult {
559
+ from: MovePositionLegResultFrom;
560
+ to: MovePositionLegResultTo;
561
+ }
562
+ export interface MovePositionsResult {
563
+ clientId: string;
564
+ blockTdId: string;
565
+ state: 'filled' | 'failed' | 'pending' | string;
566
+ ts: string;
567
+ fromAcct: string;
568
+ toAcct: string;
569
+ legs: MovePositionLegResult[];
570
+ }
@@ -0,0 +1,106 @@
1
+ import type { AffiliateCommissionCategory } from '../request/affiliate.js';
2
+ export interface AffiliatePerformanceSummaryDetail {
3
+ commissionCategory: AffiliateCommissionCategory;
4
+ firstTraderCnt: string;
5
+ traderCnt: string;
6
+ vol: string;
7
+ commission: string;
8
+ }
9
+ export interface AffiliatePerformanceSummary {
10
+ uTime: string;
11
+ inviteeCnt: string;
12
+ depAmt: string;
13
+ details: AffiliatePerformanceSummaryDetail[];
14
+ }
15
+ export interface InviteeDetail {
16
+ inviteeLevel: string;
17
+ joinTime: string;
18
+ inviteeRebateRate: string;
19
+ totalCommission: string;
20
+ firstTradeTime: string;
21
+ level: string;
22
+ depAmt: string;
23
+ wdAmt: string;
24
+ volMonth: string;
25
+ totalVol: string;
26
+ accFee: string;
27
+ kycTime: string;
28
+ region: string;
29
+ affiliateCode: string;
30
+ }
31
+ export type AffiliateInviteeListKycStatus = 'unverified' | 'verified';
32
+ export interface AffiliateInviteeListItem {
33
+ uid: string;
34
+ country: string;
35
+ joinTime: string;
36
+ firstTradeTime: string;
37
+ channelName: string;
38
+ rebateRate: string;
39
+ feeTierRank: string;
40
+ kycStatus: AffiliateInviteeListKycStatus;
41
+ kycTime: string;
42
+ depAmt: string;
43
+ totalVol: string;
44
+ totalFee: string;
45
+ totalCommission: string;
46
+ isCompliant: boolean;
47
+ }
48
+ export type AffiliateLinkListLinkType = 'standard' | 'co_inviter';
49
+ export type AffiliateLinkListLinkStatus = 'normal' | 'abnormal';
50
+ export interface AffiliateLinkListItem {
51
+ channelId: string;
52
+ channelName: string;
53
+ joinLink: string;
54
+ linkType: AffiliateLinkListLinkType;
55
+ inviterCommissionRate: string;
56
+ coInviterCommissionRate: string;
57
+ inviteeDiscountRate: string;
58
+ inviteeCnt: string;
59
+ traderCnt: string;
60
+ totalCommission: string;
61
+ commission24h: string;
62
+ cTime: string;
63
+ isDefault: boolean;
64
+ linkStatus: AffiliateLinkListLinkStatus;
65
+ }
66
+ export type AffiliateChannelAssessmentStatus = 'valid' | 'not_reach_trade' | 'not_reach_invite' | 'not_reach_both';
67
+ export type AffiliateInviterChannelStatus = 'valid' | 'identity_invalid' | 'level_downgraded';
68
+ export type AffiliateCoInviterChannelStatus = 'valid' | 'identity_invalid' | 'not_reach_assessment' | 'identity_invalid_and_not_reach_assessment';
69
+ export interface AffiliateCoInviterLinkListItem {
70
+ channelId: string;
71
+ channelName: string;
72
+ joinLink: string;
73
+ inviterCommissionRate: string;
74
+ coInviterCommissionRate: string;
75
+ inviteeDiscountRate: string;
76
+ parUserName: string;
77
+ coUserName: string;
78
+ isCompliant: boolean;
79
+ note?: string;
80
+ isDefault: boolean;
81
+ totalCommission: string;
82
+ commission24h: string;
83
+ inviteeCnt: string;
84
+ traderCnt: string;
85
+ clickCnt: string;
86
+ totalFee: string;
87
+ cTime: string;
88
+ channelAssessmentStatus: AffiliateChannelAssessmentStatus;
89
+ inviterChannelStatus: AffiliateInviterChannelStatus;
90
+ coInviterChannelStatus: AffiliateCoInviterChannelStatus;
91
+ linkStatus: AffiliateLinkListLinkStatus;
92
+ }
93
+ export interface AffiliateSubAffiliateListItem {
94
+ subAffiliateUid: string;
95
+ country: string;
96
+ joinTime: string;
97
+ subAffiliateLevel: string;
98
+ commissionRate: string;
99
+ isCompliant: boolean;
100
+ inviteeCnt: string;
101
+ traderCnt: string;
102
+ depAmt: string;
103
+ totalVol: string;
104
+ totalFee: string;
105
+ totalCommission: string;
106
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=private-affiliate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"private-affiliate.js","sourceRoot":"","sources":["../../../../../src/types/rest/response/private-affiliate.ts"],"names":[],"mappings":""}
@@ -0,0 +1,57 @@
1
+ export interface StableRewardsProductInfoDetail {
2
+ ccy: string;
3
+ settleCcy: string;
4
+ subFeeRate: string;
5
+ redemptFeeRate: string;
6
+ minSubAmt: string;
7
+ minRedeemAmt: string;
8
+ remainingSubQuota: string;
9
+ remainingRedemptQuota: string;
10
+ canRedeem: boolean;
11
+ }
12
+ export interface StableRewardsProductInfo {
13
+ details: StableRewardsProductInfoDetail[];
14
+ ts: string;
15
+ }
16
+ export interface StableRewardsQuote {
17
+ quoteId: string;
18
+ quoteAmt: string;
19
+ quoteCcy: string;
20
+ exchRate: string;
21
+ feeRate: string;
22
+ quoteTime: string;
23
+ ttlMs: string;
24
+ }
25
+ export interface StableRewardsTradeResult {
26
+ quoteId: string;
27
+ ordId: string;
28
+ }
29
+ export type StableRewardsBalanceState = 'earning' | 'pending';
30
+ export interface StableRewardsBalanceDetail {
31
+ ccy: string;
32
+ amt: string;
33
+ totalEarnAccrual: string;
34
+ state: StableRewardsBalanceState;
35
+ }
36
+ export interface StableRewardsBalance {
37
+ details: StableRewardsBalanceDetail[];
38
+ ts: string;
39
+ }
40
+ export interface StableRewardsApyHistoryItem {
41
+ rate: string;
42
+ ts: string;
43
+ }
44
+ export type StableRewardsSubscribeRedeemType = 'subscribe' | 'redeem';
45
+ export type StableRewardsSubscribeRedeemStatus = 'pending' | 'success' | 'failed';
46
+ export interface StableRewardsSubscribeRedeemHistoryItem {
47
+ type: StableRewardsSubscribeRedeemType;
48
+ status: StableRewardsSubscribeRedeemStatus;
49
+ ccy: string;
50
+ settleCcy: string;
51
+ ccyAmt: string;
52
+ settleCcyAmt: string;
53
+ fee: string;
54
+ quoteId: string;
55
+ ordId: string;
56
+ ts: string;
57
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=private-stable-rewards.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"private-stable-rewards.js","sourceRoot":"","sources":["../../../../../src/types/rest/response/private-stable-rewards.ts"],"names":[],"mappings":""}
@@ -25,12 +25,14 @@ export interface OrderResult {
25
25
  tag: string;
26
26
  ts: string;
27
27
  sCode: numberInString;
28
+ subCode?: string;
28
29
  sMsg: string;
29
30
  }
30
31
  export interface CancelledOrderResult {
31
32
  clOrdId: string;
32
33
  ordId: string;
33
34
  sCode: string;
35
+ subCode?: string;
34
36
  sMsg: string;
35
37
  }
36
38
  export interface AmendedOrder {
@@ -38,6 +40,7 @@ export interface AmendedOrder {
38
40
  ordId: string;
39
41
  reqId: string;
40
42
  sCode: string;
43
+ subCode?: string;
41
44
  sMsg: string;
42
45
  }
43
46
  export interface ClosedPositions {
@@ -108,7 +108,7 @@ export interface Instrument {
108
108
  */
109
109
  alias: string;
110
110
  /**
111
- * Instrument status: live, suspend, rebase (SWAP only), preopen, test, expired, settling (EVENTS), …
111
+ * Instrument status: live, suspend, rebase (SWAP only), post_only (SWAP only), preopen, test, expired, settling (EVENTS), …
112
112
  */
113
113
  state: string;
114
114
  openType?: string;
@@ -187,6 +187,26 @@ export interface PublicFundingRate {
187
187
  premium: string;
188
188
  ts: string;
189
189
  }
190
+ export interface InsuranceFundDetail {
191
+ ccy?: string;
192
+ bal?: string;
193
+ amt?: string;
194
+ type?: string;
195
+ maxBal?: string;
196
+ maxBalTs?: string;
197
+ decRate?: string;
198
+ adlType?: string;
199
+ adlBal?: string;
200
+ adlRecBal?: string;
201
+ /** @deprecated Returns "" per 2026-06-09 changelog */
202
+ adlRate?: string;
203
+ /** @deprecated Returns "" per 2026-06-09 changelog */
204
+ adlRecRate?: string;
205
+ }
206
+ export interface InsuranceFund {
207
+ instType?: string;
208
+ details: InsuranceFundDetail[];
209
+ }
190
210
  export interface FundingRateHistory {
191
211
  /** Perpetual (`SWAP`) or X-Perp (`FUTURES`). */
192
212
  instType: string;
@@ -4,10 +4,11 @@ export interface APICredentials {
4
4
  apiPass: string;
5
5
  }
6
6
  /**
7
- * The API Market represents the OKX Domain that you have signed up for. At this time, there are 3 supported domain groups:
7
+ * The API Market represents the OKX Domain that you have signed up for. At this time, there are 4 supported domain groups:
8
8
  *
9
9
  * - GLOBAL, otherwise known as "www.okx.com".
10
+ * - OPENAPI_GLOBAL, OKX Global REST at openapi.okx.com (same WS as GLOBAL).
10
11
  * - EEA, otherwise known as "my.okx.com".
11
12
  * - US, otherwise known as "app.okx.com".
12
13
  */
13
- export type APIMarket = 'prod' | 'GLOBAL' | 'EEA' | 'US';
14
+ export type APIMarket = 'prod' | 'GLOBAL' | 'OPENAPI_GLOBAL' | 'EEA' | 'US';
@@ -20,6 +20,12 @@ export interface WSAPIPlaceOrderRequestV5 {
20
20
  reduceOnly?: boolean;
21
21
  /** A spot buy on BTC-USDT with "base_ccy" would mean the QTY (sz) is in USDT */
22
22
  tgtCcy?: 'base_ccy' | 'quote_ccy';
23
+ /**
24
+ * Maximum acceptable slippage for spot and spot margin market-side orders, where tgtCcy is the received currency (base_ccy for buy, quote_ccy for sell).
25
+ * Range: 0 to 0.05 (0% to 5%, inclusive). Up to 2 decimal places, e.g. 0.01 (1%) and 0.0123 (1.23%). Defaults to 0.00% if not specified.
26
+ * Only applicable to SPOT and SPOT margin market orders. Cannot be amended on an existing order.
27
+ */
28
+ slippagePct?: string;
23
29
  banAmend?: boolean;
24
30
  tradeQuoteCcy?: string;
25
31
  stpMode?: 'cancel_maker' | 'cancel_taker' | 'cancel_both';
@@ -4,6 +4,7 @@ export interface WSAPICancelOrderResultV5 {
4
4
  ordId: string;
5
5
  ts: numberInString;
6
6
  sCode: string;
7
+ subCode?: string;
7
8
  sMsg: string;
8
9
  }
9
10
  export interface WSAPISpreadPlaceOrderResultV5 {
@@ -11,6 +12,7 @@ export interface WSAPISpreadPlaceOrderResultV5 {
11
12
  ordId: string;
12
13
  tag: string;
13
14
  sCode: numberInString;
15
+ subCode?: string;
14
16
  sMsg: string;
15
17
  }
16
18
  export interface WSAPISpreadAmendOrderResultV5 {
@@ -18,12 +20,14 @@ export interface WSAPISpreadAmendOrderResultV5 {
18
20
  ordId: string;
19
21
  reqId: string;
20
22
  sCode: string;
23
+ subCode?: string;
21
24
  sMsg: string;
22
25
  }
23
26
  export interface WSAPISpreadCancelOrderResultV5 {
24
27
  clOrdId: string;
25
28
  ordId: string;
26
29
  sCode: string;
30
+ subCode?: string;
27
31
  sMsg: string;
28
32
  }
29
33
  /**
@@ -6,9 +6,10 @@ export interface MessageEventLike {
6
6
  }
7
7
  export declare function isMessageEvent(msg: unknown): msg is MessageEventLike;
8
8
  export interface WsEvent {
9
- event: 'error' | 'login' | 'subscribe' | 'unsubscribe' | 'channel-conn-count';
9
+ event: 'error' | 'login' | 'subscribe' | 'unsubscribe' | 'channel-conn-count' | 'notice';
10
10
  code?: string;
11
11
  msg?: string;
12
+ connId?: string;
12
13
  arg?: any;
13
14
  data?: any;
14
15
  }
@@ -7,6 +7,7 @@ export interface WSClientConfigurableOptions {
7
7
  /**
8
8
  * The API group this client should connect to:
9
9
  * - market: 'prod' (default: connects to OKX global) https://www.okx.com/docs-v5/en/#overview-production-trading-services
10
+ * - market: 'OPENAPI_GLOBAL' // OKX Global REST at https://openapi.okx.com (WS same as GLOBAL)
10
11
  * - market: 'EEA' // also known as "my.okx.com" https://my.okx.com/docs-v5/en/#overview-production-trading-services
11
12
  * - market: 'US' // also known as "app.okx.com" https://app.okx.com/docs-v5/en/#overview-production-trading-services
12
13
  */
@@ -6,7 +6,7 @@ export interface WsAuthRequestArg {
6
6
  sign: string;
7
7
  }
8
8
  export type WsTradeOp = 'order' | 'batch-orders' | 'cancel-order' | 'batch-cancel-orders' | 'amend-order' | 'batch-amend-order';
9
- export type WsPrivateChannel = 'account' | 'positions' | 'balance_and_position' | 'orders' | 'orders-algo' | 'algo-advance' | 'liquidation-warning' | 'account-greeks' | 'grid-orders-spot' | 'grid-orders-contract' | 'grid-orders-moon' | 'grid-positions' | 'grid-sub-orders';
9
+ export type WsPrivateChannel = 'account' | 'positions' | 'balance_and_position' | 'orders' | 'orders-algo' | 'algo-advance' | 'liquidation-warning' | 'adl-warning' | 'account-greeks' | 'grid-orders-spot' | 'grid-orders-contract' | 'grid-orders-moon' | 'grid-positions' | 'grid-sub-orders';
10
10
  export type WsPublicKlineChannel = 'candle1Y' | 'candle6M' | 'candle3M' | 'candle1M' | 'candle1W' | 'candle1D' | 'candle2D' | 'candle3D' | 'candle5D' | 'candle12H' | 'candle6H' | 'candle4H' | 'candle2H' | 'candle1H' | 'candle30m' | 'candle15m' | 'candle5m' | 'candle3m' | 'candle1m' | 'candle1s' | 'candle1Yutc' | 'candle3Mutc' | 'candle1Mutc' | 'candle1Wutc' | 'candle1Dutc' | 'candle2Dutc' | 'candle3Dutc' | 'candle5Dutc' | 'candle12Hutc' | 'candle6Hutc';
11
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';
12
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';
@@ -30,6 +30,9 @@ export function getRestBaseUrl(market, restClientOptions) {
30
30
  case 'prod': {
31
31
  return 'https://www.okx.com';
32
32
  }
33
+ case 'OPENAPI_GLOBAL': {
34
+ return 'https://openapi.okx.com';
35
+ }
33
36
  // also known as "my.okx.com" https://my.okx.com/docs-v5/en/#overview-production-trading-services
34
37
  case 'EEA': {
35
38
  return 'https://eea.okx.com';
@@ -1 +1 @@
1
- {"version":3,"file":"requestUtils.js","sourceRoot":"","sources":["../../../src/util/requestUtils.ts"],"names":[],"mappings":"AAKA,MAAM,UAAU,eAAe,CAC7B,MAA0B,EAC1B,MAAc,EACd,iBAAiB,GAAG,KAAK;IAEzB,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;QACrB,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC;IAED,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;SACpC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;QACX,MAAM,KAAK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AC;QACd,KAAK,MAAM,CAAC,CAAC,CAAC;YACZ,OAAO,qBAAqB,CAAC;QAC/B,CAAC;QACD,KAAK,gBAAgB,CAAC,CAAC,CAAC;YACtB,OAAO,yBAAyB,CAAC;QACnC,CAAC;QACD,iGAAiG;QACjG,KAAK,KAAK,CAAC,CAAC,CAAC;YACX,OAAO,qBAAqB,CAAC;QAC/B,CAAC;QACD,KAAK,IAAI,CAAC,CAAC,CAAC;YACV,OAAO,oBAAoB,CAAC;QAC9B,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,QAAa;IACpC,IAAI,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC;QACnC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,CACL,QAAQ,CAAC,OAAO;QAChB,QAAQ,CAAC,OAAO,CAAC,EAAE,KAAK,MAAM;QAC9B,QAAQ,CAAC,OAAO,KAAK,MAAM;QAC3B,QAAQ,CAAC,OAAO,KAAK,IAAI,CAC1B,CAAC;AACJ,CAAC"}
@@ -31,6 +31,20 @@ export const WS_BASE_URL_MAP = {
31
31
  business: 'wss://wspap.okx.com:8443/ws/v5/business?brokerId=9999',
32
32
  },
33
33
  },
34
+ // OKX Global REST at openapi.okx.com. WebSocket URLs unchanged (same as GLOBAL).
35
+ OPENAPI_GLOBAL: {
36
+ live: {
37
+ public: 'wss://ws.okx.com:8443/ws/v5/public',
38
+ private: 'wss://ws.okx.com:8443/ws/v5/private',
39
+ // Some channels require business suffix: https://www.okx.com/help/changes-to-v5-api-websocket-subscription-parameter-and-url
40
+ business: 'wss://ws.okx.com:8443/ws/v5/business',
41
+ },
42
+ demo: {
43
+ public: 'wss://wspap.okx.com:8443/ws/v5/public',
44
+ private: 'wss://wspap.okx.com:8443/ws/v5/private',
45
+ business: 'wss://wspap.okx.com:8443/ws/v5/business?brokerId=9999',
46
+ },
47
+ },
34
48
  // also known as "my.okx.com" https://my.okx.com/docs-v5/en/#overview-production-trading-services
35
49
  EEA: {
36
50
  live: {
@@ -327,7 +341,8 @@ export function getWsKeyForTopicChannel(market, channel, isPrivate) {
327
341
  export function getWsKeyForMarket(market, isPrivate, isBusinessChannel) {
328
342
  switch (market) {
329
343
  case 'prod':
330
- case 'GLOBAL': {
344
+ case 'GLOBAL':
345
+ case 'OPENAPI_GLOBAL': {
331
346
  if (isBusinessChannel) {
332
347
  return WS_KEY_MAP.prodBusiness;
333
348
  }
@@ -440,6 +455,7 @@ export function getMaxTopicsPerSubscribeEventForMarket(market) {
440
455
  case 'prod':
441
456
  case 'EEA':
442
457
  case 'GLOBAL':
458
+ case 'OPENAPI_GLOBAL':
443
459
  case 'US': {
444
460
  return null;
445
461
  }