okx-api 3.1.3 → 3.1.5
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.
- package/README.md +2 -0
- package/dist/cjs/index.d.ts +6 -0
- package/dist/cjs/index.js +6 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/rest-client.d.ts +87 -33
- package/dist/cjs/rest-client.js +111 -4
- package/dist/cjs/rest-client.js.map +1 -1
- package/dist/cjs/types/rest/client.d.ts +1 -0
- package/dist/cjs/types/rest/request/account.d.ts +13 -1
- package/dist/cjs/types/rest/request/affiliate.d.ts +52 -0
- package/dist/cjs/types/rest/request/affiliate.js +3 -0
- package/dist/cjs/types/rest/request/affiliate.js.map +1 -0
- package/dist/cjs/types/rest/request/dual-investment.d.ts +35 -0
- package/dist/cjs/types/rest/request/dual-investment.js +3 -0
- package/dist/cjs/types/rest/request/dual-investment.js.map +1 -0
- package/dist/cjs/types/rest/request/funding.d.ts +8 -0
- package/dist/cjs/types/rest/request/public.d.ts +45 -0
- package/dist/cjs/types/rest/request/stable-rewards.d.ts +27 -0
- package/dist/cjs/types/rest/request/stable-rewards.js +3 -0
- package/dist/cjs/types/rest/request/stable-rewards.js.map +1 -0
- package/dist/cjs/types/rest/request/trade.d.ts +70 -49
- package/dist/cjs/types/rest/response/private-account.d.ts +34 -4
- package/dist/cjs/types/rest/response/private-affiliate.d.ts +106 -0
- package/dist/cjs/types/rest/response/private-affiliate.js +3 -0
- package/dist/cjs/types/rest/response/private-affiliate.js.map +1 -0
- package/dist/cjs/types/rest/response/private-dual-investment.d.ts +87 -0
- package/dist/cjs/types/rest/response/private-dual-investment.js +3 -0
- package/dist/cjs/types/rest/response/private-dual-investment.js.map +1 -0
- package/dist/cjs/types/rest/response/private-flexible-loan.d.ts +22 -0
- package/dist/cjs/types/rest/response/private-stable-rewards.d.ts +57 -0
- package/dist/cjs/types/rest/response/private-stable-rewards.js +3 -0
- package/dist/cjs/types/rest/response/private-stable-rewards.js.map +1 -0
- package/dist/cjs/types/rest/response/private-trade.d.ts +30 -6
- package/dist/cjs/types/rest/response/public-data.d.ts +138 -3
- package/dist/cjs/types/rest/shared.d.ts +1 -1
- package/dist/cjs/types/shared.d.ts +3 -2
- package/dist/cjs/types/websockets/ws-api-request.d.ts +19 -2
- package/dist/cjs/types/websockets/ws-api-response.d.ts +11 -0
- package/dist/cjs/types/websockets/ws-events.d.ts +1 -0
- package/dist/cjs/types/websockets/ws-general.d.ts +1 -0
- package/dist/cjs/types/websockets/ws-request.d.ts +11 -4
- package/dist/cjs/util/requestUtils.js +3 -0
- package/dist/cjs/util/requestUtils.js.map +1 -1
- package/dist/cjs/util/websocket-util.js +17 -1
- package/dist/cjs/util/websocket-util.js.map +1 -1
- package/dist/cjs/websocket-client.js +2 -1
- package/dist/cjs/websocket-client.js.map +1 -1
- package/dist/mjs/index.d.ts +6 -0
- package/dist/mjs/index.js +6 -0
- package/dist/mjs/index.js.map +1 -1
- package/dist/mjs/rest-client.d.ts +87 -33
- package/dist/mjs/rest-client.js +111 -4
- package/dist/mjs/rest-client.js.map +1 -1
- package/dist/mjs/types/rest/client.d.ts +1 -0
- package/dist/mjs/types/rest/request/account.d.ts +13 -1
- package/dist/mjs/types/rest/request/affiliate.d.ts +52 -0
- package/dist/mjs/types/rest/request/affiliate.js +2 -0
- package/dist/mjs/types/rest/request/affiliate.js.map +1 -0
- package/dist/mjs/types/rest/request/dual-investment.d.ts +35 -0
- package/dist/mjs/types/rest/request/dual-investment.js +2 -0
- package/dist/mjs/types/rest/request/dual-investment.js.map +1 -0
- package/dist/mjs/types/rest/request/funding.d.ts +8 -0
- package/dist/mjs/types/rest/request/public.d.ts +45 -0
- package/dist/mjs/types/rest/request/stable-rewards.d.ts +27 -0
- package/dist/mjs/types/rest/request/stable-rewards.js +2 -0
- package/dist/mjs/types/rest/request/stable-rewards.js.map +1 -0
- package/dist/mjs/types/rest/request/trade.d.ts +70 -49
- package/dist/mjs/types/rest/response/private-account.d.ts +34 -4
- package/dist/mjs/types/rest/response/private-affiliate.d.ts +106 -0
- package/dist/mjs/types/rest/response/private-affiliate.js +2 -0
- package/dist/mjs/types/rest/response/private-affiliate.js.map +1 -0
- package/dist/mjs/types/rest/response/private-dual-investment.d.ts +87 -0
- package/dist/mjs/types/rest/response/private-dual-investment.js +2 -0
- package/dist/mjs/types/rest/response/private-dual-investment.js.map +1 -0
- package/dist/mjs/types/rest/response/private-flexible-loan.d.ts +22 -0
- package/dist/mjs/types/rest/response/private-stable-rewards.d.ts +57 -0
- package/dist/mjs/types/rest/response/private-stable-rewards.js +2 -0
- package/dist/mjs/types/rest/response/private-stable-rewards.js.map +1 -0
- package/dist/mjs/types/rest/response/private-trade.d.ts +30 -6
- package/dist/mjs/types/rest/response/public-data.d.ts +138 -3
- package/dist/mjs/types/rest/shared.d.ts +1 -1
- package/dist/mjs/types/shared.d.ts +3 -2
- package/dist/mjs/types/websockets/ws-api-request.d.ts +19 -2
- package/dist/mjs/types/websockets/ws-api-response.d.ts +11 -0
- package/dist/mjs/types/websockets/ws-events.d.ts +1 -0
- package/dist/mjs/types/websockets/ws-general.d.ts +1 -0
- package/dist/mjs/types/websockets/ws-request.d.ts +11 -4
- package/dist/mjs/util/requestUtils.js +3 -0
- package/dist/mjs/util/requestUtils.js.map +1 -1
- package/dist/mjs/util/websocket-util.js +17 -1
- package/dist/mjs/util/websocket-util.js.map +1 -1
- package/dist/mjs/websocket-client.js +2 -1
- package/dist/mjs/websocket-client.js.map +1 -1
- package/llms.txt +7922 -6666
- package/package.json +3 -5
|
@@ -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;
|
|
@@ -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 @@
|
|
|
1
|
+
{"version":3,"file":"private-stable-rewards.js","sourceRoot":"","sources":["../../../../../src/types/rest/response/private-stable-rewards.ts"],"names":[],"mappings":""}
|
|
@@ -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
|
|
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
|
|
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
|
|
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:
|
|
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
|
|
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,8 +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;
|
|
99
|
-
/**
|
|
110
|
+
/**
|
|
111
|
+
* Instrument status: live, suspend, rebase (SWAP only), post_only (SWAP only), preopen, test, expired, settling (EVENTS), …
|
|
112
|
+
*/
|
|
100
113
|
state: string;
|
|
101
114
|
openType?: string;
|
|
102
115
|
maxLmtSz: string;
|
|
@@ -107,18 +120,26 @@ export interface Instrument {
|
|
|
107
120
|
maxIcebergSz: string;
|
|
108
121
|
maxTriggerSz: string;
|
|
109
122
|
maxStopSz: string;
|
|
110
|
-
/**
|
|
123
|
+
/**
|
|
124
|
+
* e.g. `normal`, `pre_market`, `rebase_contract`, `xperp` (perpetual-style expiry futures, some FUTURES only).
|
|
125
|
+
*/
|
|
111
126
|
ruleType: string;
|
|
112
127
|
auctionEndTime: string;
|
|
113
128
|
futureSettlement?: boolean;
|
|
114
129
|
tradeQuoteCcyList?: string[];
|
|
115
130
|
instIdCode?: number;
|
|
116
|
-
/**
|
|
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
|
+
*/
|
|
117
135
|
instCategory?: string;
|
|
118
136
|
posLmtAmt?: string;
|
|
119
137
|
posLmtPct?: string;
|
|
138
|
+
longPosRemainingQuota?: string;
|
|
139
|
+
shortPosRemainingQuota?: string;
|
|
120
140
|
maxPlatOILmt?: string;
|
|
121
141
|
groupId?: string;
|
|
142
|
+
upcChg?: InstrumentUpcomingParamChange[];
|
|
122
143
|
}
|
|
123
144
|
export interface EconomicCalendarData {
|
|
124
145
|
calendarId: string;
|
|
@@ -144,17 +165,50 @@ export interface UnitConvertData {
|
|
|
144
165
|
sz: string;
|
|
145
166
|
unit: 'coin' | 'usds';
|
|
146
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
|
+
}
|
|
147
190
|
export interface FundingRateHistory {
|
|
191
|
+
/** Perpetual (`SWAP`) or X-Perp (`FUTURES`). */
|
|
148
192
|
instType: string;
|
|
149
193
|
instId: string;
|
|
150
194
|
fundingRate: string;
|
|
151
195
|
realizedRate: string;
|
|
152
196
|
fundingTime: string;
|
|
153
197
|
method: string;
|
|
198
|
+
formulaType?: string;
|
|
154
199
|
}
|
|
155
200
|
export interface SystemTime {
|
|
156
201
|
ts: string;
|
|
157
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
|
+
}
|
|
158
212
|
export interface OptionsTradeInfo {
|
|
159
213
|
instId: string;
|
|
160
214
|
tradeId: string;
|
|
@@ -229,4 +283,85 @@ export interface InterestRateAndLoanQuota {
|
|
|
229
283
|
configCcyList: ConfigCcyItem[];
|
|
230
284
|
config: LoanQuotaConfig[];
|
|
231
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
|
+
}
|
|
232
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';
|
|
@@ -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
|
|
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';
|
|
@@ -1,3 +1,4 @@
|
|
|
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
4
|
/** Instrument ID. Deprecated March 2026; use instIdCode for lower latency. */
|
|
@@ -19,16 +20,30 @@ export interface WSAPIPlaceOrderRequestV5 {
|
|
|
19
20
|
reduceOnly?: boolean;
|
|
20
21
|
/** A spot buy on BTC-USDT with "base_ccy" would mean the QTY (sz) is in USDT */
|
|
21
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;
|
|
22
29
|
banAmend?: boolean;
|
|
23
30
|
tradeQuoteCcy?: string;
|
|
24
31
|
stpMode?: 'cancel_maker' | 'cancel_taker' | 'cancel_both';
|
|
25
32
|
/** ELP taker access. true = can trade with ELP orders (speed bump applied). Default false. Only applicable to ioc orders */
|
|
26
33
|
isElpTakerAccess?: boolean;
|
|
34
|
+
/** EVENTS: `"1"` for non-`post_only` orders when required (error 54086 if missing). */
|
|
35
|
+
speedBump?: string;
|
|
36
|
+
/** EVENTS: `yes` or `no`. */
|
|
37
|
+
outcome?: string;
|
|
38
|
+
attachAlgoOrds?: AttachAlgoOrdRequest[];
|
|
27
39
|
}
|
|
28
40
|
export interface WSAPIAmendOrderRequestV5 {
|
|
29
|
-
/**
|
|
41
|
+
/**
|
|
42
|
+
* If set, ignored for `amend-order` / `batch-amend-orders` — use `ordId`/`clOrdId` to identify the order.
|
|
43
|
+
* Map codes via Get instruments as needed.
|
|
44
|
+
*/
|
|
30
45
|
instId?: string;
|
|
31
|
-
/**
|
|
46
|
+
/** Use Get instruments to map. */
|
|
32
47
|
instIdCode?: number;
|
|
33
48
|
cxlOnFail?: boolean;
|
|
34
49
|
ordId?: string;
|
|
@@ -38,6 +53,8 @@ export interface WSAPIAmendOrderRequestV5 {
|
|
|
38
53
|
newPx?: string;
|
|
39
54
|
newPxUsd?: string;
|
|
40
55
|
newPxVol?: string;
|
|
56
|
+
speedBump?: string;
|
|
57
|
+
attachAlgoOrds?: AmendAttachedTrailingStop[];
|
|
41
58
|
}
|
|
42
59
|
export interface WSAPIMassCancelOrdersRequestV5 {
|
|
43
60
|
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
|
+
}
|
|
@@ -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
|
*/
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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;
|
|
@@ -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,GAAI,MAAc,CAAC,GAAG,CAAC,CAAC;QACnC,IAAI,iBAAiB,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE,CAAC;YAC/D,MAAM,IAAI,KAAK,CACb,uDAAuD,CACxD,CAAC;QACJ,CAAC;QACD,OAAO,GAAG,GAAG,IAAI,KAAK,EAAE,CAAC;IAC3B,CAAC,CAAC;SACD,IAAI,CAAC,GAAG,CAAC,CAAC;IAEb,iDAAiD;IACjD,OAAO,WAAW,CAAC,CAAC,CAAC,GAAG,GAAG,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC;AACvD,CAAC;AACD,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,CAAC;AAChC,MAAM,CAAC,MAAM,SAAS,GAAG,kBAAkB,CAAC;AAE5C,MAAM,UAAU,cAAc,CAC5B,MAAiB,EACjB,iBAAoC;IAEpC,IAAI,iBAAiB,CAAC,OAAO,EAAE,CAAC;QAC9B,OAAO,iBAAiB,CAAC,OAAO,CAAC;IACnC,CAAC;IAED,QAAQ,MAAM,EAAE,CAAC;QACf,QAAQ;QACR,sGAAsG;QACtG,KAAK,QAAQ,CAAC;QACd,KAAK,MAAM,CAAC,CAAC,CAAC;YACZ,OAAO,qBAAqB,CAAC;QAC/B,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"}
|
|
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,GAAI,MAAc,CAAC,GAAG,CAAC,CAAC;QACnC,IAAI,iBAAiB,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE,CAAC;YAC/D,MAAM,IAAI,KAAK,CACb,uDAAuD,CACxD,CAAC;QACJ,CAAC;QACD,OAAO,GAAG,GAAG,IAAI,KAAK,EAAE,CAAC;IAC3B,CAAC,CAAC;SACD,IAAI,CAAC,GAAG,CAAC,CAAC;IAEb,iDAAiD;IACjD,OAAO,WAAW,CAAC,CAAC,CAAC,GAAG,GAAG,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC;AACvD,CAAC;AACD,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,CAAC;AAChC,MAAM,CAAC,MAAM,SAAS,GAAG,kBAAkB,CAAC;AAE5C,MAAM,UAAU,cAAc,CAC5B,MAAiB,EACjB,iBAAoC;IAEpC,IAAI,iBAAiB,CAAC,OAAO,EAAE,CAAC;QAC9B,OAAO,iBAAiB,CAAC,OAAO,CAAC;IACnC,CAAC;IAED,QAAQ,MAAM,EAAE,CAAC;QACf,QAAQ;QACR,sGAAsG;QACtG,KAAK,QAAQ,CAAC;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
|
}
|