okx-api 0.0.1 → 0.0.2
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 +26 -168
- package/lib/index.d.ts +2 -1
- package/lib/index.js +17 -13
- package/lib/index.js.map +1 -1
- package/lib/rest-client.d.ts +315 -0
- package/lib/rest-client.js +635 -0
- package/lib/rest-client.js.map +1 -0
- package/lib/types/rest/index.d.ts +3 -0
- package/lib/types/rest/index.js +20 -0
- package/lib/types/rest/index.js.map +1 -0
- package/lib/types/rest/request/index.d.ts +4 -0
- package/lib/types/rest/request/index.js +21 -0
- package/lib/types/rest/request/index.js.map +1 -0
- package/lib/types/rest/request/private-account.d.ts +16 -0
- package/lib/types/rest/request/private-account.js +3 -0
- package/lib/types/rest/request/private-account.js.map +1 -0
- package/lib/types/rest/request/private-block-trading.d.ts +60 -0
- package/lib/types/rest/request/private-block-trading.js +3 -0
- package/lib/types/rest/request/private-block-trading.js.map +1 -0
- package/lib/types/rest/request/private-trade.d.ts +111 -0
- package/lib/types/rest/request/private-trade.js +3 -0
- package/lib/types/rest/request/private-trade.js.map +1 -0
- package/lib/types/rest/request/shared.d.ts +7 -0
- package/lib/types/rest/request/shared.js +3 -0
- package/lib/types/rest/request/shared.js.map +1 -0
- package/lib/types/rest/response/index.d.ts +6 -0
- package/lib/types/rest/response/index.js +23 -0
- package/lib/types/rest/response/index.js.map +1 -0
- package/lib/types/rest/response/private-account.d.ts +213 -0
- package/lib/types/rest/response/private-account.js +3 -0
- package/lib/types/rest/response/private-account.js.map +1 -0
- package/lib/types/rest/response/private-block-trading.d.ts +89 -0
- package/lib/types/rest/response/private-block-trading.js +3 -0
- package/lib/types/rest/response/private-block-trading.js.map +1 -0
- package/lib/types/rest/response/private-funding.d.ts +67 -0
- package/lib/types/rest/response/private-funding.js +3 -0
- package/lib/types/rest/response/private-funding.js.map +1 -0
- package/lib/types/rest/response/private-subaccount.d.ts +56 -0
- package/lib/types/rest/response/private-subaccount.js +3 -0
- package/lib/types/rest/response/private-subaccount.js.map +1 -0
- package/lib/types/rest/response/private-trade.d.ts +235 -0
- package/lib/types/rest/response/private-trade.js +3 -0
- package/lib/types/rest/response/private-trade.js.map +1 -0
- package/lib/types/rest/response/public-data.d.ts +70 -0
- package/lib/types/rest/response/public-data.js +3 -0
- package/lib/types/rest/response/public-data.js.map +1 -0
- package/lib/types/rest/shared.d.ts +36 -0
- package/lib/types/rest/shared.js +3 -0
- package/lib/types/rest/shared.js.map +1 -0
- package/lib/util/BaseRestClient.d.ts +35 -0
- package/lib/util/BaseRestClient.js +204 -0
- package/lib/util/BaseRestClient.js.map +1 -0
- package/lib/util/browser-support.d.ts +1 -0
- package/lib/util/browser-support.js +24 -0
- package/lib/util/browser-support.js.map +1 -0
- package/lib/util/node-support.d.ts +1 -0
- package/lib/util/node-support.js +9 -0
- package/lib/util/node-support.js.map +1 -0
- package/lib/util/requestUtils.d.ts +17 -0
- package/lib/util/requestUtils.js +52 -0
- package/lib/util/requestUtils.js.map +1 -0
- package/lib/util/typeGuards.d.ts +2 -0
- package/lib/util/typeGuards.js +14 -0
- package/lib/util/typeGuards.js.map +1 -0
- package/package.json +8 -8
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export interface FundingCurrency {
|
|
2
|
+
canDep: boolean;
|
|
3
|
+
canInternal: boolean;
|
|
4
|
+
canWd: boolean;
|
|
5
|
+
ccy: string;
|
|
6
|
+
chain: string;
|
|
7
|
+
logoLink: string;
|
|
8
|
+
mainNet: boolean;
|
|
9
|
+
maxFee: string;
|
|
10
|
+
maxWd: string;
|
|
11
|
+
minDep: string;
|
|
12
|
+
minDepArrivalConfirm: string;
|
|
13
|
+
minFee: string;
|
|
14
|
+
minWd: string;
|
|
15
|
+
minWdUnlockConfirm: string;
|
|
16
|
+
name: string;
|
|
17
|
+
needTag: boolean;
|
|
18
|
+
usedWdQuota: string;
|
|
19
|
+
wdQuota: string;
|
|
20
|
+
wdTickSz: string;
|
|
21
|
+
}
|
|
22
|
+
export interface FundingBalance {
|
|
23
|
+
availBal: string;
|
|
24
|
+
bal: string;
|
|
25
|
+
ccy: string;
|
|
26
|
+
frozenBal: string;
|
|
27
|
+
}
|
|
28
|
+
export interface AccountAssetValuation {
|
|
29
|
+
details: {
|
|
30
|
+
classic: string;
|
|
31
|
+
earn: string;
|
|
32
|
+
funding: string;
|
|
33
|
+
trading: string;
|
|
34
|
+
};
|
|
35
|
+
totalBal: string;
|
|
36
|
+
ts: string;
|
|
37
|
+
}
|
|
38
|
+
export interface FundTransferResult {
|
|
39
|
+
transId: string;
|
|
40
|
+
ccy: string;
|
|
41
|
+
clientId: string;
|
|
42
|
+
from: string;
|
|
43
|
+
amt: string;
|
|
44
|
+
to: string;
|
|
45
|
+
}
|
|
46
|
+
export interface FundTransferState {
|
|
47
|
+
amt: string;
|
|
48
|
+
ccy: string;
|
|
49
|
+
clientId: string;
|
|
50
|
+
from: string;
|
|
51
|
+
instId: never;
|
|
52
|
+
state: string;
|
|
53
|
+
subAcct: string;
|
|
54
|
+
to: string;
|
|
55
|
+
toInstId: never;
|
|
56
|
+
transId: string;
|
|
57
|
+
type: string;
|
|
58
|
+
}
|
|
59
|
+
export interface AssetBillDetails {
|
|
60
|
+
billId: string;
|
|
61
|
+
ccy: string;
|
|
62
|
+
clientId: string;
|
|
63
|
+
balChg: string;
|
|
64
|
+
bal: string;
|
|
65
|
+
type: string;
|
|
66
|
+
ts: string;
|
|
67
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"private-funding.js","sourceRoot":"","sources":["../../../../src/types/rest/response/private-funding.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export interface SubAccount {
|
|
2
|
+
enable: boolean;
|
|
3
|
+
subAcct: string;
|
|
4
|
+
type: string;
|
|
5
|
+
label: string;
|
|
6
|
+
mobile: string;
|
|
7
|
+
gAuth: boolean;
|
|
8
|
+
canTransOut: boolean;
|
|
9
|
+
ts: string;
|
|
10
|
+
}
|
|
11
|
+
export interface SubAccountAPIReset {
|
|
12
|
+
subAcct: string;
|
|
13
|
+
label: string;
|
|
14
|
+
apiKey: string;
|
|
15
|
+
perm: string;
|
|
16
|
+
ip: string;
|
|
17
|
+
ts: string;
|
|
18
|
+
}
|
|
19
|
+
export interface SubAccountBalanceDetail {
|
|
20
|
+
availBal: string;
|
|
21
|
+
availEq: string;
|
|
22
|
+
cashBal: string;
|
|
23
|
+
ccy: string;
|
|
24
|
+
crossLiab: string;
|
|
25
|
+
disEq: string;
|
|
26
|
+
eq: string;
|
|
27
|
+
eqUsd: string;
|
|
28
|
+
frozenBal: string;
|
|
29
|
+
interest: string;
|
|
30
|
+
isoEq: string;
|
|
31
|
+
isoLiab: string;
|
|
32
|
+
liab: string;
|
|
33
|
+
maxLoan: string;
|
|
34
|
+
mgnRatio: string;
|
|
35
|
+
notionalLever: string;
|
|
36
|
+
ordFrozen: string;
|
|
37
|
+
twap: string;
|
|
38
|
+
uTime: string;
|
|
39
|
+
upl: string;
|
|
40
|
+
uplLiab: string;
|
|
41
|
+
}
|
|
42
|
+
export interface SubAccountBalances {
|
|
43
|
+
adjEq: string;
|
|
44
|
+
details: SubAccountBalanceDetail[];
|
|
45
|
+
imr: string;
|
|
46
|
+
isoEq: string;
|
|
47
|
+
mgnRatio: string;
|
|
48
|
+
mmr: string;
|
|
49
|
+
notionalUsd: string;
|
|
50
|
+
ordFroz: string;
|
|
51
|
+
totalEq: string;
|
|
52
|
+
uTime: string;
|
|
53
|
+
}
|
|
54
|
+
export interface SubAccountTransferResult {
|
|
55
|
+
transId: string;
|
|
56
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"private-subaccount.js","sourceRoot":"","sources":["../../../../src/types/rest/response/private-subaccount.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import { numberInString } from '../shared';
|
|
2
|
+
export interface OrderResult {
|
|
3
|
+
clOrdId: string;
|
|
4
|
+
ordId: string;
|
|
5
|
+
tag: string;
|
|
6
|
+
sCode: numberInString;
|
|
7
|
+
sMsg: string;
|
|
8
|
+
}
|
|
9
|
+
export interface CancelledOrderResult {
|
|
10
|
+
clOrdId: string;
|
|
11
|
+
ordId: string;
|
|
12
|
+
sCode: string;
|
|
13
|
+
sMsg: string;
|
|
14
|
+
}
|
|
15
|
+
export interface AmendedOrder {
|
|
16
|
+
clOrdId: string;
|
|
17
|
+
ordId: string;
|
|
18
|
+
reqId: string;
|
|
19
|
+
sCode: string;
|
|
20
|
+
sMsg: string;
|
|
21
|
+
}
|
|
22
|
+
export interface ClosedPositions {
|
|
23
|
+
instId: string;
|
|
24
|
+
posSide: string;
|
|
25
|
+
}
|
|
26
|
+
export interface OrderDetails {
|
|
27
|
+
instType: string;
|
|
28
|
+
instId: string;
|
|
29
|
+
ccy: string;
|
|
30
|
+
ordId: string;
|
|
31
|
+
clOrdId: string;
|
|
32
|
+
tag: string;
|
|
33
|
+
px: string;
|
|
34
|
+
sz: string;
|
|
35
|
+
pnl: string;
|
|
36
|
+
ordType: string;
|
|
37
|
+
side: string;
|
|
38
|
+
posSide: string;
|
|
39
|
+
tdMode: string;
|
|
40
|
+
accFillSz: string;
|
|
41
|
+
fillPx: string;
|
|
42
|
+
tradeId: string;
|
|
43
|
+
fillSz: string;
|
|
44
|
+
fillTime: string;
|
|
45
|
+
state: string;
|
|
46
|
+
avgPx: string;
|
|
47
|
+
lever: string;
|
|
48
|
+
tpTriggerPx: string;
|
|
49
|
+
tpTriggerPxType: string;
|
|
50
|
+
tpOrdPx: string;
|
|
51
|
+
slTriggerPx: string;
|
|
52
|
+
slTriggerPxType: string;
|
|
53
|
+
slOrdPx: string;
|
|
54
|
+
feeCcy: string;
|
|
55
|
+
fee: string;
|
|
56
|
+
rebateCcy: string;
|
|
57
|
+
rebate: string;
|
|
58
|
+
tgtCcy: string;
|
|
59
|
+
category: string;
|
|
60
|
+
uTime: string;
|
|
61
|
+
cTime: string;
|
|
62
|
+
}
|
|
63
|
+
export interface OrderListItem {
|
|
64
|
+
accFillSz: string;
|
|
65
|
+
avgPx: string;
|
|
66
|
+
cTime: string;
|
|
67
|
+
category: string;
|
|
68
|
+
ccy: string;
|
|
69
|
+
clOrdId: string;
|
|
70
|
+
fee: string;
|
|
71
|
+
feeCcy: string;
|
|
72
|
+
fillPx: string;
|
|
73
|
+
fillSz: string;
|
|
74
|
+
fillTime: string;
|
|
75
|
+
instId: string;
|
|
76
|
+
instType: string;
|
|
77
|
+
lever: string;
|
|
78
|
+
ordId: string;
|
|
79
|
+
ordType: string;
|
|
80
|
+
pnl: string;
|
|
81
|
+
posSide: string;
|
|
82
|
+
px: string;
|
|
83
|
+
rebate: string;
|
|
84
|
+
rebateCcy: string;
|
|
85
|
+
side: string;
|
|
86
|
+
slOrdPx: string;
|
|
87
|
+
slTriggerPx: string;
|
|
88
|
+
slTriggerPxType: string;
|
|
89
|
+
state: string;
|
|
90
|
+
sz: string;
|
|
91
|
+
tag: string;
|
|
92
|
+
tgtCcy: string;
|
|
93
|
+
tdMode: string;
|
|
94
|
+
source: string;
|
|
95
|
+
tpOrdPx: string;
|
|
96
|
+
tpTriggerPx: string;
|
|
97
|
+
tpTriggerPxType: string;
|
|
98
|
+
tradeId: string;
|
|
99
|
+
uTime: string;
|
|
100
|
+
}
|
|
101
|
+
export interface HistoricOrder {
|
|
102
|
+
instType: string;
|
|
103
|
+
instId: string;
|
|
104
|
+
ccy: string;
|
|
105
|
+
ordId: string;
|
|
106
|
+
clOrdId: string;
|
|
107
|
+
tag: string;
|
|
108
|
+
px: string;
|
|
109
|
+
sz: string;
|
|
110
|
+
ordType: string;
|
|
111
|
+
side: string;
|
|
112
|
+
posSide: string;
|
|
113
|
+
tdMode: string;
|
|
114
|
+
accFillSz: string;
|
|
115
|
+
fillPx: string;
|
|
116
|
+
tradeId: string;
|
|
117
|
+
fillSz: string;
|
|
118
|
+
fillTime: string;
|
|
119
|
+
state: string;
|
|
120
|
+
avgPx: string;
|
|
121
|
+
lever: string;
|
|
122
|
+
tpTriggerPx: string;
|
|
123
|
+
tpTriggerPxType: string;
|
|
124
|
+
tpOrdPx: string;
|
|
125
|
+
slTriggerPx: string;
|
|
126
|
+
slTriggerPxType: string;
|
|
127
|
+
slOrdPx: string;
|
|
128
|
+
feeCcy: string;
|
|
129
|
+
fee: string;
|
|
130
|
+
rebateCcy: string;
|
|
131
|
+
source: string;
|
|
132
|
+
rebate: string;
|
|
133
|
+
tgtCcy: string;
|
|
134
|
+
pnl: string;
|
|
135
|
+
category: string;
|
|
136
|
+
uTime: string;
|
|
137
|
+
cTime: string;
|
|
138
|
+
}
|
|
139
|
+
export interface OrderFill {
|
|
140
|
+
instType: string;
|
|
141
|
+
instId: string;
|
|
142
|
+
tradeId: string;
|
|
143
|
+
ordId: string;
|
|
144
|
+
clOrdId: string;
|
|
145
|
+
billId: string;
|
|
146
|
+
tag: string;
|
|
147
|
+
fillPx: string;
|
|
148
|
+
fillSz: string;
|
|
149
|
+
side: string;
|
|
150
|
+
posSide: string;
|
|
151
|
+
execType: string;
|
|
152
|
+
feeCcy: string;
|
|
153
|
+
fee: string;
|
|
154
|
+
ts: string;
|
|
155
|
+
}
|
|
156
|
+
export interface AlgoOrderResult {
|
|
157
|
+
algoId: string;
|
|
158
|
+
sCode: string;
|
|
159
|
+
sMsg: string;
|
|
160
|
+
}
|
|
161
|
+
export interface AlgoOrderListItem {
|
|
162
|
+
instType: string;
|
|
163
|
+
instId: string;
|
|
164
|
+
ordId: string;
|
|
165
|
+
ccy: string;
|
|
166
|
+
algoId: string;
|
|
167
|
+
sz: string;
|
|
168
|
+
ordType: string;
|
|
169
|
+
side: string;
|
|
170
|
+
posSide: string;
|
|
171
|
+
tdMode: string;
|
|
172
|
+
tgtCcy: string;
|
|
173
|
+
state: string;
|
|
174
|
+
lever: string;
|
|
175
|
+
tpTriggerPx: string;
|
|
176
|
+
tpTriggerPxType: string;
|
|
177
|
+
tpOrdPx: string;
|
|
178
|
+
slTriggerPx: string;
|
|
179
|
+
slTriggerPxType: string;
|
|
180
|
+
slOrdPx: string;
|
|
181
|
+
triggerPx: string;
|
|
182
|
+
triggerPxType: string;
|
|
183
|
+
ordPx: string;
|
|
184
|
+
actualSz: string;
|
|
185
|
+
actualPx: string;
|
|
186
|
+
actualSide: string;
|
|
187
|
+
pxVar: string;
|
|
188
|
+
pxSpread: string;
|
|
189
|
+
pxLimit: string;
|
|
190
|
+
szLimit: string;
|
|
191
|
+
timeInterval: string;
|
|
192
|
+
triggerTime: string;
|
|
193
|
+
callbackRatio: string;
|
|
194
|
+
callbackSpread: string;
|
|
195
|
+
activePx: string;
|
|
196
|
+
moveTriggerPx: string;
|
|
197
|
+
cTime: string;
|
|
198
|
+
}
|
|
199
|
+
export interface HistoricAlgoOrder {
|
|
200
|
+
instType: string;
|
|
201
|
+
instId: string;
|
|
202
|
+
ordId: string;
|
|
203
|
+
ccy: string;
|
|
204
|
+
algoId: string;
|
|
205
|
+
sz: string;
|
|
206
|
+
ordType: string;
|
|
207
|
+
side: string;
|
|
208
|
+
posSide: string;
|
|
209
|
+
tdMode: string;
|
|
210
|
+
tgtCcy: string;
|
|
211
|
+
state: string;
|
|
212
|
+
lever: string;
|
|
213
|
+
tpTriggerPx: string;
|
|
214
|
+
tpTriggerPxType: string;
|
|
215
|
+
tpOrdPx: string;
|
|
216
|
+
slTriggerPx: string;
|
|
217
|
+
slTriggerPxType: string;
|
|
218
|
+
triggerPx: string;
|
|
219
|
+
triggerPxType: string;
|
|
220
|
+
ordPx: string;
|
|
221
|
+
actualSz: string;
|
|
222
|
+
actualPx: string;
|
|
223
|
+
actualSide: string;
|
|
224
|
+
pxVar: string;
|
|
225
|
+
pxSpread: string;
|
|
226
|
+
pxLimit: string;
|
|
227
|
+
szLimit: string;
|
|
228
|
+
timeInterval: string;
|
|
229
|
+
callbackRatio: string;
|
|
230
|
+
callbackSpread: string;
|
|
231
|
+
activePx: string;
|
|
232
|
+
moveTriggerPx: string;
|
|
233
|
+
triggerTime: string;
|
|
234
|
+
cTime: string;
|
|
235
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"private-trade.js","sourceRoot":"","sources":["../../../../src/types/rest/response/private-trade.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { InstrumentType, numberInString } from '../shared';
|
|
2
|
+
export interface Ticker {
|
|
3
|
+
instType: InstrumentType;
|
|
4
|
+
instId: string;
|
|
5
|
+
last: numberInString;
|
|
6
|
+
lastSz: numberInString;
|
|
7
|
+
askPx: numberInString;
|
|
8
|
+
askSz: numberInString;
|
|
9
|
+
bidPx: numberInString;
|
|
10
|
+
bidSz: numberInString;
|
|
11
|
+
open24h: numberInString;
|
|
12
|
+
high24h: numberInString;
|
|
13
|
+
low24h: numberInString;
|
|
14
|
+
volCcy24h: numberInString;
|
|
15
|
+
vol24h: numberInString;
|
|
16
|
+
sodUtc0: numberInString;
|
|
17
|
+
sodUtc8: numberInString;
|
|
18
|
+
ts: numberInString;
|
|
19
|
+
}
|
|
20
|
+
export interface IndexTicker {
|
|
21
|
+
instId: string;
|
|
22
|
+
idxPx: string;
|
|
23
|
+
high24h: string;
|
|
24
|
+
sodUtc0: string;
|
|
25
|
+
open24h: string;
|
|
26
|
+
low24h: string;
|
|
27
|
+
sodUtc8: string;
|
|
28
|
+
ts: string;
|
|
29
|
+
}
|
|
30
|
+
declare type OBPrice = string;
|
|
31
|
+
declare type OBAssetQty = string;
|
|
32
|
+
declare type OBOrderCount = string;
|
|
33
|
+
declare type OrderBookLevel = [OBPrice, OBAssetQty, '0', OBOrderCount];
|
|
34
|
+
export interface OrderBook {
|
|
35
|
+
asks: OrderBookLevel[];
|
|
36
|
+
bids: OrderBookLevel[];
|
|
37
|
+
ts: string;
|
|
38
|
+
}
|
|
39
|
+
declare type timestamp = string;
|
|
40
|
+
declare type openPrice = string;
|
|
41
|
+
declare type highPrice = string;
|
|
42
|
+
declare type lowPrice = string;
|
|
43
|
+
declare type closePrice = string;
|
|
44
|
+
declare type vol = string;
|
|
45
|
+
declare type volCcy = string;
|
|
46
|
+
export declare type Candle = [
|
|
47
|
+
timestamp,
|
|
48
|
+
openPrice,
|
|
49
|
+
highPrice,
|
|
50
|
+
lowPrice,
|
|
51
|
+
closePrice,
|
|
52
|
+
vol,
|
|
53
|
+
volCcy
|
|
54
|
+
];
|
|
55
|
+
export declare type CandleNoVolume = [
|
|
56
|
+
timestamp,
|
|
57
|
+
openPrice,
|
|
58
|
+
highPrice,
|
|
59
|
+
lowPrice,
|
|
60
|
+
closePrice
|
|
61
|
+
];
|
|
62
|
+
export interface Trade {
|
|
63
|
+
instId: string;
|
|
64
|
+
side: string;
|
|
65
|
+
sz: string;
|
|
66
|
+
px: string;
|
|
67
|
+
tradeId: string;
|
|
68
|
+
ts: string;
|
|
69
|
+
}
|
|
70
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public-data.js","sourceRoot":"","sources":["../../../../src/types/rest/response/public-data.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export declare type numberInString<T = string> = T;
|
|
2
|
+
export interface APIResponse<T> {
|
|
3
|
+
code: '0';
|
|
4
|
+
msg: '';
|
|
5
|
+
data: T;
|
|
6
|
+
}
|
|
7
|
+
export declare type AlgoOrderType = 'conditional' | 'oco' | 'trigger' | 'move_order_stop' | 'iceberg' | 'twap';
|
|
8
|
+
export declare type AlgoState = 'effective' | 'canceled' | 'order_failed';
|
|
9
|
+
export declare type ContractGridDirection = 'long' | 'short' | 'neutral';
|
|
10
|
+
export declare type GridAlgoOrderType = 'grid' | 'contract_grid';
|
|
11
|
+
export declare type GridAlgoSubOrderType = 'live' | 'filled';
|
|
12
|
+
export declare type InstrumentType = 'SPOT' | 'MARGIN' | 'SWAP' | 'FUTURES' | 'OPTION';
|
|
13
|
+
export declare type MarginMode = 'cross' | 'isolated';
|
|
14
|
+
export declare type OrderSide = 'buy' | 'sell';
|
|
15
|
+
export declare type OrderType = 'market' | 'limit' | 'post_only' | 'fok' | 'ioc' | 'optimal_limit_ioc';
|
|
16
|
+
export declare type PositionSide = 'net' | 'long' | 'short';
|
|
17
|
+
export declare type PriceTriggerType = 'last' | 'index' | 'mark';
|
|
18
|
+
export interface RFQLeg {
|
|
19
|
+
instId: string;
|
|
20
|
+
sz: string;
|
|
21
|
+
side: OrderSide;
|
|
22
|
+
tgtCcy?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface RFQQuoteLegExtended {
|
|
25
|
+
px: string;
|
|
26
|
+
sz: string;
|
|
27
|
+
instId: string;
|
|
28
|
+
side: string;
|
|
29
|
+
fee: string;
|
|
30
|
+
feeCcy: string;
|
|
31
|
+
tradeId: string;
|
|
32
|
+
}
|
|
33
|
+
export declare type TradeMode = 'cross' | 'isolated' | 'cash';
|
|
34
|
+
export interface TimestampObject {
|
|
35
|
+
ts: numberInString;
|
|
36
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../src/types/rest/shared.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { AxiosRequestConfig } from 'axios';
|
|
2
|
+
import { RestClientOptions, OKXEnvironment } from './requestUtils';
|
|
3
|
+
export declare const MISSING_CREDENTIALS_ERROR = "Private endpoints require api and secret to be provided in the REST client constructor";
|
|
4
|
+
export interface APICredentials {
|
|
5
|
+
apiKey: string;
|
|
6
|
+
apiSecret: string;
|
|
7
|
+
apiPassphrase: string;
|
|
8
|
+
}
|
|
9
|
+
export default abstract class BaseRestClient {
|
|
10
|
+
private options;
|
|
11
|
+
private baseUrl;
|
|
12
|
+
private globalRequestOptions;
|
|
13
|
+
private apiKey;
|
|
14
|
+
private apiSecret;
|
|
15
|
+
private apiPassphrase;
|
|
16
|
+
private environment;
|
|
17
|
+
constructor(credentials: APICredentials | undefined | null, baseUrl: string, options: RestClientOptions | undefined, requestOptions: AxiosRequestConfig | undefined, environment: OKXEnvironment);
|
|
18
|
+
get(endpoint: string, params?: any): Promise<any>;
|
|
19
|
+
post(endpoint: string, params?: any): Promise<any>;
|
|
20
|
+
getPrivate(endpoint: string, params?: any): Promise<any>;
|
|
21
|
+
postPrivate(endpoint: string, params?: any): Promise<any>;
|
|
22
|
+
deletePrivate(endpoint: string, params?: any): Promise<any>;
|
|
23
|
+
/**
|
|
24
|
+
* Make a HTTP request to a specific endpoint. Private endpoints are automatically signed.
|
|
25
|
+
*/
|
|
26
|
+
private _call;
|
|
27
|
+
/**
|
|
28
|
+
* Sign request
|
|
29
|
+
*/
|
|
30
|
+
private signRequest;
|
|
31
|
+
/**
|
|
32
|
+
* Generic handler to parse request exceptions
|
|
33
|
+
*/
|
|
34
|
+
private parseException;
|
|
35
|
+
}
|