okx-api 1.3.7 → 1.4.1
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/lib/rest-client.d.ts +707 -213
- package/lib/rest-client.js +977 -409
- package/lib/rest-client.js.map +1 -1
- package/lib/types/rest/request/account.d.ts +93 -0
- package/lib/types/rest/request/block-trading.d.ts +16 -0
- package/lib/types/rest/request/copy-trading.d.ts +117 -0
- package/lib/types/rest/request/copy-trading.js +3 -0
- package/lib/types/rest/request/copy-trading.js.map +1 -0
- package/lib/types/rest/request/funding.d.ts +7 -0
- package/lib/types/rest/request/grid-trading.d.ts +14 -0
- package/lib/types/rest/request/index.d.ts +5 -0
- package/lib/types/rest/request/index.js +5 -0
- package/lib/types/rest/request/index.js.map +1 -1
- package/lib/types/rest/request/public.d.ts +40 -0
- package/lib/types/rest/request/recurring-buy.d.ts +28 -0
- package/lib/types/rest/request/recurring-buy.js +3 -0
- package/lib/types/rest/request/recurring-buy.js.map +1 -0
- package/lib/types/rest/request/signal-bot.d.ts +97 -0
- package/lib/types/rest/request/signal-bot.js +3 -0
- package/lib/types/rest/request/signal-bot.js.map +1 -0
- package/lib/types/rest/request/simple-earn.d.ts +23 -0
- package/lib/types/rest/request/simple-earn.js +3 -0
- package/lib/types/rest/request/simple-earn.js.map +1 -0
- package/lib/types/rest/request/spread-trading.d.ts +69 -0
- package/lib/types/rest/request/spread-trading.js +3 -0
- package/lib/types/rest/request/spread-trading.js.map +1 -0
- package/lib/types/rest/request/subaccount.d.ts +21 -0
- package/lib/types/rest/request/trade.d.ts +4 -0
- package/lib/types/rest/response/index.d.ts +4 -0
- package/lib/types/rest/response/index.js +4 -0
- package/lib/types/rest/response/index.js.map +1 -1
- package/lib/types/rest/response/private-account.d.ts +113 -0
- package/lib/types/rest/response/private-block-trading.d.ts +35 -0
- package/lib/types/rest/response/private-copy-trading.d.ts +259 -0
- package/lib/types/rest/response/private-copy-trading.js +3 -0
- package/lib/types/rest/response/private-copy-trading.js.map +1 -0
- package/lib/types/rest/response/private-funding.d.ts +14 -0
- package/lib/types/rest/response/private-recurring-buy.d.ts +63 -0
- package/lib/types/rest/response/private-recurring-buy.js +3 -0
- package/lib/types/rest/response/private-recurring-buy.js.map +1 -0
- package/lib/types/rest/response/private-signal-bot.d.ts +22 -0
- package/lib/types/rest/response/private-signal-bot.js +3 -0
- package/lib/types/rest/response/private-signal-bot.js.map +1 -0
- package/lib/types/rest/response/private-spread-trading.d.ts +125 -0
- package/lib/types/rest/response/private-spread-trading.js +3 -0
- package/lib/types/rest/response/private-spread-trading.js.map +1 -0
- package/lib/types/rest/response/private-subaccount.d.ts +16 -0
- package/lib/types/rest/response/private-trade.d.ts +5 -0
- package/lib/types/rest/response/public-data.d.ts +27 -0
- package/package.json +1 -1
package/lib/rest-client.js
CHANGED
|
@@ -38,7 +38,186 @@ class RestClient extends BaseRestClient_1.default {
|
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
40
40
|
*
|
|
41
|
-
*
|
|
41
|
+
* Trading account endpoints
|
|
42
|
+
*
|
|
43
|
+
*/
|
|
44
|
+
getAccountInstruments(params) {
|
|
45
|
+
return this.getPrivate('/api/v5/account/instruments', params);
|
|
46
|
+
}
|
|
47
|
+
getBalance(ccy) {
|
|
48
|
+
return this.getPrivate('/api/v5/account/balance', { ccy });
|
|
49
|
+
}
|
|
50
|
+
getPositions(params) {
|
|
51
|
+
return this.getPrivate('/api/v5/account/positions', params);
|
|
52
|
+
}
|
|
53
|
+
getPositionsHistory(params) {
|
|
54
|
+
return this.getPrivate('/api/v5/account/positions-history', params);
|
|
55
|
+
}
|
|
56
|
+
getAccountPositionRisk(instType) {
|
|
57
|
+
return this.getPrivate('/api/v5/account/account-position-risk', {
|
|
58
|
+
instType,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
/** Up to last 7 days */
|
|
62
|
+
getBills(params) {
|
|
63
|
+
return this.getPrivate('/api/v5/account/bills', params);
|
|
64
|
+
}
|
|
65
|
+
/** Last 3 months */
|
|
66
|
+
getBillsArchive(params) {
|
|
67
|
+
return this.getPrivate('/api/v5/account/bills-archive', params);
|
|
68
|
+
}
|
|
69
|
+
getAccountConfiguration() {
|
|
70
|
+
return this.getPrivate('/api/v5/account/config');
|
|
71
|
+
}
|
|
72
|
+
setPositionMode(posMode) {
|
|
73
|
+
return this.postPrivate('/api/v5/account/set-position-mode', { posMode });
|
|
74
|
+
}
|
|
75
|
+
setLeverage(params) {
|
|
76
|
+
return this.postPrivate('/api/v5/account/set-leverage', params);
|
|
77
|
+
}
|
|
78
|
+
/** Max buy/sell amount or open amount */
|
|
79
|
+
getMaxBuySellAmount(params) {
|
|
80
|
+
return this.getPrivate('/api/v5/account/max-size', params);
|
|
81
|
+
}
|
|
82
|
+
getMaxAvailableTradableAmount(params) {
|
|
83
|
+
return this.getPrivate('/api/v5/account/max-avail-size', params);
|
|
84
|
+
}
|
|
85
|
+
changePositionMargin(params) {
|
|
86
|
+
return this.postPrivate('/api/v5/account/position/margin-balance', params);
|
|
87
|
+
}
|
|
88
|
+
getLeverage(instId, mgnMode) {
|
|
89
|
+
return this.getPrivate('/api/v5/account/leverage-info', {
|
|
90
|
+
instId,
|
|
91
|
+
mgnMode,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
getLeverageEstimatedInfo(params) {
|
|
95
|
+
return this.getPrivate('/api/v5/account/adjust-leverage-info', params);
|
|
96
|
+
}
|
|
97
|
+
getMaxLoan(instId, mgnMode, mgnCcy) {
|
|
98
|
+
return this.getPrivate('/api/v5/account/max-loan', {
|
|
99
|
+
instId,
|
|
100
|
+
mgnMode,
|
|
101
|
+
mgnCcy,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
getFeeRates(instType, instId, uly) {
|
|
105
|
+
return this.getPrivate('/api/v5/account/trade-fee', {
|
|
106
|
+
instType,
|
|
107
|
+
instId,
|
|
108
|
+
uly,
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
getInterestAccrued(params) {
|
|
112
|
+
return this.getPrivate('/api/v5/account/interest-accrued', params);
|
|
113
|
+
}
|
|
114
|
+
getInterestRate(ccy) {
|
|
115
|
+
return this.getPrivate('/api/v5/account/interest-rate', { ccy });
|
|
116
|
+
}
|
|
117
|
+
setGreeksDisplayType(greeksType) {
|
|
118
|
+
return this.postPrivate('/api/v5/account/set-greeks', { greeksType });
|
|
119
|
+
}
|
|
120
|
+
setIsolatedMode(isoMode, type) {
|
|
121
|
+
return this.postPrivate('/api/v5/account/set-isolated-mode', {
|
|
122
|
+
isoMode,
|
|
123
|
+
type,
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
getMaxWithdrawals(ccy) {
|
|
127
|
+
return this.getPrivate('/api/v5/account/max-withdrawal', { ccy });
|
|
128
|
+
}
|
|
129
|
+
getAccountRiskState() {
|
|
130
|
+
return this.getPrivate('/api/v5/account/risk-state');
|
|
131
|
+
}
|
|
132
|
+
submitQuickMarginBorrowRepay(params) {
|
|
133
|
+
return this.postPrivate('/api/v5/account/quick-margin-borrow-repay', params);
|
|
134
|
+
}
|
|
135
|
+
getQuickMarginBorrowRepayHistory(params) {
|
|
136
|
+
return this.getPrivate('/api/v5/account/quick-margin-borrow-repay-history', params);
|
|
137
|
+
}
|
|
138
|
+
borrowRepayVIPLoan(ccy, side, amt, ordId) {
|
|
139
|
+
return this.postPrivate('/api/v5/account/borrow-repay', {
|
|
140
|
+
ccy,
|
|
141
|
+
side,
|
|
142
|
+
amt,
|
|
143
|
+
ordId,
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
getVIPLoanBorrowRepayHistory(params) {
|
|
147
|
+
return this.getPrivate('/api/v5/account/borrow-repay-history', params);
|
|
148
|
+
}
|
|
149
|
+
getVIPInterestAccrued(params) {
|
|
150
|
+
return this.getPrivate('/api/v5/account/vip-interest-accrued', params);
|
|
151
|
+
}
|
|
152
|
+
getVIPInterestDeducted(params) {
|
|
153
|
+
return this.getPrivate('/api/v5/account/vip-interest-deducted', params);
|
|
154
|
+
}
|
|
155
|
+
getVIPLoanOrders(params) {
|
|
156
|
+
return this.getPrivate('/api/v5/account/vip-loan-order-list', params);
|
|
157
|
+
}
|
|
158
|
+
getVIPLoanOrder(params) {
|
|
159
|
+
return this.getPrivate('/api/v5/account/vip-loan-order-detail', params);
|
|
160
|
+
}
|
|
161
|
+
getBorrowInterestLimits(params) {
|
|
162
|
+
return this.getPrivate('/api/v5/account/interest-limits', params);
|
|
163
|
+
}
|
|
164
|
+
getFixedLoanBorrowLimit() {
|
|
165
|
+
return this.getPrivate('/api/v5/account/fixed-loan/borrowing-limit');
|
|
166
|
+
}
|
|
167
|
+
getFixedLoanBorrowQuote(params) {
|
|
168
|
+
return this.getPrivate('/api/v5/account/fixed-loan/borrowing-quote', params);
|
|
169
|
+
}
|
|
170
|
+
submitFixedLoanBorrowOrder(params) {
|
|
171
|
+
return this.postPrivate('/api/v5/account/fixed-loan/borrowing-order', params);
|
|
172
|
+
}
|
|
173
|
+
updateFixedLoanBorrowOrder(params) {
|
|
174
|
+
return this.postPrivate('/api/v5/account/fixed-loan/amend-borrowing-order', params);
|
|
175
|
+
}
|
|
176
|
+
manualRenewFixedLoanBorrowOrder(params) {
|
|
177
|
+
return this.postPrivate('/api/v5/account/fixed-loan/manual-reborrow', params);
|
|
178
|
+
}
|
|
179
|
+
repayFixedLoanBorrowOrder(params) {
|
|
180
|
+
return this.postPrivate('/api/v5/account/fixed-loan/repay-borrowing-order', params);
|
|
181
|
+
}
|
|
182
|
+
getFixedLoanBorrowOrders(params) {
|
|
183
|
+
return this.getPrivate('/api/v5/account/fixed-loan/borrowing-orders-list', params);
|
|
184
|
+
}
|
|
185
|
+
positionBuilder(params) {
|
|
186
|
+
return this.postPrivate('/api/v5/account/position-builder', params);
|
|
187
|
+
}
|
|
188
|
+
updateRiskOffsetAmount(params) {
|
|
189
|
+
return this.postPrivate('/api/v5/account/set-riskOffset-amt', params);
|
|
190
|
+
}
|
|
191
|
+
getGreeks(ccy) {
|
|
192
|
+
return this.getPrivate('/api/v5/account/greeks', { ccy });
|
|
193
|
+
}
|
|
194
|
+
getPMLimitation(params) {
|
|
195
|
+
return this.getPrivate('/api/v5/account/position-tiers', params);
|
|
196
|
+
}
|
|
197
|
+
updateRiskOffsetType(params) {
|
|
198
|
+
return this.postPrivate('/api/v5/account/set-riskOffset-type', params);
|
|
199
|
+
}
|
|
200
|
+
activateOption() {
|
|
201
|
+
return this.postPrivate('/api/v5/account/activate-option');
|
|
202
|
+
}
|
|
203
|
+
setAutoLoan(params) {
|
|
204
|
+
return this.postPrivate('/api/v5/account/set-auto-loan', params);
|
|
205
|
+
}
|
|
206
|
+
setAccountMode(params) {
|
|
207
|
+
return this.postPrivate('/api/v5/account/set-account-level', params);
|
|
208
|
+
}
|
|
209
|
+
resetMMPStatus(params) {
|
|
210
|
+
return this.postPrivate('/api/v5/account/mmp-reset', params);
|
|
211
|
+
}
|
|
212
|
+
setMMPConfig(params) {
|
|
213
|
+
return this.postPrivate('/api/v5/account/mmp-config', params);
|
|
214
|
+
}
|
|
215
|
+
getMMPConfig(params) {
|
|
216
|
+
return this.getPrivate('/api/v5/account/mmp-config', params);
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
*
|
|
220
|
+
* Orderbook trading - trade endpoints
|
|
42
221
|
*
|
|
43
222
|
*/
|
|
44
223
|
submitOrder(params) {
|
|
@@ -92,26 +271,11 @@ class RestClient extends BaseRestClient_1.default {
|
|
|
92
271
|
getFillsHistory(params) {
|
|
93
272
|
return this.getPrivate('/api/v5/trade/fills-history', params);
|
|
94
273
|
}
|
|
95
|
-
|
|
96
|
-
return this.postPrivate('/api/v5/trade/
|
|
97
|
-
}
|
|
98
|
-
getAlgoOrderDetails(params) {
|
|
99
|
-
return this.getPrivate('/api/v5/trade/order-algo', params);
|
|
100
|
-
}
|
|
101
|
-
amendAlgoOrder(params) {
|
|
102
|
-
return this.postPrivate('/api/v5/trade/amend-algos', params);
|
|
103
|
-
}
|
|
104
|
-
cancelAlgoOrder(params) {
|
|
105
|
-
return this.postPrivate('/api/v5/trade/cancel-algos', params);
|
|
106
|
-
}
|
|
107
|
-
cancelAdvanceAlgoOrder(params) {
|
|
108
|
-
return this.postPrivate('/api/v5/trade/cancel-advance-algos', params);
|
|
109
|
-
}
|
|
110
|
-
getAlgoOrderList(params) {
|
|
111
|
-
return this.getPrivate('/api/v5/trade/orders-algo-pending', params);
|
|
274
|
+
applyTransactionDetailsArchive(params) {
|
|
275
|
+
return this.postPrivate('/api/v5/trade/fills-archive', params);
|
|
112
276
|
}
|
|
113
|
-
|
|
114
|
-
return this.getPrivate('/api/v5/trade/
|
|
277
|
+
getTransactionDetailsArchiveLink(params) {
|
|
278
|
+
return this.getPrivate('/api/v5/trade/fills-archive', params);
|
|
115
279
|
}
|
|
116
280
|
/** Get easy convert currency list */
|
|
117
281
|
getEasyConvertCurrencies() {
|
|
@@ -158,273 +322,813 @@ class RestClient extends BaseRestClient_1.default {
|
|
|
158
322
|
getOneClickRepayHistory(params) {
|
|
159
323
|
return this.getPrivate('/api/v5/trade/one-click-repay-history', params);
|
|
160
324
|
}
|
|
325
|
+
cancelMassOrder(params) {
|
|
326
|
+
return this.postPrivate('/api/v5/trade/mass-cancel', params);
|
|
327
|
+
}
|
|
328
|
+
cancelAllAfter(params) {
|
|
329
|
+
return this.postPrivate('/api/v5/trade/cancel-all-after', params);
|
|
330
|
+
}
|
|
331
|
+
getAccountRateLimit() {
|
|
332
|
+
return this.getPrivate('/api/v5/trade/account-rate-limit');
|
|
333
|
+
}
|
|
161
334
|
/**
|
|
162
335
|
*
|
|
163
|
-
*
|
|
336
|
+
* Orderbook trading - Algo trading endpoints
|
|
164
337
|
*
|
|
165
338
|
*/
|
|
166
|
-
|
|
167
|
-
return this.
|
|
168
|
-
}
|
|
169
|
-
createBlockRFQ(params) {
|
|
170
|
-
return this.postPrivate('/api/v5/rfq/create-rfq', params);
|
|
171
|
-
}
|
|
172
|
-
cancelBlockRFQ(params) {
|
|
173
|
-
return this.postPrivate('/api/v5/rfq/cancel-rfq', params);
|
|
174
|
-
}
|
|
175
|
-
cancelMultipleBlockRFQs(params) {
|
|
176
|
-
return this.postPrivate('/api/v5/rfq/cancel-batch-rfqs', params);
|
|
177
|
-
}
|
|
178
|
-
cancelAllRFQs() {
|
|
179
|
-
return this.postPrivate('/api/v5/rfq/cancel-all-rfqs');
|
|
180
|
-
}
|
|
181
|
-
executeBlockQuote(params) {
|
|
182
|
-
return this.postPrivate('/api/v5/rfq/execute-quote', params);
|
|
183
|
-
}
|
|
184
|
-
createBlockQuote(params) {
|
|
185
|
-
return this.postPrivate('/api/v5/rfq/create-quote', params);
|
|
186
|
-
}
|
|
187
|
-
cancelBlockQuote(params) {
|
|
188
|
-
return this.postPrivate('/api/v5/rfq/cancel-quote', params);
|
|
339
|
+
placeAlgoOrder(params) {
|
|
340
|
+
return this.postPrivate('/api/v5/trade/order-algo', params);
|
|
189
341
|
}
|
|
190
|
-
|
|
191
|
-
return this.postPrivate('/api/v5/
|
|
342
|
+
cancelAlgoOrder(params) {
|
|
343
|
+
return this.postPrivate('/api/v5/trade/cancel-algos', params);
|
|
192
344
|
}
|
|
193
|
-
|
|
194
|
-
return this.postPrivate('/api/v5/
|
|
345
|
+
amendAlgoOrder(params) {
|
|
346
|
+
return this.postPrivate('/api/v5/trade/amend-algos', params);
|
|
195
347
|
}
|
|
196
|
-
|
|
197
|
-
return this.
|
|
348
|
+
cancelAdvanceAlgoOrder(params) {
|
|
349
|
+
return this.postPrivate('/api/v5/trade/cancel-advance-algos', params);
|
|
198
350
|
}
|
|
199
|
-
|
|
200
|
-
return this.getPrivate('/api/v5/
|
|
351
|
+
getAlgoOrderDetails(params) {
|
|
352
|
+
return this.getPrivate('/api/v5/trade/order-algo', params);
|
|
201
353
|
}
|
|
202
|
-
|
|
203
|
-
return this.getPrivate('/api/v5/
|
|
354
|
+
getAlgoOrderList(params) {
|
|
355
|
+
return this.getPrivate('/api/v5/trade/orders-algo-pending', params);
|
|
204
356
|
}
|
|
205
|
-
|
|
206
|
-
return this.
|
|
357
|
+
getAlgoOrderHistory(params) {
|
|
358
|
+
return this.getPrivate('/api/v5/trade/orders-algo-history', params);
|
|
207
359
|
}
|
|
208
360
|
/**
|
|
209
361
|
*
|
|
210
|
-
*
|
|
362
|
+
* Orderbook trading - Grid trading endpoints
|
|
211
363
|
*
|
|
212
364
|
*/
|
|
213
|
-
|
|
214
|
-
return this.
|
|
215
|
-
}
|
|
216
|
-
getBalances(ccy) {
|
|
217
|
-
return this.getPrivate('/api/v5/asset/balances', { ccy });
|
|
218
|
-
}
|
|
219
|
-
getAccountAssetValuation(ccy) {
|
|
220
|
-
return this.getPrivate('/api/v5/asset/asset-valuation', { ccy });
|
|
365
|
+
placeGridAlgoOrder(params) {
|
|
366
|
+
return this.postPrivate('/api/v5/tradingBot/grid/order-algo', params);
|
|
221
367
|
}
|
|
222
|
-
|
|
223
|
-
return this.postPrivate('/api/v5/
|
|
368
|
+
amendGridAlgoOrder(algoId, instId, triggerPx) {
|
|
369
|
+
return this.postPrivate('/api/v5/tradingBot/grid/amend-order-algo', Object.assign({ algoId,
|
|
370
|
+
instId }, triggerPx));
|
|
224
371
|
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
return this.getPrivate('/api/v5/asset/transfer-state', params);
|
|
372
|
+
stopGridAlgoOrder(orders) {
|
|
373
|
+
return this.postPrivate('/api/v5/tradingBot/grid/stop-order-algo', orders);
|
|
228
374
|
}
|
|
229
|
-
|
|
230
|
-
return this.
|
|
375
|
+
closeGridContractPosition(params) {
|
|
376
|
+
return this.postPrivate('/api/v5/tradingBot/grid/close-position', params);
|
|
231
377
|
}
|
|
232
|
-
|
|
233
|
-
return this.
|
|
378
|
+
cancelGridContractCloseOrder(params) {
|
|
379
|
+
return this.postPrivate('/api/v5/tradingBot/grid/cancel-close-order', params);
|
|
234
380
|
}
|
|
235
|
-
|
|
236
|
-
return this.
|
|
381
|
+
instantTriggerGridAlgoOrder(params) {
|
|
382
|
+
return this.postPrivate('/api/v5/tradingBot/grid/order-instant-trigger', params);
|
|
237
383
|
}
|
|
238
|
-
|
|
239
|
-
return this.getPrivate('/api/v5/
|
|
384
|
+
getGridAlgoOrderList(params) {
|
|
385
|
+
return this.getPrivate('/api/v5/tradingBot/grid/orders-algo-pending', params);
|
|
240
386
|
}
|
|
241
|
-
|
|
242
|
-
return this.
|
|
387
|
+
getGridAlgoOrderHistory(params) {
|
|
388
|
+
return this.getPrivate('/api/v5/tradingBot/grid/orders-algo-history', params);
|
|
243
389
|
}
|
|
244
|
-
|
|
245
|
-
return this.
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
memo,
|
|
390
|
+
getGridAlgoOrderDetails(algoOrdType, algoId) {
|
|
391
|
+
return this.getPrivate('/api/v5/tradingBot/grid/orders-algo-details', {
|
|
392
|
+
algoOrdType,
|
|
393
|
+
algoId,
|
|
249
394
|
});
|
|
250
395
|
}
|
|
251
|
-
|
|
252
|
-
return this.
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
}
|
|
257
|
-
smallAssetsConvert(ccy) {
|
|
258
|
-
return this.getPrivate('/api/v5/asset/convert-dust-assets', { ccy });
|
|
396
|
+
getGridAlgoSubOrders(algoOrdType, algoId, type, groupId, pagination) {
|
|
397
|
+
return this.getPrivate('/api/v5/tradingBot/grid/sub-orders', Object.assign({ algoOrdType,
|
|
398
|
+
algoId,
|
|
399
|
+
type,
|
|
400
|
+
groupId }, pagination));
|
|
259
401
|
}
|
|
260
|
-
|
|
261
|
-
|
|
402
|
+
/** Only contract grid supports this method */
|
|
403
|
+
getGridAlgoOrderPositions(algoOrdType, algoId) {
|
|
404
|
+
return this.getPrivate('/api/v5/tradingBot/grid/positions', {
|
|
405
|
+
algoOrdType,
|
|
406
|
+
algoId,
|
|
407
|
+
});
|
|
262
408
|
}
|
|
263
|
-
|
|
264
|
-
return this.postPrivate('/api/v5/
|
|
265
|
-
|
|
409
|
+
spotGridWithdrawIncome(algoId) {
|
|
410
|
+
return this.postPrivate('/api/v5/tradingBot/grid/withdraw-income', {
|
|
411
|
+
algoId,
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
computeGridMarginBalance(algoId, type, amt) {
|
|
415
|
+
return this.postPrivate('/api/v5/tradingBot/grid/compute-margin-balance', {
|
|
416
|
+
algoId,
|
|
417
|
+
type,
|
|
266
418
|
amt,
|
|
267
|
-
side,
|
|
268
|
-
rate,
|
|
269
419
|
});
|
|
270
420
|
}
|
|
271
|
-
|
|
272
|
-
return this.postPrivate('/api/v5/
|
|
273
|
-
|
|
274
|
-
|
|
421
|
+
adjustGridMarginBalance(algoId, type, change) {
|
|
422
|
+
return this.postPrivate('/api/v5/tradingBot/grid/margin-balance', Object.assign({ algoId,
|
|
423
|
+
type }, change));
|
|
424
|
+
}
|
|
425
|
+
adjustGridInvestment(params) {
|
|
426
|
+
return this.postPrivate('/api/v5/tradingBot/grid/adjust-investment', params);
|
|
427
|
+
}
|
|
428
|
+
getGridAIParameter(algoOrdType, instId, direction, duration) {
|
|
429
|
+
return this.get('/api/v5/tradingBot/grid/ai-param', {
|
|
430
|
+
algoOrdType,
|
|
431
|
+
instId,
|
|
432
|
+
direction,
|
|
433
|
+
duration,
|
|
275
434
|
});
|
|
276
435
|
}
|
|
277
|
-
|
|
278
|
-
return this.
|
|
436
|
+
computeGridMinInvestment(params) {
|
|
437
|
+
return this.post('/api/v5/tradingBot/grid/min-investment', params);
|
|
279
438
|
}
|
|
280
|
-
|
|
281
|
-
return this.get('/api/v5/
|
|
439
|
+
getRSIBackTesting(params) {
|
|
440
|
+
return this.get('/api/v5/tradingBot/public/rsi-back-testing', params);
|
|
282
441
|
}
|
|
283
|
-
|
|
284
|
-
|
|
442
|
+
/**
|
|
443
|
+
*
|
|
444
|
+
* Orderbook trading - Signal bot trading endpoints
|
|
445
|
+
*
|
|
446
|
+
*/
|
|
447
|
+
createSignal(params) {
|
|
448
|
+
return this.postPrivate('/api/v5/tradingBot/signal/create-signal', params);
|
|
449
|
+
}
|
|
450
|
+
getSignals(params) {
|
|
451
|
+
return this.getPrivate('/api/v5/tradingBot/signal/signals', params);
|
|
452
|
+
}
|
|
453
|
+
createSignalBot(params) {
|
|
454
|
+
return this.postPrivate('/api/v5/tradingBot/signal/order-algo', params);
|
|
455
|
+
}
|
|
456
|
+
cancelSignalBots(params) {
|
|
457
|
+
return this.postPrivate('/api/v5/tradingBot/signal/stop-order-algo', params);
|
|
458
|
+
}
|
|
459
|
+
updateSignalMargin(params) {
|
|
460
|
+
return this.postPrivate('/api/v5/tradingBot/signal/margin-balance', params);
|
|
461
|
+
}
|
|
462
|
+
updateSignalTPSL(params) {
|
|
463
|
+
return this.postPrivate('/api/v5/tradingBot/signal/amendTPSL', params);
|
|
464
|
+
}
|
|
465
|
+
setSignalInstruments(params) {
|
|
466
|
+
return this.postPrivate('/api/v5/tradingBot/signal/set-instruments', params);
|
|
467
|
+
}
|
|
468
|
+
getSignalBotOrder(params) {
|
|
469
|
+
return this.getPrivate('/api/v5/tradingBot/signal/orders-algo-details', params);
|
|
470
|
+
}
|
|
471
|
+
getActiveSignalBot(params) {
|
|
472
|
+
return this.getPrivate('/api/v5/tradingBot/signal/orders-algo-details', params);
|
|
473
|
+
}
|
|
474
|
+
getSignalBotHistory(params) {
|
|
475
|
+
return this.getPrivate('/api/v5/tradingBot/signal/orders-algo-history', params);
|
|
476
|
+
}
|
|
477
|
+
getSignalBotPositions(params) {
|
|
478
|
+
return this.getPrivate('/api/v5/tradingBot/signal/positions', params);
|
|
479
|
+
}
|
|
480
|
+
getSignalBotPositionHistory(params) {
|
|
481
|
+
return this.getPrivate('/api/v5/tradingBot/signal/positions-history', params);
|
|
482
|
+
}
|
|
483
|
+
closeSignalBotPosition(params) {
|
|
484
|
+
return this.postPrivate('/api/v5/tradingBot/signal/close-position', params);
|
|
485
|
+
}
|
|
486
|
+
placeSignalBotSubOrder(params) {
|
|
487
|
+
return this.postPrivate('/api/v5/tradingBot/signal/sub-order', params);
|
|
488
|
+
}
|
|
489
|
+
cancelSubOrder(params) {
|
|
490
|
+
return this.postPrivate('/api/v5/tradingBot/signal/cancel-sub-order', params);
|
|
491
|
+
}
|
|
492
|
+
getSignalBotSubOrders(params) {
|
|
493
|
+
return this.getPrivate('/api/v5/tradingBot/signal/sub-orders', params);
|
|
494
|
+
}
|
|
495
|
+
getSignalBotEventHistory(params) {
|
|
496
|
+
return this.getPrivate('/api/v5/tradingBot/signal/event-history', params);
|
|
285
497
|
}
|
|
286
498
|
/**
|
|
287
499
|
*
|
|
288
|
-
*
|
|
500
|
+
* Orderbook trading - Recurring buy endpoints
|
|
289
501
|
*
|
|
290
502
|
*/
|
|
291
|
-
|
|
292
|
-
return this.
|
|
503
|
+
submitRecurringBuyOrder(params) {
|
|
504
|
+
return this.postPrivate('/api/v5/tradingBot/recurring/order-algo', params);
|
|
293
505
|
}
|
|
294
|
-
|
|
295
|
-
return this.
|
|
296
|
-
fromCcy,
|
|
297
|
-
toCcy,
|
|
298
|
-
});
|
|
506
|
+
amendRecurringBuyOrder(params) {
|
|
507
|
+
return this.postPrivate('/api/v5/tradingBot/recurring/amend-order-algo', params);
|
|
299
508
|
}
|
|
300
|
-
|
|
301
|
-
return this.postPrivate('/api/v5/
|
|
509
|
+
stopRecurringBuyOrder(params) {
|
|
510
|
+
return this.postPrivate('/api/v5/tradingBot/recurring/stop-order-algo', params);
|
|
302
511
|
}
|
|
303
|
-
|
|
304
|
-
return this.
|
|
512
|
+
getRecurringBuyOrders(params) {
|
|
513
|
+
return this.getPrivate('/api/v5/tradingBot/recurring/orders-algo-pending', params);
|
|
305
514
|
}
|
|
306
|
-
|
|
307
|
-
return this.getPrivate('/api/v5/
|
|
515
|
+
getRecurringBuyOrderHistory(params) {
|
|
516
|
+
return this.getPrivate('/api/v5/tradingBot/recurring/orders-algo-history', params);
|
|
517
|
+
}
|
|
518
|
+
getRecurringBuyOrderDetails(params) {
|
|
519
|
+
return this.getPrivate('/api/v5/tradingBot/recurring/orders-algo-details', params);
|
|
520
|
+
}
|
|
521
|
+
getRecurringBuySubOrders(params) {
|
|
522
|
+
return this.getPrivate('/api/v5/tradingBot/recurring/sub-orders', params);
|
|
308
523
|
}
|
|
309
524
|
/**
|
|
310
525
|
*
|
|
311
|
-
*
|
|
526
|
+
* Orderbook trading - Copy trading endpoints
|
|
312
527
|
*
|
|
313
528
|
*/
|
|
314
|
-
|
|
315
|
-
return this.getPrivate('/api/v5/
|
|
529
|
+
getCopytradingSubpositions(params) {
|
|
530
|
+
return this.getPrivate('/api/v5/copytrading/current-subpositions', params);
|
|
316
531
|
}
|
|
317
|
-
|
|
318
|
-
return this.getPrivate('/api/v5/
|
|
532
|
+
getCopytradingSubpositionsHistory(params) {
|
|
533
|
+
return this.getPrivate('/api/v5/copytrading/subpositions-history', params);
|
|
319
534
|
}
|
|
320
|
-
|
|
321
|
-
return this.
|
|
535
|
+
submitCopytradingAlgoOrder(params) {
|
|
536
|
+
return this.postPrivate('/api/v5/copytrading/algo-order', params);
|
|
322
537
|
}
|
|
323
|
-
|
|
324
|
-
return this.
|
|
325
|
-
instType,
|
|
326
|
-
});
|
|
538
|
+
closeCopytradingSubposition(params) {
|
|
539
|
+
return this.postPrivate('/api/v5/copytrading/close-subposition', params);
|
|
327
540
|
}
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
return this.getPrivate('/api/v5/account/bills', params);
|
|
541
|
+
getCopytradingInstruments(params) {
|
|
542
|
+
return this.getPrivate('/api/v5/copytrading/instruments', params);
|
|
331
543
|
}
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
return this.getPrivate('/api/v5/account/bills-archive', params);
|
|
544
|
+
setCopytradingInstruments(params) {
|
|
545
|
+
return this.postPrivate('/api/v5/copytrading/set-instruments', params);
|
|
335
546
|
}
|
|
336
|
-
|
|
337
|
-
return this.getPrivate('/api/v5/
|
|
547
|
+
getCopytradingProfitDetails(params) {
|
|
548
|
+
return this.getPrivate('/api/v5/copytrading/profit-sharing-details', params);
|
|
338
549
|
}
|
|
339
|
-
|
|
340
|
-
return this.
|
|
550
|
+
getCopytradingTotalProfit(params) {
|
|
551
|
+
return this.getPrivate('/api/v5/copytrading/total-profit-sharing', params);
|
|
341
552
|
}
|
|
342
|
-
|
|
343
|
-
return this.
|
|
553
|
+
getCopytradingUnrealizedProfit(params) {
|
|
554
|
+
return this.getPrivate('/api/v5/copytrading/unrealized-profit-sharing-details', params);
|
|
344
555
|
}
|
|
345
|
-
|
|
346
|
-
return this.
|
|
556
|
+
getCopytradingTotalUnrealizedProfit(params) {
|
|
557
|
+
return this.getPrivate('/api/v5/copytrading/total-unrealized-profit-sharing', params);
|
|
347
558
|
}
|
|
348
|
-
|
|
349
|
-
return this.postPrivate('/api/v5/
|
|
559
|
+
applyCopytradingLeadTrading(params) {
|
|
560
|
+
return this.postPrivate('/api/v5/copytrading/apply-lead-trading', params);
|
|
350
561
|
}
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
return this.getPrivate('/api/v5/account/max-size', params);
|
|
562
|
+
stopCopytradingLeadTrading(params) {
|
|
563
|
+
return this.postPrivate('/api/v5/copytrading/stop-lead-trading', params);
|
|
354
564
|
}
|
|
355
|
-
|
|
356
|
-
return this.
|
|
565
|
+
updateCopytradingProfitSharing(params) {
|
|
566
|
+
return this.postPrivate('/api/v5/copytrading/amend-profit-sharing-ratio', params);
|
|
357
567
|
}
|
|
358
|
-
|
|
359
|
-
return this.
|
|
568
|
+
getCopytradingAccount() {
|
|
569
|
+
return this.getPrivate('/api/v5/copytrading/config');
|
|
360
570
|
}
|
|
361
|
-
|
|
362
|
-
return this.
|
|
363
|
-
instId,
|
|
364
|
-
mgnMode,
|
|
365
|
-
});
|
|
571
|
+
setCopytradingFirstCopy(params) {
|
|
572
|
+
return this.postPrivate('/api/v5/copytrading/first-copy-settings', params);
|
|
366
573
|
}
|
|
367
|
-
|
|
368
|
-
return this.
|
|
574
|
+
updateCopytradingCopySettings(params) {
|
|
575
|
+
return this.postPrivate('/api/v5/copytrading/amend-copy-settings', params);
|
|
369
576
|
}
|
|
370
|
-
|
|
371
|
-
return this.
|
|
577
|
+
stopCopytradingCopy(params) {
|
|
578
|
+
return this.postPrivate('/api/v5/copytrading/stop-copy-trading', params);
|
|
579
|
+
}
|
|
580
|
+
getCopytradingCopySettings(params) {
|
|
581
|
+
return this.getPrivate('/api/v5/copytrading/copy-settings', params);
|
|
582
|
+
}
|
|
583
|
+
getCopytradingBatchLeverageInfo(params) {
|
|
584
|
+
return this.getPrivate('/api/v5/copytrading/batch-leverage-info', params);
|
|
585
|
+
}
|
|
586
|
+
setCopytradingBatchLeverage(params) {
|
|
587
|
+
return this.postPrivate('/api/v5/copytrading/batch-set-leverage', params);
|
|
588
|
+
}
|
|
589
|
+
getCopytradingMyLeadTraders(params) {
|
|
590
|
+
return this.getPrivate('/api/v5/copytrading/current-lead-traders', params);
|
|
591
|
+
}
|
|
592
|
+
getCopytradingLeadTradersHistory(params) {
|
|
593
|
+
return this.getPrivate('/api/v5/copytrading/lead-traders-history', params);
|
|
594
|
+
}
|
|
595
|
+
getCopytradingConfig(params) {
|
|
596
|
+
return this.get('/api/v5/copytrading/public-config', params);
|
|
597
|
+
}
|
|
598
|
+
getCopytradingLeadRanks(params) {
|
|
599
|
+
return this.get('/api/v5/copytrading/public-lead-traders', params);
|
|
600
|
+
}
|
|
601
|
+
getCopytradingLeadWeeklyPnl(params) {
|
|
602
|
+
return this.get('/api/v5/copytrading/public-weekly-pnl', params);
|
|
603
|
+
}
|
|
604
|
+
getCopytradingLeadDailyPnl(params) {
|
|
605
|
+
return this.get('/api/v5/copytrading/public-pnl', params);
|
|
606
|
+
}
|
|
607
|
+
getCopytradingLeadStats(params) {
|
|
608
|
+
return this.get('/api/v5/copytrading/public-stats', params);
|
|
609
|
+
}
|
|
610
|
+
getCopytradingLeadPreferences(params) {
|
|
611
|
+
return this.get('/api/v5/copytrading/public-preference-currency', params);
|
|
612
|
+
}
|
|
613
|
+
getCopytradingLeadOpenPositions(params) {
|
|
614
|
+
return this.get('/api/v5/copytrading/public-current-subpositions', params);
|
|
615
|
+
}
|
|
616
|
+
getCopytradingLeadPositionHistory(params) {
|
|
617
|
+
return this.get('/api/v5/copytrading/public-subpositions-history', params);
|
|
618
|
+
}
|
|
619
|
+
getCopyTraders(params) {
|
|
620
|
+
return this.get('/api/v5/copytrading/public-copy-traders', params);
|
|
621
|
+
}
|
|
622
|
+
getCopytradingLeadPrivateRanks(params) {
|
|
623
|
+
return this.getPrivate('/api/v5/copytrading/lead-traders', params);
|
|
624
|
+
}
|
|
625
|
+
getCopytradingLeadPrivateWeeklyPnl(params) {
|
|
626
|
+
return this.getPrivate('/api/v5/copytrading/weekly-pnl', params);
|
|
627
|
+
}
|
|
628
|
+
getCopytradingPLeadPrivateDailyPnl(params) {
|
|
629
|
+
return this.getPrivate('/api/v5/copytrading/pnl', params);
|
|
630
|
+
}
|
|
631
|
+
geCopytradingLeadPrivateStats(params) {
|
|
632
|
+
return this.getPrivate('/api/v5/copytrading/stats', params);
|
|
633
|
+
}
|
|
634
|
+
getCopytradingLeadPrivatePreferences(params) {
|
|
635
|
+
return this.getPrivate('/api/v5/copytrading/preference-currency', params);
|
|
636
|
+
}
|
|
637
|
+
getCopytradingLeadPrivateOpenPositions(params) {
|
|
638
|
+
return this.getPrivate('/api/v5/copytrading/performance-current-subpositions', params);
|
|
639
|
+
}
|
|
640
|
+
getCopytradingLeadPrivatePositionHistory(params) {
|
|
641
|
+
return this.getPrivate('/api/v5/copytrading/performance-subpositions-history', params);
|
|
642
|
+
}
|
|
643
|
+
getCopyTradersPrivate(params) {
|
|
644
|
+
return this.getPrivate('/api/v5/copytrading/copy-traders', params);
|
|
645
|
+
}
|
|
646
|
+
/**
|
|
647
|
+
*
|
|
648
|
+
* Orderbook trading - Market data endpoints
|
|
649
|
+
*
|
|
650
|
+
*/
|
|
651
|
+
getTickers(instrumentType, uly) {
|
|
652
|
+
return this.get('/api/v5/market/tickers', {
|
|
653
|
+
instType: instrumentType,
|
|
654
|
+
uly,
|
|
655
|
+
});
|
|
656
|
+
}
|
|
657
|
+
getTicker(instId) {
|
|
658
|
+
return this.get('/api/v5/market/ticker', {
|
|
372
659
|
instId,
|
|
373
|
-
mgnMode,
|
|
374
|
-
mgnCcy,
|
|
375
660
|
});
|
|
376
661
|
}
|
|
377
|
-
|
|
378
|
-
return this.
|
|
662
|
+
getOrderBook(instId, sz) {
|
|
663
|
+
return this.get('/api/v5/market/books', { instId, sz });
|
|
664
|
+
}
|
|
665
|
+
getFullOrderBook(params) {
|
|
666
|
+
return this.get('/api/v5/market/books-full', params);
|
|
667
|
+
}
|
|
668
|
+
/**
|
|
669
|
+
* @deprecated this method's parameters will change to an object in the next release. Use getCandlesV2 instead.
|
|
670
|
+
*
|
|
671
|
+
* @param instId
|
|
672
|
+
* @param bar
|
|
673
|
+
* @param pagination
|
|
674
|
+
* @returns
|
|
675
|
+
*/
|
|
676
|
+
getCandles(instId, bar = '1m', pagination) {
|
|
677
|
+
return this.get('/api/v5/market/candles', Object.assign({ instId,
|
|
678
|
+
bar }, pagination));
|
|
679
|
+
}
|
|
680
|
+
getCandlesV2(params) {
|
|
681
|
+
return this.get('/api/v5/market/candles', params);
|
|
682
|
+
}
|
|
683
|
+
/**
|
|
684
|
+
* @deprecated this method's parameters will change to an object in the next release. Use getHistoricCandlesV2 instead.
|
|
685
|
+
*
|
|
686
|
+
* @param instId
|
|
687
|
+
* @param bar
|
|
688
|
+
* @param pagination
|
|
689
|
+
* @returns
|
|
690
|
+
*/
|
|
691
|
+
getHistoricCandles(instId, bar = '1m', pagination) {
|
|
692
|
+
return this.get('/api/v5/market/history-candles', Object.assign({ instId,
|
|
693
|
+
bar }, pagination));
|
|
694
|
+
}
|
|
695
|
+
getHistoricCandlesV2(params) {
|
|
696
|
+
return this.get('/api/v5/market/history-candles', params);
|
|
697
|
+
}
|
|
698
|
+
getTrades(instId, limit) {
|
|
699
|
+
return this.get('/api/v5/market/trades', { instId, limit });
|
|
700
|
+
}
|
|
701
|
+
getHistoricTrades(instId, pagination) {
|
|
702
|
+
return this.get('/api/v5/market/history-trades', Object.assign({ instId }, pagination));
|
|
703
|
+
}
|
|
704
|
+
getOptionTradesByInstrument(params) {
|
|
705
|
+
return this.get('/api/v5/market/option/instrument-family-trades', params);
|
|
706
|
+
}
|
|
707
|
+
getOptionTrades(params) {
|
|
708
|
+
return this.get('/api/v5/public/option-trades', params);
|
|
709
|
+
}
|
|
710
|
+
get24hrTotalVolume() {
|
|
711
|
+
return this.get('/api/v5/market/platform-24-volume');
|
|
712
|
+
}
|
|
713
|
+
/**
|
|
714
|
+
*
|
|
715
|
+
* Block trading - REST endpoints
|
|
716
|
+
*
|
|
717
|
+
*/
|
|
718
|
+
getBlockCounterParties() {
|
|
719
|
+
return this.getPrivate('/api/v5/rfq/counterparties');
|
|
720
|
+
}
|
|
721
|
+
createBlockRFQ(params) {
|
|
722
|
+
return this.postPrivate('/api/v5/rfq/create-rfq', params);
|
|
723
|
+
}
|
|
724
|
+
cancelBlockRFQ(params) {
|
|
725
|
+
return this.postPrivate('/api/v5/rfq/cancel-rfq', params);
|
|
726
|
+
}
|
|
727
|
+
cancelMultipleBlockRFQs(params) {
|
|
728
|
+
return this.postPrivate('/api/v5/rfq/cancel-batch-rfqs', params);
|
|
729
|
+
}
|
|
730
|
+
cancelAllRFQs() {
|
|
731
|
+
return this.postPrivate('/api/v5/rfq/cancel-all-rfqs');
|
|
732
|
+
}
|
|
733
|
+
executeBlockQuote(params) {
|
|
734
|
+
return this.postPrivate('/api/v5/rfq/execute-quote', params);
|
|
735
|
+
}
|
|
736
|
+
getQuoteProducts() {
|
|
737
|
+
return this.getPrivate('/api/v5/rfq/maker-instrument-settings');
|
|
738
|
+
}
|
|
739
|
+
updateBlockQuoteProducts(params) {
|
|
740
|
+
return this.postPrivate('/api/v5/rfq/maker-instrument-settings', params);
|
|
741
|
+
}
|
|
742
|
+
resetBlockMmp() {
|
|
743
|
+
return this.postPrivate('/api/v5/rfq/mmp-reset');
|
|
744
|
+
}
|
|
745
|
+
updateBlockMmpConfig(params) {
|
|
746
|
+
return this.postPrivate('/api/v5/rfq/mmp-config', params);
|
|
747
|
+
}
|
|
748
|
+
getBlockMmpConfig() {
|
|
749
|
+
return this.getPrivate('/api/v5/rfq/mmp-config');
|
|
750
|
+
}
|
|
751
|
+
createBlockQuote(params) {
|
|
752
|
+
return this.postPrivate('/api/v5/rfq/create-quote', params);
|
|
753
|
+
}
|
|
754
|
+
cancelBlockQuote(params) {
|
|
755
|
+
return this.postPrivate('/api/v5/rfq/cancel-quote', params);
|
|
756
|
+
}
|
|
757
|
+
cancelMultipleBlockQuotes(params) {
|
|
758
|
+
return this.postPrivate('/api/v5/rfq/cancel-batch-quotes', params);
|
|
759
|
+
}
|
|
760
|
+
cancelAllBlockQuotes() {
|
|
761
|
+
return this.postPrivate('/api/v5/rfq/cancel-all-quotes');
|
|
762
|
+
}
|
|
763
|
+
cancelAllBlockAfter(params) {
|
|
764
|
+
return this.postPrivate('/api/v5/rfq/cancel-all-after', params);
|
|
765
|
+
}
|
|
766
|
+
getBlockRFQs(params) {
|
|
767
|
+
return this.getPrivate('/api/v5/rfq/rfqs', params);
|
|
768
|
+
}
|
|
769
|
+
getBlockQuotes(params) {
|
|
770
|
+
return this.getPrivate('/api/v5/rfq/quotes', params);
|
|
771
|
+
}
|
|
772
|
+
getBlockTrades(params) {
|
|
773
|
+
return this.getPrivate('/api/v5/rfq/trades', params);
|
|
774
|
+
}
|
|
775
|
+
getPublicRFQBlockTrades(params) {
|
|
776
|
+
return this.get('/api/v5/rfq/public-trades', params);
|
|
777
|
+
}
|
|
778
|
+
getBlockTickers(instType, uly) {
|
|
779
|
+
return this.get('/api/v5/market/block-tickers', { instType, uly });
|
|
780
|
+
}
|
|
781
|
+
getBlockTicker(instId) {
|
|
782
|
+
return this.get('/api/v5/market/block-ticker', { instId });
|
|
783
|
+
}
|
|
784
|
+
getBlockPublicTrades(params) {
|
|
785
|
+
return this.get('/api/v5/public/block-trades', params);
|
|
786
|
+
}
|
|
787
|
+
/**
|
|
788
|
+
*
|
|
789
|
+
* Spread trading - REST endpoints
|
|
790
|
+
*
|
|
791
|
+
*/
|
|
792
|
+
submitSpreadOrder(params) {
|
|
793
|
+
return this.postPrivate('/api/v5/sprd/order', params);
|
|
794
|
+
}
|
|
795
|
+
cancelSpreadOrder(params) {
|
|
796
|
+
return this.postPrivate('/api/v5/sprd/cancel-order', params);
|
|
797
|
+
}
|
|
798
|
+
cancelAllSpreadOrders(params) {
|
|
799
|
+
return this.postPrivate('/api/v5/sprd/mass-cancel', params);
|
|
800
|
+
}
|
|
801
|
+
updateSpreadOrder(params) {
|
|
802
|
+
return this.postPrivate('/api/v5/sprd/amend-order', params);
|
|
803
|
+
}
|
|
804
|
+
getSpreadOrder(params) {
|
|
805
|
+
return this.getPrivate('/api/v5/sprd/order', params);
|
|
806
|
+
}
|
|
807
|
+
getSpreadActiveOrders(params) {
|
|
808
|
+
return this.getPrivate('/api/v5/sprd/orders-pending', params);
|
|
809
|
+
}
|
|
810
|
+
getSpreadOrdersRecent(params) {
|
|
811
|
+
return this.getPrivate('/api/v5/sprd/orders-history', params);
|
|
812
|
+
}
|
|
813
|
+
getSpreadOrdersArchive(params) {
|
|
814
|
+
return this.getPrivate('/api/v5/sprd/orders-history-archive', params);
|
|
815
|
+
}
|
|
816
|
+
getSpreadTrades(params) {
|
|
817
|
+
return this.getPrivate('/api/v5/sprd/trades', params);
|
|
818
|
+
}
|
|
819
|
+
getSpreads(params) {
|
|
820
|
+
return this.get('/api/v5/sprd/spreads', params);
|
|
821
|
+
}
|
|
822
|
+
getSpreadOrderBook(params) {
|
|
823
|
+
return this.get('/api/v5/sprd/books', params);
|
|
824
|
+
}
|
|
825
|
+
getSpreadTicker(params) {
|
|
826
|
+
return this.get('/api/v5/market/sprd-ticker', params);
|
|
827
|
+
}
|
|
828
|
+
getSpreadPublicTrades(params) {
|
|
829
|
+
return this.get('/api/v5/sprd/public-trades', params);
|
|
830
|
+
}
|
|
831
|
+
getSpreadCandles(params) {
|
|
832
|
+
return this.get('/api/v5/market/sprd-candles', params);
|
|
833
|
+
}
|
|
834
|
+
getSpreadHistoryCandles(params) {
|
|
835
|
+
return this.get('/api/v5/market/sprd-history-candles', params);
|
|
836
|
+
}
|
|
837
|
+
cancelSpreadAllAfter(params) {
|
|
838
|
+
return this.postPrivate('/api/v5/sprd/cancel-all-after', params);
|
|
839
|
+
}
|
|
840
|
+
/**
|
|
841
|
+
*
|
|
842
|
+
* Public data - rest endpoints
|
|
843
|
+
*
|
|
844
|
+
*/
|
|
845
|
+
getInstruments(instType, uly, instFamily, instId) {
|
|
846
|
+
return this.get('/api/v5/public/instruments', {
|
|
379
847
|
instType,
|
|
380
|
-
instId,
|
|
381
848
|
uly,
|
|
849
|
+
instFamily,
|
|
850
|
+
instId,
|
|
382
851
|
});
|
|
383
852
|
}
|
|
384
|
-
|
|
385
|
-
return this.
|
|
853
|
+
getDeliveryExerciseHistory(params) {
|
|
854
|
+
return this.get('/api/v5/public/delivery-exercise-history', params);
|
|
386
855
|
}
|
|
387
|
-
|
|
388
|
-
return this.
|
|
856
|
+
getOpenInterest(params) {
|
|
857
|
+
return this.get('/api/v5/public/open-interest', params);
|
|
389
858
|
}
|
|
390
|
-
|
|
391
|
-
return this.
|
|
859
|
+
getFundingRate(params) {
|
|
860
|
+
return this.get('/api/v5/public/funding-rate', params);
|
|
392
861
|
}
|
|
393
|
-
|
|
394
|
-
return this.
|
|
395
|
-
|
|
396
|
-
|
|
862
|
+
getFundingRateHistory(params) {
|
|
863
|
+
return this.get('/api/v5/public/funding-rate-history', params);
|
|
864
|
+
}
|
|
865
|
+
getMinMaxLimitPrice(params) {
|
|
866
|
+
return this.get('/api/v5/public/price-limit', params);
|
|
867
|
+
}
|
|
868
|
+
getOptionMarketData(params) {
|
|
869
|
+
return this.get('/api/v5/public/opt-summary', params);
|
|
870
|
+
}
|
|
871
|
+
getEstimatedDeliveryExercisePrice(params) {
|
|
872
|
+
return this.get('/api/v5/public/estimated-price', params);
|
|
873
|
+
}
|
|
874
|
+
getDiscountRateAndInterestFreeQuota(params) {
|
|
875
|
+
return this.get('/api/v5/public/discount-rate-interest-free-quota', params);
|
|
876
|
+
}
|
|
877
|
+
getSystemTime(params) {
|
|
878
|
+
return this.get('/api/v5/public/time', params);
|
|
879
|
+
}
|
|
880
|
+
getMarkPrice(params) {
|
|
881
|
+
return this.get('/api/v5/public/mark-price', params);
|
|
882
|
+
}
|
|
883
|
+
getPositionTiers(params) {
|
|
884
|
+
return this.get('/api/v5/public/position-tiers', params);
|
|
885
|
+
}
|
|
886
|
+
getInterestRateAndLoanQuota(params) {
|
|
887
|
+
return this.get('/api/v5/public/interest-rate-loan-quota', params);
|
|
888
|
+
}
|
|
889
|
+
getVIPInterestRateAndLoanQuota(params) {
|
|
890
|
+
return this.get('/api/v5/public/vip-interest-rate-loan-quota', params);
|
|
891
|
+
}
|
|
892
|
+
getUnderlying(params) {
|
|
893
|
+
return this.get('/api/v5/public/underlying', params);
|
|
894
|
+
}
|
|
895
|
+
getInsuranceFund(params) {
|
|
896
|
+
return this.get('/api/v5/public/insurance-fund', params);
|
|
897
|
+
}
|
|
898
|
+
getUnitConvert(params) {
|
|
899
|
+
return this.get('/api/v5/public/convert-contract-coin', params);
|
|
900
|
+
}
|
|
901
|
+
getOptionTickBands(params) {
|
|
902
|
+
return this.get('/api/v5/public/instrument-tick-bands', params);
|
|
903
|
+
}
|
|
904
|
+
getPremiumHistory(params) {
|
|
905
|
+
return this.get('/api/v5/public/premium-history', params);
|
|
906
|
+
}
|
|
907
|
+
getIndexTickers(params) {
|
|
908
|
+
return this.get('/api/v5/market/index-tickers', Object.assign({}, params));
|
|
909
|
+
}
|
|
910
|
+
/**
|
|
911
|
+
* @deprecated this method's parameters will change to an object in the next release. Use getIndexCandlesV2 instead.
|
|
912
|
+
*
|
|
913
|
+
* @param instId
|
|
914
|
+
* @param bar
|
|
915
|
+
* @param pagination
|
|
916
|
+
* @returns
|
|
917
|
+
*/
|
|
918
|
+
getIndexCandles(instId, bar = '1m', pagination) {
|
|
919
|
+
return this.get('/api/v5/market/index-candles', Object.assign({ instId,
|
|
920
|
+
bar }, pagination));
|
|
921
|
+
}
|
|
922
|
+
getIndexCandlesV2(params) {
|
|
923
|
+
return this.get('/api/v5/market/index-candles', params);
|
|
924
|
+
}
|
|
925
|
+
/**
|
|
926
|
+
* @deprecated this method's parameters will change to an object in the next release. Use getHistoricIndexCandlesV2 instead.
|
|
927
|
+
*
|
|
928
|
+
* @param instId
|
|
929
|
+
* @param bar
|
|
930
|
+
* @param pagination
|
|
931
|
+
* @returns
|
|
932
|
+
*/
|
|
933
|
+
getHistoricIndexCandles(instId, bar = '1m', pagination) {
|
|
934
|
+
return this.get('/api/v5/market/history-index-candles', Object.assign({ instId,
|
|
935
|
+
bar }, pagination));
|
|
936
|
+
}
|
|
937
|
+
getHistoricIndexCandlesV2(params) {
|
|
938
|
+
return this.get('/api/v5/market/history-index-candles', params);
|
|
939
|
+
}
|
|
940
|
+
/**
|
|
941
|
+
* @deprecated this method's parameters will change to an object in the next release. Use getMarkPriceCandlesV2 instead.
|
|
942
|
+
*
|
|
943
|
+
* @param instId
|
|
944
|
+
* @param bar
|
|
945
|
+
* @param pagination
|
|
946
|
+
* @returns
|
|
947
|
+
*/
|
|
948
|
+
getMarkPriceCandles(instId, bar = '1m', pagination) {
|
|
949
|
+
return this.get('/api/v5/market/mark-price-candles', Object.assign({ instId,
|
|
950
|
+
bar }, pagination));
|
|
951
|
+
}
|
|
952
|
+
getMarkPriceCandlesV2(params) {
|
|
953
|
+
return this.get('/api/v5/market/mark-price-candles', params);
|
|
954
|
+
}
|
|
955
|
+
/**
|
|
956
|
+
* @deprecated this method's parameters will change to an object in the next release. Use getHistoricMarkPriceCandlesV2 instead.
|
|
957
|
+
*
|
|
958
|
+
* @param instId
|
|
959
|
+
* @param bar
|
|
960
|
+
* @param pagination
|
|
961
|
+
* @returns
|
|
962
|
+
*/
|
|
963
|
+
getHistoricMarkPriceCandles(instId, bar = '1m', pagination) {
|
|
964
|
+
return this.get('/api/v5/market/historic-mark-price-candles', Object.assign({ instId,
|
|
965
|
+
bar }, pagination));
|
|
966
|
+
}
|
|
967
|
+
getHistoricMarkPriceCandlesV2(params) {
|
|
968
|
+
return this.get('/api/v5/market/history-mark-price-candles', params);
|
|
969
|
+
}
|
|
970
|
+
getOracle() {
|
|
971
|
+
return this.get('/api/v5/market/open-oracle');
|
|
972
|
+
}
|
|
973
|
+
getExchangeRate() {
|
|
974
|
+
return this.get('/api/v5/market/exchange-rate');
|
|
975
|
+
}
|
|
976
|
+
getIndexComponents(index) {
|
|
977
|
+
return this.get('/api/v5/market/index-components', { index });
|
|
978
|
+
}
|
|
979
|
+
getEconomicCalendar(params) {
|
|
980
|
+
return this.getPrivate('/api/v5/public/economic-calendar', params);
|
|
981
|
+
}
|
|
982
|
+
/**
|
|
983
|
+
* @deprecated
|
|
984
|
+
*/
|
|
985
|
+
getPublicBlockTrades(instId) {
|
|
986
|
+
return this.get('/api/v5/market/block-trades', { instId });
|
|
987
|
+
}
|
|
988
|
+
/**
|
|
989
|
+
* @deprecated
|
|
990
|
+
*/
|
|
991
|
+
getLiquidationOrders(params) {
|
|
992
|
+
return this.get('/api/v5/public/liquidation-orders', params);
|
|
993
|
+
}
|
|
994
|
+
/**
|
|
995
|
+
*
|
|
996
|
+
* Trading statistics - REST endpoints
|
|
997
|
+
*
|
|
998
|
+
*/
|
|
999
|
+
getSupportCoin() {
|
|
1000
|
+
return this.get('/api/v5/rubik/stat/trading-data/support-coin');
|
|
1001
|
+
}
|
|
1002
|
+
getOpenInterestHistory(params) {
|
|
1003
|
+
return this.get('/api/v5/rubik/stat/contracts/open-interest-history', params);
|
|
1004
|
+
}
|
|
1005
|
+
getTakerVolume(params) {
|
|
1006
|
+
return this.get('/api/v5/rubik/stat/taker-volume', params);
|
|
1007
|
+
}
|
|
1008
|
+
getContractTakerVolume(params) {
|
|
1009
|
+
return this.get('/api/v5/rubik/stat/taker-volume-contract', params);
|
|
1010
|
+
}
|
|
1011
|
+
getMarginLendingRatio(params) {
|
|
1012
|
+
return this.get('/api/v5/rubik/stat/margin/loan-ratio', params);
|
|
1013
|
+
}
|
|
1014
|
+
getTopTradersAccountRatio(params) {
|
|
1015
|
+
return this.get('/api/v5/rubik/stat/contracts/long-short-account-ratio-contract-top-trader', params);
|
|
1016
|
+
}
|
|
1017
|
+
getTopTradersContractPositionRatio(params) {
|
|
1018
|
+
return this.get('/api/v5/rubik/stat/contracts/long-short-position-ratio-contract-top-trader', params);
|
|
1019
|
+
}
|
|
1020
|
+
getLongShortContractRatio(params) {
|
|
1021
|
+
return this.get('/api/v5/rubik/stat/contracts/long-short-account-ratio-contract', params);
|
|
1022
|
+
}
|
|
1023
|
+
getLongShortRatio(params) {
|
|
1024
|
+
return this.get('/api/v5/rubik/stat/contracts/long-short-account-ratio', params);
|
|
1025
|
+
}
|
|
1026
|
+
getContractsOpenInterestAndVolume(params) {
|
|
1027
|
+
return this.get('/api/v5/rubik/stat/contracts/open-interest-volume', params);
|
|
1028
|
+
}
|
|
1029
|
+
getOptionsOpenInterestAndVolume(params) {
|
|
1030
|
+
return this.get('/api/v5/rubik/stat/option/open-interest-volume', params);
|
|
1031
|
+
}
|
|
1032
|
+
getPutCallRatio(params) {
|
|
1033
|
+
return this.get('/api/v5/rubik/stat/option/open-interest-volume-ratio', params);
|
|
1034
|
+
}
|
|
1035
|
+
getOpenInterestAndVolumeExpiry(params) {
|
|
1036
|
+
return this.get('/api/v5/rubik/stat/option/open-interest-volume-expiry', params);
|
|
1037
|
+
}
|
|
1038
|
+
getOpenInterestAndVolumeStrike(params) {
|
|
1039
|
+
return this.get('/api/v5/rubik/stat/option/open-interest-volume-strike', params);
|
|
1040
|
+
}
|
|
1041
|
+
getTakerFlow(params) {
|
|
1042
|
+
return this.get('/api/v5/rubik/stat/option/taker-block-volume', params);
|
|
1043
|
+
}
|
|
1044
|
+
/**
|
|
1045
|
+
*
|
|
1046
|
+
* Funding account - REST endpoints
|
|
1047
|
+
*
|
|
1048
|
+
*/
|
|
1049
|
+
getCurrencies(ccy) {
|
|
1050
|
+
return this.getPrivate('/api/v5/asset/currencies', { ccy });
|
|
1051
|
+
}
|
|
1052
|
+
getBalances(ccy) {
|
|
1053
|
+
return this.getPrivate('/api/v5/asset/balances', { ccy });
|
|
1054
|
+
}
|
|
1055
|
+
getNonTradableAssets(params) {
|
|
1056
|
+
return this.getPrivate('/api/v5/asset/non-tradable-assets', params);
|
|
1057
|
+
}
|
|
1058
|
+
getAccountAssetValuation(ccy) {
|
|
1059
|
+
return this.getPrivate('/api/v5/asset/asset-valuation', { ccy });
|
|
1060
|
+
}
|
|
1061
|
+
fundsTransfer(params) {
|
|
1062
|
+
return this.postPrivate('/api/v5/asset/transfer', params);
|
|
1063
|
+
}
|
|
1064
|
+
/** Either parameter transId or clientId is required. */
|
|
1065
|
+
getFundsTransferState(params) {
|
|
1066
|
+
return this.getPrivate('/api/v5/asset/transfer-state', params);
|
|
1067
|
+
}
|
|
1068
|
+
getAssetBillsDetails(params) {
|
|
1069
|
+
return this.getPrivate('/api/v5/asset/bills', params);
|
|
1070
|
+
}
|
|
1071
|
+
getLightningDeposits(ccy, amt, to) {
|
|
1072
|
+
return this.getPrivate('/api/v5/asset/deposit-lightning', { ccy, amt, to });
|
|
1073
|
+
}
|
|
1074
|
+
getDepositAddress(ccy) {
|
|
1075
|
+
return this.getPrivate('/api/v5/asset/deposit-address', { ccy });
|
|
1076
|
+
}
|
|
1077
|
+
getDepositHistory(params) {
|
|
1078
|
+
return this.getPrivate('/api/v5/asset/deposit-history', params);
|
|
1079
|
+
}
|
|
1080
|
+
submitWithdraw(params) {
|
|
1081
|
+
return this.postPrivate('/api/v5/asset/withdrawal', params);
|
|
1082
|
+
}
|
|
1083
|
+
submitWithdrawLightning(ccy, invoice, memo) {
|
|
1084
|
+
return this.postPrivate('/api/v5/asset/withdrawal-lightning', {
|
|
1085
|
+
ccy,
|
|
1086
|
+
invoice,
|
|
1087
|
+
memo,
|
|
397
1088
|
});
|
|
398
1089
|
}
|
|
399
|
-
|
|
400
|
-
return this.
|
|
1090
|
+
cancelWithdrawal(wdId) {
|
|
1091
|
+
return this.postPrivate('/api/v5/asset/cancel-withdrawal', { wdId });
|
|
401
1092
|
}
|
|
402
|
-
|
|
403
|
-
return this.getPrivate('/api/v5/
|
|
1093
|
+
getWithdrawalHistory(params) {
|
|
1094
|
+
return this.getPrivate('/api/v5/asset/withdrawal-history', params);
|
|
1095
|
+
}
|
|
1096
|
+
getDepositWithdrawStatus(params) {
|
|
1097
|
+
return this.getPrivate('/api/v5/asset/deposit-withdraw-status', params);
|
|
1098
|
+
}
|
|
1099
|
+
smallAssetsConvert(ccy) {
|
|
1100
|
+
return this.postPrivate('/api/v5/asset/convert-dust-assets', { ccy });
|
|
1101
|
+
}
|
|
1102
|
+
getExchanges() {
|
|
1103
|
+
return this.get('/api/v5/asset/exchange-list');
|
|
1104
|
+
}
|
|
1105
|
+
applyForMonthlyStatement(params) {
|
|
1106
|
+
return this.postPrivate('/api/v5/asset/monthly-statement', params);
|
|
1107
|
+
}
|
|
1108
|
+
getMonthlyStatement(params) {
|
|
1109
|
+
return this.getPrivate('/api/v5/asset/monthly-statement', params);
|
|
404
1110
|
}
|
|
405
|
-
|
|
406
|
-
return this.
|
|
407
|
-
ccy,
|
|
408
|
-
side,
|
|
409
|
-
amt,
|
|
410
|
-
ordId,
|
|
411
|
-
});
|
|
1111
|
+
getConvertCurrencies() {
|
|
1112
|
+
return this.getPrivate('/api/v5/asset/convert/currencies');
|
|
412
1113
|
}
|
|
413
|
-
|
|
414
|
-
return this.getPrivate('/api/v5/
|
|
1114
|
+
getConvertCurrencyPair(fromCcy, toCcy) {
|
|
1115
|
+
return this.getPrivate('/api/v5/asset/convert/currency-pair', {
|
|
1116
|
+
fromCcy,
|
|
1117
|
+
toCcy,
|
|
1118
|
+
});
|
|
415
1119
|
}
|
|
416
|
-
|
|
417
|
-
return this.
|
|
1120
|
+
estimateConvertQuote(params) {
|
|
1121
|
+
return this.postPrivate('/api/v5/asset/convert/estimate-quote', params);
|
|
418
1122
|
}
|
|
419
|
-
|
|
420
|
-
return this.
|
|
1123
|
+
convertTrade(params) {
|
|
1124
|
+
return this.postPrivate('/api/v5/asset/convert/trade', params);
|
|
421
1125
|
}
|
|
422
|
-
|
|
423
|
-
return this.getPrivate('/api/v5/
|
|
1126
|
+
getConvertHistory(params) {
|
|
1127
|
+
return this.getPrivate('/api/v5/asset/convert/history', params);
|
|
424
1128
|
}
|
|
425
1129
|
/**
|
|
426
1130
|
*
|
|
427
|
-
*
|
|
1131
|
+
* Subaccount - REST endpoints
|
|
428
1132
|
*
|
|
429
1133
|
*/
|
|
430
1134
|
/** View sub-account list */
|
|
@@ -447,10 +1151,16 @@ class RestClient extends BaseRestClient_1.default {
|
|
|
447
1151
|
ccy,
|
|
448
1152
|
});
|
|
449
1153
|
}
|
|
1154
|
+
getSubAccountMaxWithdrawal(params) {
|
|
1155
|
+
return this.getPrivate('/api/v5/account/subaccount/max-withdrawal', params);
|
|
1156
|
+
}
|
|
450
1157
|
/** History of sub-account transfer */
|
|
451
1158
|
getSubAccountTransferHistory(params) {
|
|
452
1159
|
return this.getPrivate('/api/v5/asset/subaccount/bills', params);
|
|
453
1160
|
}
|
|
1161
|
+
getManagedSubAccountTransferHistory(params) {
|
|
1162
|
+
return this.getPrivate('/api/v5/asset/subaccount/managed-subaccount-bills', params);
|
|
1163
|
+
}
|
|
454
1164
|
/** Master accounts manage the transfers between sub-accounts */
|
|
455
1165
|
transferSubAccountBalance(params) {
|
|
456
1166
|
return this.postPrivate('/api/v5/asset/subaccount/transfer', params);
|
|
@@ -468,73 +1178,15 @@ class RestClient extends BaseRestClient_1.default {
|
|
|
468
1178
|
subAcct,
|
|
469
1179
|
});
|
|
470
1180
|
}
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
* Grid trading endpoints (private)
|
|
474
|
-
*
|
|
475
|
-
*/
|
|
476
|
-
placeGridAlgoOrder(params) {
|
|
477
|
-
return this.postPrivate('/api/v5/tradingBot/grid/order-algo', params);
|
|
478
|
-
}
|
|
479
|
-
amendGridAlgoOrder(algoId, instId, triggerPx) {
|
|
480
|
-
return this.postPrivate('/api/v5/tradingBot/grid/amend-order-algo', Object.assign({ algoId,
|
|
481
|
-
instId }, triggerPx));
|
|
482
|
-
}
|
|
483
|
-
stopGridAlgoOrder(orders) {
|
|
484
|
-
return this.postPrivate('/api/v5/tradingBot/grid/stop-order-algo', orders);
|
|
485
|
-
}
|
|
486
|
-
getGridAlgoOrderList(params) {
|
|
487
|
-
return this.getPrivate('/api/v5/tradingBot/grid/orders-algo-pending', params);
|
|
488
|
-
}
|
|
489
|
-
getGridAlgoOrderHistory(params) {
|
|
490
|
-
return this.getPrivate('/api/v5/tradingBot/grid/orders-algo-history', params);
|
|
491
|
-
}
|
|
492
|
-
getGridAlgoOrderDetails(algoOrdType, algoId) {
|
|
493
|
-
return this.getPrivate('/api/v5/tradingBot/grid/orders-algo-details', {
|
|
494
|
-
algoOrdType,
|
|
495
|
-
algoId,
|
|
496
|
-
});
|
|
497
|
-
}
|
|
498
|
-
getGridAlgoSubOrders(algoOrdType, algoId, type, groupId, pagination) {
|
|
499
|
-
return this.getPrivate('/api/v5/tradingBot/grid/sub-orders', Object.assign({ algoOrdType,
|
|
500
|
-
algoId,
|
|
501
|
-
type,
|
|
502
|
-
groupId }, pagination));
|
|
503
|
-
}
|
|
504
|
-
/** Only contract grid supports this method */
|
|
505
|
-
getGridAlgoOrderPositions(algoOrdType, algoId) {
|
|
506
|
-
return this.getPrivate('/api/v5/tradingBot/grid/positions', {
|
|
507
|
-
algoOrdType,
|
|
508
|
-
algoId,
|
|
509
|
-
});
|
|
510
|
-
}
|
|
511
|
-
spotGridWithdrawIncome(algoId) {
|
|
512
|
-
return this.postPrivate('/api/v5/tradingBot/grid/withdraw-income', {
|
|
513
|
-
algoId,
|
|
514
|
-
});
|
|
515
|
-
}
|
|
516
|
-
computeGridMarginBalance(algoId, type, amt) {
|
|
517
|
-
return this.postPrivate('/api/v5/tradingBot/grid/compute-margin-balance', {
|
|
518
|
-
algoId,
|
|
519
|
-
type,
|
|
520
|
-
amt,
|
|
521
|
-
});
|
|
522
|
-
}
|
|
523
|
-
adjustGridMarginBalance(algoId, type, change) {
|
|
524
|
-
return this.postPrivate('/api/v5/tradingBot/grid/margin-balance', Object.assign({ algoId,
|
|
525
|
-
type }, change));
|
|
1181
|
+
setSubAccountLoanAllocation(params) {
|
|
1182
|
+
return this.postPrivate('/api/v5/account/subaccount/set-loan-allocation', params);
|
|
526
1183
|
}
|
|
527
|
-
|
|
528
|
-
return this.
|
|
529
|
-
algoOrdType,
|
|
530
|
-
instId,
|
|
531
|
-
direction,
|
|
532
|
-
duration,
|
|
533
|
-
});
|
|
1184
|
+
getSubAccountBorrowInterestAndLimit(params) {
|
|
1185
|
+
return this.getPrivate('/api/v5/account/subaccount/interest-limits', params);
|
|
534
1186
|
}
|
|
535
1187
|
/**
|
|
536
1188
|
*
|
|
537
|
-
*
|
|
1189
|
+
* Financial product - on chain earn endpoints
|
|
538
1190
|
*
|
|
539
1191
|
*/
|
|
540
1192
|
/** Get earn offers */
|
|
@@ -574,178 +1226,91 @@ class RestClient extends BaseRestClient_1.default {
|
|
|
574
1226
|
}
|
|
575
1227
|
/**
|
|
576
1228
|
*
|
|
577
|
-
*
|
|
1229
|
+
* Financial product - ETH staking endpoints
|
|
578
1230
|
*
|
|
579
1231
|
*/
|
|
580
|
-
|
|
581
|
-
return this.
|
|
582
|
-
instType: instrumentType,
|
|
583
|
-
uly,
|
|
584
|
-
});
|
|
585
|
-
}
|
|
586
|
-
getTicker(instId) {
|
|
587
|
-
return this.get('/api/v5/market/ticker', {
|
|
588
|
-
instId,
|
|
589
|
-
});
|
|
590
|
-
}
|
|
591
|
-
getIndexTickers(params) {
|
|
592
|
-
return this.get('/api/v5/market/index-tickers', Object.assign({}, params));
|
|
593
|
-
}
|
|
594
|
-
getOrderBook(instId, sz) {
|
|
595
|
-
return this.get('/api/v5/market/books', { instId, sz });
|
|
596
|
-
}
|
|
597
|
-
getCandles(instId, bar = '1m', pagination) {
|
|
598
|
-
return this.get('/api/v5/market/candles', Object.assign({ instId,
|
|
599
|
-
bar }, pagination));
|
|
600
|
-
}
|
|
601
|
-
getHistoricCandles(instId, bar = '1m', pagination) {
|
|
602
|
-
return this.get('/api/v5/market/history-candles', Object.assign({ instId,
|
|
603
|
-
bar }, pagination));
|
|
604
|
-
}
|
|
605
|
-
getIndexCandles(instId, bar = '1m', pagination) {
|
|
606
|
-
return this.get('/api/v5/market/index-candles', Object.assign({ instId,
|
|
607
|
-
bar }, pagination));
|
|
608
|
-
}
|
|
609
|
-
getHistoricIndexCandles(instId, bar = '1m', pagination) {
|
|
610
|
-
return this.get('/api/v5/market/history-index-candles', Object.assign({ instId,
|
|
611
|
-
bar }, pagination));
|
|
612
|
-
}
|
|
613
|
-
getMarkPriceCandles(instId, bar = '1m', pagination) {
|
|
614
|
-
return this.get('/api/v5/market/mark-price-candles', Object.assign({ instId,
|
|
615
|
-
bar }, pagination));
|
|
616
|
-
}
|
|
617
|
-
getHistoricMarkPriceCandles(instId, bar = '1m', pagination) {
|
|
618
|
-
return this.get('/api/v5/market/historic-mark-price-candles', Object.assign({ instId,
|
|
619
|
-
bar }, pagination));
|
|
620
|
-
}
|
|
621
|
-
getTrades(instId, limit) {
|
|
622
|
-
return this.get('/api/v5/market/trades', { instId, limit });
|
|
623
|
-
}
|
|
624
|
-
getHistoricTrades(instId, pagination) {
|
|
625
|
-
return this.get('/api/v5/market/history-trades', Object.assign({ instId }, pagination));
|
|
626
|
-
}
|
|
627
|
-
get24hrTotalVolume() {
|
|
628
|
-
return this.get('/api/v5/market/platform-24-volume');
|
|
629
|
-
}
|
|
630
|
-
getOracle() {
|
|
631
|
-
return this.get('/api/v5/market/open-oracle');
|
|
632
|
-
}
|
|
633
|
-
getExchangeRate() {
|
|
634
|
-
return this.get('/api/v5/market/exchange-rate');
|
|
1232
|
+
purchaseETHStaking(params) {
|
|
1233
|
+
return this.postPrivate('/api/v5/finance/staking-defi/eth/purchase', params);
|
|
635
1234
|
}
|
|
636
|
-
|
|
637
|
-
return this.
|
|
1235
|
+
redeemETHStaking(params) {
|
|
1236
|
+
return this.postPrivate('/api/v5/finance/staking-defi/eth/redeem', params);
|
|
638
1237
|
}
|
|
639
|
-
|
|
640
|
-
return this.
|
|
1238
|
+
getETHStakingBalance() {
|
|
1239
|
+
return this.getPrivate('/api/v5/finance/staking-defi/eth/balance');
|
|
641
1240
|
}
|
|
642
|
-
|
|
643
|
-
return this.
|
|
1241
|
+
getETHStakingHistory(params) {
|
|
1242
|
+
return this.getPrivate('/api/v5/finance/staking-defi/eth/purchase-redeem-history', params);
|
|
644
1243
|
}
|
|
645
|
-
|
|
646
|
-
return this.get('/api/v5/
|
|
1244
|
+
getAPYHistory(params) {
|
|
1245
|
+
return this.get('/api/v5/finance/staking-defi/eth/apy-history', params);
|
|
647
1246
|
}
|
|
648
1247
|
/**
|
|
649
1248
|
*
|
|
650
|
-
*
|
|
1249
|
+
* Financial product - simple earn flexible endpoints
|
|
651
1250
|
*
|
|
652
1251
|
*/
|
|
653
|
-
|
|
654
|
-
return this.
|
|
655
|
-
instType,
|
|
656
|
-
uly,
|
|
657
|
-
instFamily,
|
|
658
|
-
instId,
|
|
659
|
-
});
|
|
660
|
-
}
|
|
661
|
-
getDeliveryExerciseHistory(params) {
|
|
662
|
-
return this.get('/api/v5/public/delivery-exercise-history', params);
|
|
663
|
-
}
|
|
664
|
-
getOpenInterest(params) {
|
|
665
|
-
return this.get('/api/v5/public/open-interest', params);
|
|
666
|
-
}
|
|
667
|
-
getFundingRate(params) {
|
|
668
|
-
return this.get('/api/v5/public/funding-rate', params);
|
|
669
|
-
}
|
|
670
|
-
getFundingRateHistory(params) {
|
|
671
|
-
return this.get('/api/v5/public/funding-rate-history', params);
|
|
672
|
-
}
|
|
673
|
-
getMinMaxLimitPrice(params) {
|
|
674
|
-
return this.get('/api/v5/public/price-limit', params);
|
|
675
|
-
}
|
|
676
|
-
getOptionMarketData(params) {
|
|
677
|
-
return this.get('/api/v5/public/opt-summary', params);
|
|
678
|
-
}
|
|
679
|
-
getEstimatedDeliveryExercisePrice(params) {
|
|
680
|
-
return this.get('/api/v5/public/estimated-price', params);
|
|
681
|
-
}
|
|
682
|
-
getDiscountRateAndInterestFreeQuota(params) {
|
|
683
|
-
return this.get('/api/v5/public/discount-rate-interest-free-quota', params);
|
|
684
|
-
}
|
|
685
|
-
getSystemTime(params) {
|
|
686
|
-
return this.get('/api/v5/public/time', params);
|
|
687
|
-
}
|
|
688
|
-
getLiquidationOrders(params) {
|
|
689
|
-
return this.get('/api/v5/public/liquidation-orders', params);
|
|
690
|
-
}
|
|
691
|
-
getMarkPrice(params) {
|
|
692
|
-
return this.get('/api/v5/public/mark-price', params);
|
|
693
|
-
}
|
|
694
|
-
getPositionTiers(params) {
|
|
695
|
-
return this.get('/api/v5/public/position-tiers', params);
|
|
696
|
-
}
|
|
697
|
-
getInterestRateAndLoanQuota(params) {
|
|
698
|
-
return this.get('/api/v5/public/interest-rate-loan-quota', params);
|
|
1252
|
+
getSavingBalance(ccy) {
|
|
1253
|
+
return this.getPrivate('/api/v5/finance/savings/balance', { ccy });
|
|
699
1254
|
}
|
|
700
|
-
|
|
701
|
-
return this.
|
|
1255
|
+
savingsPurchaseRedemption(ccy, amt, side, rate) {
|
|
1256
|
+
return this.postPrivate('/api/v5/finance/savings/purchase-redempt', {
|
|
1257
|
+
ccy,
|
|
1258
|
+
amt,
|
|
1259
|
+
side,
|
|
1260
|
+
rate,
|
|
1261
|
+
});
|
|
702
1262
|
}
|
|
703
|
-
|
|
704
|
-
return this.
|
|
1263
|
+
setLendingRate(ccy, rate) {
|
|
1264
|
+
return this.postPrivate('/api/v5/finance/savings/set-lending-rate', {
|
|
1265
|
+
ccy,
|
|
1266
|
+
rate,
|
|
1267
|
+
});
|
|
705
1268
|
}
|
|
706
|
-
|
|
707
|
-
return this.
|
|
1269
|
+
getLendingHistory(params) {
|
|
1270
|
+
return this.getPrivate('/api/v5/finance/savings/lending-history', params);
|
|
708
1271
|
}
|
|
709
|
-
|
|
710
|
-
return this.get('/api/v5/
|
|
1272
|
+
getPublicBorrowInfo(ccy) {
|
|
1273
|
+
return this.get('/api/v5/finance/savings/lending-rate-summary', { ccy });
|
|
711
1274
|
}
|
|
712
|
-
|
|
713
|
-
return this.
|
|
1275
|
+
getPublicBorrowHistory(params) {
|
|
1276
|
+
return this.get('/api/v5/finance/savings/lending-rate-history', params);
|
|
714
1277
|
}
|
|
715
1278
|
/**
|
|
716
1279
|
*
|
|
717
|
-
*
|
|
1280
|
+
* Financial product - simple earn fixed endpoints
|
|
718
1281
|
*
|
|
719
1282
|
*/
|
|
720
|
-
|
|
721
|
-
return this.get('/api/v5/
|
|
1283
|
+
getLendingOffers(params) {
|
|
1284
|
+
return this.get('/api/v5/finance/fixed-loan/lending-offers', params);
|
|
722
1285
|
}
|
|
723
|
-
|
|
724
|
-
return this.get('/api/v5/
|
|
1286
|
+
getLendingAPYHistory(params) {
|
|
1287
|
+
return this.get('/api/v5/finance/fixed-loan/lending-apy-history', params);
|
|
725
1288
|
}
|
|
726
|
-
|
|
727
|
-
return this.get('/api/v5/
|
|
728
|
-
}
|
|
729
|
-
getLongShortRatio(params) {
|
|
730
|
-
return this.get('/api/v5/rubik/stat/contracts/long-short-account-ratio', params);
|
|
1289
|
+
getLendingVolume(params) {
|
|
1290
|
+
return this.get('/api/v5/finance/fixed-loan/pending-lending-volume', params);
|
|
731
1291
|
}
|
|
732
|
-
|
|
733
|
-
return this.
|
|
1292
|
+
placeLendingOrder(params) {
|
|
1293
|
+
return this.postPrivate('/api/v5/finance/fixed-loan/lending-order', params);
|
|
734
1294
|
}
|
|
735
|
-
|
|
736
|
-
return this.
|
|
1295
|
+
amendLendingOrder(params) {
|
|
1296
|
+
return this.postPrivate('/api/v5/finance/fixed-loan/lending-order', params);
|
|
737
1297
|
}
|
|
738
|
-
|
|
739
|
-
return this.
|
|
1298
|
+
getLendingOrders(params) {
|
|
1299
|
+
return this.getPrivate('/api/v5/finance/fixed-loan/lending-orders-list', params);
|
|
740
1300
|
}
|
|
741
|
-
|
|
742
|
-
return this.
|
|
1301
|
+
getLendingSubOrders(params) {
|
|
1302
|
+
return this.getPrivate('/api/v5/finance/fixed-loan/lending-sub-orders', params);
|
|
743
1303
|
}
|
|
744
|
-
|
|
745
|
-
|
|
1304
|
+
/**
|
|
1305
|
+
*
|
|
1306
|
+
* Affiliate endpoints
|
|
1307
|
+
*
|
|
1308
|
+
*/
|
|
1309
|
+
getInviteeDetail(params) {
|
|
1310
|
+
return this.getPrivate('/api/v5/affiliate/invitee/detail', params);
|
|
746
1311
|
}
|
|
747
|
-
|
|
748
|
-
return this.
|
|
1312
|
+
getAffiliateRebateInfo(params) {
|
|
1313
|
+
return this.getPrivate('/api/v5/users/partner/if-rebate', params);
|
|
749
1314
|
}
|
|
750
1315
|
/**
|
|
751
1316
|
*
|
|
@@ -760,7 +1325,10 @@ class RestClient extends BaseRestClient_1.default {
|
|
|
760
1325
|
* Broker endpoints (private)
|
|
761
1326
|
*
|
|
762
1327
|
*/
|
|
763
|
-
|
|
1328
|
+
/**
|
|
1329
|
+
*
|
|
1330
|
+
* @deprecated
|
|
1331
|
+
*/
|
|
764
1332
|
getBrokerAccountInformation() {
|
|
765
1333
|
return this.getPrivate('/api/v5/broker/nd/info');
|
|
766
1334
|
}
|