ccxt 4.2.4 → 4.2.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 +4 -4
- package/dist/ccxt.browser.js +161 -31
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/alpaca.js +7 -1
- package/dist/cjs/src/bingx.js +17 -18
- package/dist/cjs/src/bybit.js +2 -0
- package/dist/cjs/src/delta.js +2 -2
- package/dist/cjs/src/htx.js +131 -9
- package/dist/cjs/src/phemex.js +2 -1
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bybit.d.ts +2 -0
- package/js/src/alpaca.js +7 -1
- package/js/src/binance.d.ts +1 -1
- package/js/src/bingx.d.ts +1 -1
- package/js/src/bingx.js +17 -18
- package/js/src/bybit.js +2 -0
- package/js/src/delta.js +2 -2
- package/js/src/htx.js +131 -9
- package/js/src/phemex.js +2 -1
- package/package.json +1 -1
- package/skip-tests.json +4 -1
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ Current feature list:
|
|
|
21
21
|
|
|
22
22
|
## Sponsored Promotion
|
|
23
23
|
|
|
24
|
-
[](https://x.woo.org/en/ccxt-competition-1)
|
|
25
25
|
|
|
26
26
|
## See Also
|
|
27
27
|
|
|
@@ -209,13 +209,13 @@ console.log(version, Object.keys(exchanges));
|
|
|
209
209
|
|
|
210
210
|
All-in-one browser bundle (dependencies included), served from a CDN of your choice:
|
|
211
211
|
|
|
212
|
-
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.2.
|
|
213
|
-
* unpkg: https://unpkg.com/ccxt@4.2.
|
|
212
|
+
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.2.5/dist/ccxt.browser.js
|
|
213
|
+
* unpkg: https://unpkg.com/ccxt@4.2.5/dist/ccxt.browser.js
|
|
214
214
|
|
|
215
215
|
CDNs are not updated in real-time and may have delays. Defaulting to the most recent version without specifying the version number is not recommended. Please, keep in mind that we are not responsible for the correct operation of those CDN servers.
|
|
216
216
|
|
|
217
217
|
```HTML
|
|
218
|
-
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.2.
|
|
218
|
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.2.5/dist/ccxt.browser.js"></script>
|
|
219
219
|
```
|
|
220
220
|
|
|
221
221
|
Creates a global `ccxt` object:
|
package/dist/ccxt.browser.js
CHANGED
|
@@ -2835,10 +2835,16 @@ class alpaca extends _abstract_alpaca_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
2835
2835
|
//
|
|
2836
2836
|
const marketId = this.safeString(asset, 'symbol');
|
|
2837
2837
|
const parts = marketId.split('/');
|
|
2838
|
+
const assetClass = this.safeString(asset, 'class');
|
|
2838
2839
|
const baseId = this.safeString(parts, 0);
|
|
2839
2840
|
const quoteId = this.safeString(parts, 1);
|
|
2840
2841
|
const base = this.safeCurrencyCode(baseId);
|
|
2841
|
-
|
|
2842
|
+
let quote = this.safeCurrencyCode(quoteId);
|
|
2843
|
+
// Us equity markets do not include quote in symbol.
|
|
2844
|
+
// We can safely coerce us_equity quote to USD
|
|
2845
|
+
if (quote === undefined && assetClass === 'us_equity') {
|
|
2846
|
+
quote = 'USD';
|
|
2847
|
+
}
|
|
2842
2848
|
const symbol = base + '/' + quote;
|
|
2843
2849
|
const status = this.safeString(asset, 'status');
|
|
2844
2850
|
const active = (status === 'active');
|
|
@@ -28389,18 +28395,11 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
28389
28395
|
const close = this.safeString(ticker, 'lastPrice');
|
|
28390
28396
|
const quoteVolume = this.safeString(ticker, 'quoteVolume');
|
|
28391
28397
|
const baseVolume = this.safeString(ticker, 'volume');
|
|
28392
|
-
let percentage =
|
|
28393
|
-
|
|
28394
|
-
|
|
28395
|
-
// right now only swap uses the 24h change, spot will be added soon
|
|
28396
|
-
percentage = this.safeString(ticker, 'priceChangePercent');
|
|
28397
|
-
change = this.safeString(ticker, 'priceChange');
|
|
28398
|
+
let percentage = this.safeString(ticker, 'priceChangePercent');
|
|
28399
|
+
if (percentage !== undefined) {
|
|
28400
|
+
percentage = percentage.replace('%', '');
|
|
28398
28401
|
}
|
|
28399
|
-
|
|
28400
|
-
// if (percentage !== undefined) {
|
|
28401
|
-
// percentage = percentage.replace ('%', '');
|
|
28402
|
-
// } similarly to change, it's not ccxt's percentage because it does priceChange/open, and priceChange is high-low
|
|
28403
|
-
// const change = this.safeString (ticker, 'priceChange'); // this is not ccxt's change because it does high-low instead of last-open
|
|
28402
|
+
const change = this.safeString(ticker, 'priceChange');
|
|
28404
28403
|
const ts = this.safeInteger(ticker, 'closeTime');
|
|
28405
28404
|
const datetime = this.iso8601(ts);
|
|
28406
28405
|
const bid = this.safeString(ticker, 'bidPrice');
|
|
@@ -28729,6 +28728,11 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
28729
28728
|
};
|
|
28730
28729
|
const isMarketOrder = type === 'MARKET';
|
|
28731
28730
|
const isSpot = marketType === 'spot';
|
|
28731
|
+
const exchangeClientOrderId = isSpot ? 'newClientOrderId' : 'clientOrderID';
|
|
28732
|
+
const clientOrderId = this.safeString2(params, exchangeClientOrderId, 'clientOrderId');
|
|
28733
|
+
if (clientOrderId !== undefined) {
|
|
28734
|
+
request[exchangeClientOrderId] = clientOrderId;
|
|
28735
|
+
}
|
|
28732
28736
|
const timeInForce = this.safeStringUpper(params, 'timeInForce');
|
|
28733
28737
|
if (timeInForce === 'IOC') {
|
|
28734
28738
|
request['timeInForce'] = 'IOC';
|
|
@@ -28873,7 +28877,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
28873
28877
|
}
|
|
28874
28878
|
request['positionSide'] = positionSide;
|
|
28875
28879
|
request['quantity'] = this.parseToNumeric(this.amountToPrecision(symbol, amount));
|
|
28876
|
-
params = this.omit(params, ['reduceOnly', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice', 'trailingAmount', 'trailingPercent', 'takeProfit', 'stopLoss']);
|
|
28880
|
+
params = this.omit(params, ['reduceOnly', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice', 'trailingAmount', 'trailingPercent', 'takeProfit', 'stopLoss', 'clientOrderId']);
|
|
28877
28881
|
}
|
|
28878
28882
|
return this.extend(request, params);
|
|
28879
28883
|
}
|
|
@@ -28890,6 +28894,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
28890
28894
|
* @param {float} amount how much you want to trade in units of the base currency
|
|
28891
28895
|
* @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
28892
28896
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
28897
|
+
* @param {string} [params.clientOrderId] a unique id for the order
|
|
28893
28898
|
* @param {bool} [params.postOnly] true to place a post only order
|
|
28894
28899
|
* @param {string} [params.timeInForce] spot supports 'PO' and 'IOC', swap supports 'PO', 'GTC', 'IOC' and 'FOK'
|
|
28895
28900
|
* @param {bool} [params.reduceOnly] *swap only* true or false whether the order is reduce only
|
|
@@ -28954,7 +28959,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
28954
28959
|
// }
|
|
28955
28960
|
//
|
|
28956
28961
|
if (typeof response === 'string') {
|
|
28957
|
-
response =
|
|
28962
|
+
response = this.parseJson(response);
|
|
28958
28963
|
}
|
|
28959
28964
|
const data = this.safeValue(response, 'data', {});
|
|
28960
28965
|
const order = this.safeValue(data, 'order', data);
|
|
@@ -29215,7 +29220,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
29215
29220
|
'currency': feeCurrencyCode,
|
|
29216
29221
|
'cost': _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringAbs(feeCost),
|
|
29217
29222
|
};
|
|
29218
|
-
const clientOrderId = this.
|
|
29223
|
+
const clientOrderId = this.safeStringN(order, ['clientOrderID', 'origClientOrderId', 'c']);
|
|
29219
29224
|
let stopLoss = this.safeValue(order, 'stopLoss');
|
|
29220
29225
|
let stopLossPrice = undefined;
|
|
29221
29226
|
if (stopLoss !== undefined) {
|
|
@@ -29224,7 +29229,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
29224
29229
|
if ((stopLoss !== undefined) && (typeof stopLoss !== 'number')) {
|
|
29225
29230
|
// stopLoss: '{"stopPrice":50,"workingType":"MARK_PRICE","type":"STOP_MARKET","quantity":1}',
|
|
29226
29231
|
if (typeof stopLoss === 'string') {
|
|
29227
|
-
stopLoss =
|
|
29232
|
+
stopLoss = this.parseJson(stopLoss);
|
|
29228
29233
|
}
|
|
29229
29234
|
stopLossPrice = this.safeNumber(stopLoss, 'stopPrice');
|
|
29230
29235
|
}
|
|
@@ -29236,7 +29241,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
29236
29241
|
if ((takeProfit !== undefined) && (typeof takeProfit !== 'number')) {
|
|
29237
29242
|
// takeProfit: '{"stopPrice":150,"workingType":"MARK_PRICE","type":"TAKE_PROFIT_MARKET","quantity":1}',
|
|
29238
29243
|
if (typeof takeProfit === 'string') {
|
|
29239
|
-
takeProfit =
|
|
29244
|
+
takeProfit = this.parseJson(takeProfit);
|
|
29240
29245
|
}
|
|
29241
29246
|
takeProfitPrice = this.safeNumber(takeProfit, 'stopPrice');
|
|
29242
29247
|
}
|
|
@@ -29476,7 +29481,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
29476
29481
|
}
|
|
29477
29482
|
let response = undefined;
|
|
29478
29483
|
if (market['spot']) {
|
|
29479
|
-
const spotReqKey = areClientOrderIds ? '
|
|
29484
|
+
const spotReqKey = areClientOrderIds ? 'clientOrderIDs' : 'orderIds';
|
|
29480
29485
|
request[spotReqKey] = parsedIds.join(',');
|
|
29481
29486
|
response = await this.spotV1PrivatePostTradeCancelOrders(this.extend(request, params));
|
|
29482
29487
|
}
|
|
@@ -78053,6 +78058,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
78053
78058
|
'v5/position/list': 5,
|
|
78054
78059
|
'v5/execution/list': 5,
|
|
78055
78060
|
'v5/position/closed-pnl': 5,
|
|
78061
|
+
'v5/position/move-history': 5,
|
|
78056
78062
|
// pre-upgrade
|
|
78057
78063
|
'v5/pre-upgrade/order/history': 5,
|
|
78058
78064
|
'v5/pre-upgrade/execution/list': 5,
|
|
@@ -78217,6 +78223,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
78217
78223
|
'v5/position/trading-stop': 5,
|
|
78218
78224
|
'v5/position/set-auto-add-margin': 5,
|
|
78219
78225
|
'v5/position/add-margin': 5,
|
|
78226
|
+
'v5/position/move-positions': 5,
|
|
78220
78227
|
'v5/position/confirm-pending-mmr': 5,
|
|
78221
78228
|
// account
|
|
78222
78229
|
'v5/account/upgrade-to-uta': 5,
|
|
@@ -110952,14 +110959,14 @@ class delta extends _abstract_delta_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
110952
110959
|
const markets = this.markets_by_id[symbol];
|
|
110953
110960
|
return markets[0];
|
|
110954
110961
|
}
|
|
110955
|
-
else if ((symbol.
|
|
110962
|
+
else if ((symbol.endsWith('-C')) || (symbol.endsWith('-P')) || (symbol.startsWith('C-')) || (symbol.startsWith('P-'))) {
|
|
110956
110963
|
return this.createExpiredOptionMarket(symbol);
|
|
110957
110964
|
}
|
|
110958
110965
|
}
|
|
110959
110966
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadSymbol(this.id + ' does not have market symbol ' + symbol);
|
|
110960
110967
|
}
|
|
110961
110968
|
safeMarket(marketId = undefined, market = undefined, delimiter = undefined, marketType = undefined) {
|
|
110962
|
-
const isOption = (marketId !== undefined) && ((marketId.
|
|
110969
|
+
const isOption = (marketId !== undefined) && ((marketId.endsWith('-C')) || (marketId.endsWith('-P')) || (marketId.startsWith('C-')) || (marketId.startsWith('P-')));
|
|
110963
110970
|
if (isOption && !(marketId in this.markets_by_id)) {
|
|
110964
110971
|
// handle expired option contracts
|
|
110965
110972
|
return this.createExpiredOptionMarket(marketId);
|
|
@@ -142547,8 +142554,9 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
142547
142554
|
let response = undefined;
|
|
142548
142555
|
const stop = this.safeValue(params, 'stop');
|
|
142549
142556
|
const stopLossTakeProfit = this.safeValue(params, 'stopLossTakeProfit');
|
|
142550
|
-
|
|
142551
|
-
|
|
142557
|
+
const trailing = this.safeValue(params, 'trailing', false);
|
|
142558
|
+
params = this.omit(params, ['stop', 'stopLossTakeProfit', 'trailing']);
|
|
142559
|
+
if (stop || stopLossTakeProfit || trailing) {
|
|
142552
142560
|
if (limit !== undefined) {
|
|
142553
142561
|
request['page_size'] = limit;
|
|
142554
142562
|
}
|
|
@@ -142575,6 +142583,9 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
142575
142583
|
else if (stopLossTakeProfit) {
|
|
142576
142584
|
response = await this.contractPrivatePostLinearSwapApiV1SwapTpslHisorders(this.extend(request, params));
|
|
142577
142585
|
}
|
|
142586
|
+
else if (trailing) {
|
|
142587
|
+
response = await this.contractPrivatePostLinearSwapApiV1SwapTrackHisorders(this.extend(request, params));
|
|
142588
|
+
}
|
|
142578
142589
|
else {
|
|
142579
142590
|
response = await this.contractPrivatePostLinearSwapApiV3SwapHisorders(this.extend(request, params));
|
|
142580
142591
|
}
|
|
@@ -142586,6 +142597,9 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
142586
142597
|
else if (stopLossTakeProfit) {
|
|
142587
142598
|
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossTpslHisorders(this.extend(request, params));
|
|
142588
142599
|
}
|
|
142600
|
+
else if (trailing) {
|
|
142601
|
+
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossTrackHisorders(this.extend(request, params));
|
|
142602
|
+
}
|
|
142589
142603
|
else {
|
|
142590
142604
|
response = await this.contractPrivatePostLinearSwapApiV3SwapCrossHisorders(this.extend(request, params));
|
|
142591
142605
|
}
|
|
@@ -142599,6 +142613,9 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
142599
142613
|
else if (stopLossTakeProfit) {
|
|
142600
142614
|
response = await this.contractPrivatePostSwapApiV1SwapTpslHisorders(this.extend(request, params));
|
|
142601
142615
|
}
|
|
142616
|
+
else if (trailing) {
|
|
142617
|
+
response = await this.contractPrivatePostSwapApiV1SwapTrackHisorders(this.extend(request, params));
|
|
142618
|
+
}
|
|
142602
142619
|
else {
|
|
142603
142620
|
response = await this.contractPrivatePostSwapApiV3SwapHisorders(this.extend(request, params));
|
|
142604
142621
|
}
|
|
@@ -142611,6 +142628,9 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
142611
142628
|
else if (stopLossTakeProfit) {
|
|
142612
142629
|
response = await this.contractPrivatePostApiV1ContractTpslHisorders(this.extend(request, params));
|
|
142613
142630
|
}
|
|
142631
|
+
else if (trailing) {
|
|
142632
|
+
response = await this.contractPrivatePostApiV1ContractTrackHisorders(this.extend(request, params));
|
|
142633
|
+
}
|
|
142614
142634
|
else {
|
|
142615
142635
|
response = await this.contractPrivatePostApiV3ContractHisorders(this.extend(request, params));
|
|
142616
142636
|
}
|
|
@@ -142788,6 +142808,7 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
142788
142808
|
* @param {bool} [params.stop] *contract only* if the orders are stop trigger orders or not
|
|
142789
142809
|
* @param {bool} [params.stopLossTakeProfit] *contract only* if the orders are stop-loss or take-profit orders
|
|
142790
142810
|
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
142811
|
+
* @param {boolean} [params.trailing] *contract only* set to true if you want to fetch trailing stop orders
|
|
142791
142812
|
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
142792
142813
|
*/
|
|
142793
142814
|
await this.loadMarkets();
|
|
@@ -142860,6 +142881,7 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
142860
142881
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
142861
142882
|
* @param {bool} [params.stop] *contract only* if the orders are stop trigger orders or not
|
|
142862
142883
|
* @param {bool} [params.stopLossTakeProfit] *contract only* if the orders are stop-loss or take-profit orders
|
|
142884
|
+
* @param {boolean} [params.trailing] *contract only* set to true if you want to fetch trailing stop orders
|
|
142863
142885
|
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
142864
142886
|
*/
|
|
142865
142887
|
await this.loadMarkets();
|
|
@@ -142907,7 +142929,8 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
142907
142929
|
request['contract_code'] = market['id'];
|
|
142908
142930
|
const stop = this.safeValue(params, 'stop');
|
|
142909
142931
|
const stopLossTakeProfit = this.safeValue(params, 'stopLossTakeProfit');
|
|
142910
|
-
|
|
142932
|
+
const trailing = this.safeValue(params, 'trailing', false);
|
|
142933
|
+
params = this.omit(params, ['stop', 'stopLossTakeProfit', 'trailing']);
|
|
142911
142934
|
if (market['linear']) {
|
|
142912
142935
|
let marginMode = undefined;
|
|
142913
142936
|
[marginMode, params] = this.handleMarginModeAndParams('fetchOpenOrders', params);
|
|
@@ -142919,6 +142942,9 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
142919
142942
|
else if (stopLossTakeProfit) {
|
|
142920
142943
|
response = await this.contractPrivatePostLinearSwapApiV1SwapTpslOpenorders(this.extend(request, params));
|
|
142921
142944
|
}
|
|
142945
|
+
else if (trailing) {
|
|
142946
|
+
response = await this.contractPrivatePostLinearSwapApiV1SwapTrackOpenorders(this.extend(request, params));
|
|
142947
|
+
}
|
|
142922
142948
|
else {
|
|
142923
142949
|
response = await this.contractPrivatePostLinearSwapApiV1SwapOpenorders(this.extend(request, params));
|
|
142924
142950
|
}
|
|
@@ -142930,6 +142956,9 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
142930
142956
|
else if (stopLossTakeProfit) {
|
|
142931
142957
|
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossTpslOpenorders(this.extend(request, params));
|
|
142932
142958
|
}
|
|
142959
|
+
else if (trailing) {
|
|
142960
|
+
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossTrackOpenorders(this.extend(request, params));
|
|
142961
|
+
}
|
|
142933
142962
|
else {
|
|
142934
142963
|
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossOpenorders(this.extend(request, params));
|
|
142935
142964
|
}
|
|
@@ -142943,6 +142972,9 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
142943
142972
|
else if (stopLossTakeProfit) {
|
|
142944
142973
|
response = await this.contractPrivatePostSwapApiV1SwapTpslOpenorders(this.extend(request, params));
|
|
142945
142974
|
}
|
|
142975
|
+
else if (trailing) {
|
|
142976
|
+
response = await this.contractPrivatePostSwapApiV1SwapTrackOpenorders(this.extend(request, params));
|
|
142977
|
+
}
|
|
142946
142978
|
else {
|
|
142947
142979
|
response = await this.contractPrivatePostSwapApiV1SwapOpenorders(this.extend(request, params));
|
|
142948
142980
|
}
|
|
@@ -142955,6 +142987,9 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
142955
142987
|
else if (stopLossTakeProfit) {
|
|
142956
142988
|
response = await this.contractPrivatePostApiV1ContractTpslOpenorders(this.extend(request, params));
|
|
142957
142989
|
}
|
|
142990
|
+
else if (trailing) {
|
|
142991
|
+
response = await this.contractPrivatePostApiV1ContractTrackOpenorders(this.extend(request, params));
|
|
142992
|
+
}
|
|
142958
142993
|
else {
|
|
142959
142994
|
response = await this.contractPrivatePostApiV1ContractOpenorders(this.extend(request, params));
|
|
142960
142995
|
}
|
|
@@ -143106,6 +143141,45 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
143106
143141
|
// "ts": 1683179527011
|
|
143107
143142
|
// }
|
|
143108
143143
|
//
|
|
143144
|
+
// trailing
|
|
143145
|
+
//
|
|
143146
|
+
// {
|
|
143147
|
+
// "status": "ok",
|
|
143148
|
+
// "data": {
|
|
143149
|
+
// "orders": [
|
|
143150
|
+
// {
|
|
143151
|
+
// "contract_type": "swap",
|
|
143152
|
+
// "business_type": "swap",
|
|
143153
|
+
// "pair": "BTC-USDT",
|
|
143154
|
+
// "symbol": "BTC",
|
|
143155
|
+
// "contract_code": "BTC-USDT",
|
|
143156
|
+
// "volume": 1.000000000000000000,
|
|
143157
|
+
// "order_type": 1,
|
|
143158
|
+
// "direction": "sell",
|
|
143159
|
+
// "offset": "close",
|
|
143160
|
+
// "lever_rate": 1,
|
|
143161
|
+
// "order_id": 1192021437253877761,
|
|
143162
|
+
// "order_id_str": "1192021437253877761",
|
|
143163
|
+
// "order_source": "api",
|
|
143164
|
+
// "created_at": 1704241657328,
|
|
143165
|
+
// "order_price_type": "formula_price",
|
|
143166
|
+
// "status": 2,
|
|
143167
|
+
// "callback_rate": 0.050000000000000000,
|
|
143168
|
+
// "active_price": 50000.000000000000000000,
|
|
143169
|
+
// "is_active": 0,
|
|
143170
|
+
// "margin_mode": "cross",
|
|
143171
|
+
// "margin_account": "USDT",
|
|
143172
|
+
// "trade_partition": "USDT",
|
|
143173
|
+
// "reduce_only": 1
|
|
143174
|
+
// },
|
|
143175
|
+
// ],
|
|
143176
|
+
// "total_page": 1,
|
|
143177
|
+
// "current_page": 1,
|
|
143178
|
+
// "total_size": 2
|
|
143179
|
+
// },
|
|
143180
|
+
// "ts": 1704242440106
|
|
143181
|
+
// }
|
|
143182
|
+
//
|
|
143109
143183
|
let orders = this.safeValue(response, 'data');
|
|
143110
143184
|
if (!Array.isArray(orders)) {
|
|
143111
143185
|
orders = this.safeValue(orders, 'orders', []);
|
|
@@ -143365,6 +143439,33 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
143365
143439
|
// "trade_partition": "USDT"
|
|
143366
143440
|
// }
|
|
143367
143441
|
//
|
|
143442
|
+
// trailing: fetchOpenOrders
|
|
143443
|
+
//
|
|
143444
|
+
// {
|
|
143445
|
+
// "contract_type": "swap",
|
|
143446
|
+
// "business_type": "swap",
|
|
143447
|
+
// "pair": "BTC-USDT",
|
|
143448
|
+
// "symbol": "BTC",
|
|
143449
|
+
// "contract_code": "BTC-USDT",
|
|
143450
|
+
// "volume": 1.000000000000000000,
|
|
143451
|
+
// "order_type": 1,
|
|
143452
|
+
// "direction": "sell",
|
|
143453
|
+
// "offset": "close",
|
|
143454
|
+
// "lever_rate": 1,
|
|
143455
|
+
// "order_id": 1192021437253877761,
|
|
143456
|
+
// "order_id_str": "1192021437253877761",
|
|
143457
|
+
// "order_source": "api",
|
|
143458
|
+
// "created_at": 1704241657328,
|
|
143459
|
+
// "order_price_type": "formula_price",
|
|
143460
|
+
// "status": 2,
|
|
143461
|
+
// "callback_rate": 0.050000000000000000,
|
|
143462
|
+
// "active_price": 50000.000000000000000000,
|
|
143463
|
+
// "is_active": 0,
|
|
143464
|
+
// "margin_mode": "cross",
|
|
143465
|
+
// "margin_account": "USDT",
|
|
143466
|
+
// "trade_partition": "USDT",
|
|
143467
|
+
// "reduce_only": 1
|
|
143468
|
+
// }
|
|
143368
143469
|
//
|
|
143369
143470
|
// trigger: fetchOrders
|
|
143370
143471
|
//
|
|
@@ -144129,8 +144230,9 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
144129
144230
|
* @param {string} id order id
|
|
144130
144231
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
144131
144232
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
144132
|
-
* @param {
|
|
144133
|
-
* @param {
|
|
144233
|
+
* @param {boolean} [params.stop] *contract only* if the order is a stop trigger order or not
|
|
144234
|
+
* @param {boolean} [params.stopLossTakeProfit] *contract only* if the order is a stop-loss or take-profit order
|
|
144235
|
+
* @param {boolean} [params.trailing] *contract only* set to true if you want to cancel a trailing order
|
|
144134
144236
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
144135
144237
|
*/
|
|
144136
144238
|
await this.loadMarkets();
|
|
@@ -144185,7 +144287,8 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
144185
144287
|
}
|
|
144186
144288
|
const stop = this.safeValue(params, 'stop');
|
|
144187
144289
|
const stopLossTakeProfit = this.safeValue(params, 'stopLossTakeProfit');
|
|
144188
|
-
|
|
144290
|
+
const trailing = this.safeValue(params, 'trailing', false);
|
|
144291
|
+
params = this.omit(params, ['stop', 'stopLossTakeProfit', 'trailing']);
|
|
144189
144292
|
if (market['linear']) {
|
|
144190
144293
|
let marginMode = undefined;
|
|
144191
144294
|
[marginMode, params] = this.handleMarginModeAndParams('cancelOrder', params);
|
|
@@ -144197,6 +144300,9 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
144197
144300
|
else if (stopLossTakeProfit) {
|
|
144198
144301
|
response = await this.contractPrivatePostLinearSwapApiV1SwapTpslCancel(this.extend(request, params));
|
|
144199
144302
|
}
|
|
144303
|
+
else if (trailing) {
|
|
144304
|
+
response = await this.contractPrivatePostLinearSwapApiV1SwapTrackCancel(this.extend(request, params));
|
|
144305
|
+
}
|
|
144200
144306
|
else {
|
|
144201
144307
|
response = await this.contractPrivatePostLinearSwapApiV1SwapCancel(this.extend(request, params));
|
|
144202
144308
|
}
|
|
@@ -144208,6 +144314,9 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
144208
144314
|
else if (stopLossTakeProfit) {
|
|
144209
144315
|
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossTpslCancel(this.extend(request, params));
|
|
144210
144316
|
}
|
|
144317
|
+
else if (trailing) {
|
|
144318
|
+
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossTrackCancel(this.extend(request, params));
|
|
144319
|
+
}
|
|
144211
144320
|
else {
|
|
144212
144321
|
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossCancel(this.extend(request, params));
|
|
144213
144322
|
}
|
|
@@ -144221,6 +144330,9 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
144221
144330
|
else if (stopLossTakeProfit) {
|
|
144222
144331
|
response = await this.contractPrivatePostSwapApiV1SwapTpslCancel(this.extend(request, params));
|
|
144223
144332
|
}
|
|
144333
|
+
else if (trailing) {
|
|
144334
|
+
response = await this.contractPrivatePostSwapApiV1SwapTrackCancel(this.extend(request, params));
|
|
144335
|
+
}
|
|
144224
144336
|
else {
|
|
144225
144337
|
response = await this.contractPrivatePostSwapApiV1SwapCancel(this.extend(request, params));
|
|
144226
144338
|
}
|
|
@@ -144232,6 +144344,9 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
144232
144344
|
else if (stopLossTakeProfit) {
|
|
144233
144345
|
response = await this.contractPrivatePostApiV1ContractTpslCancel(this.extend(request, params));
|
|
144234
144346
|
}
|
|
144347
|
+
else if (trailing) {
|
|
144348
|
+
response = await this.contractPrivatePostApiV1ContractTrackCancel(this.extend(request, params));
|
|
144349
|
+
}
|
|
144235
144350
|
else {
|
|
144236
144351
|
response = await this.contractPrivatePostApiV1ContractCancel(this.extend(request, params));
|
|
144237
144352
|
}
|
|
@@ -144454,8 +144569,9 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
144454
144569
|
* @description cancel all open orders
|
|
144455
144570
|
* @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
|
|
144456
144571
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
144457
|
-
* @param {
|
|
144458
|
-
* @param {
|
|
144572
|
+
* @param {boolean} [params.stop] *contract only* if the orders are stop trigger orders or not
|
|
144573
|
+
* @param {boolean} [params.stopLossTakeProfit] *contract only* if the orders are stop-loss or take-profit orders
|
|
144574
|
+
* @param {boolean} [params.trailing] *contract only* set to true if you want to cancel all trailing orders
|
|
144459
144575
|
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
144460
144576
|
*/
|
|
144461
144577
|
await this.loadMarkets();
|
|
@@ -144496,7 +144612,8 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
144496
144612
|
request['contract_code'] = market['id'];
|
|
144497
144613
|
const stop = this.safeValue(params, 'stop');
|
|
144498
144614
|
const stopLossTakeProfit = this.safeValue(params, 'stopLossTakeProfit');
|
|
144499
|
-
|
|
144615
|
+
const trailing = this.safeValue(params, 'trailing', false);
|
|
144616
|
+
params = this.omit(params, ['stop', 'stopLossTakeProfit', 'trailing']);
|
|
144500
144617
|
if (market['linear']) {
|
|
144501
144618
|
let marginMode = undefined;
|
|
144502
144619
|
[marginMode, params] = this.handleMarginModeAndParams('cancelAllOrders', params);
|
|
@@ -144508,6 +144625,9 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
144508
144625
|
else if (stopLossTakeProfit) {
|
|
144509
144626
|
response = await this.contractPrivatePostLinearSwapApiV1SwapTpslCancelall(this.extend(request, params));
|
|
144510
144627
|
}
|
|
144628
|
+
else if (trailing) {
|
|
144629
|
+
response = await this.contractPrivatePostLinearSwapApiV1SwapTrackCancelall(this.extend(request, params));
|
|
144630
|
+
}
|
|
144511
144631
|
else {
|
|
144512
144632
|
response = await this.contractPrivatePostLinearSwapApiV1SwapCancelall(this.extend(request, params));
|
|
144513
144633
|
}
|
|
@@ -144519,6 +144639,9 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
144519
144639
|
else if (stopLossTakeProfit) {
|
|
144520
144640
|
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossTpslCancelall(this.extend(request, params));
|
|
144521
144641
|
}
|
|
144642
|
+
else if (trailing) {
|
|
144643
|
+
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossTrackCancelall(this.extend(request, params));
|
|
144644
|
+
}
|
|
144522
144645
|
else {
|
|
144523
144646
|
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossCancelall(this.extend(request, params));
|
|
144524
144647
|
}
|
|
@@ -144532,6 +144655,9 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
144532
144655
|
else if (stopLossTakeProfit) {
|
|
144533
144656
|
response = await this.contractPrivatePostSwapApiV1SwapTpslCancelall(this.extend(request, params));
|
|
144534
144657
|
}
|
|
144658
|
+
else if (trailing) {
|
|
144659
|
+
response = await this.contractPrivatePostSwapApiV1SwapTrackCancelall(this.extend(request, params));
|
|
144660
|
+
}
|
|
144535
144661
|
else {
|
|
144536
144662
|
response = await this.contractPrivatePostSwapApiV1SwapCancelall(this.extend(request, params));
|
|
144537
144663
|
}
|
|
@@ -144543,6 +144669,9 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
144543
144669
|
else if (stopLossTakeProfit) {
|
|
144544
144670
|
response = await this.contractPrivatePostApiV1ContractTpslCancelall(this.extend(request, params));
|
|
144545
144671
|
}
|
|
144672
|
+
else if (trailing) {
|
|
144673
|
+
response = await this.contractPrivatePostApiV1ContractTrackCancelall(this.extend(request, params));
|
|
144674
|
+
}
|
|
144546
144675
|
else {
|
|
144547
144676
|
response = await this.contractPrivatePostApiV1ContractCancelall(this.extend(request, params));
|
|
144548
144677
|
}
|
|
@@ -198319,7 +198448,8 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
198319
198448
|
'34003': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.PermissionDenied,
|
|
198320
198449
|
'35104': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InsufficientFunds,
|
|
198321
198450
|
'39995': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.RateLimitExceeded,
|
|
198322
|
-
'39996': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.PermissionDenied,
|
|
198451
|
+
'39996': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.PermissionDenied,
|
|
198452
|
+
'39997': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadSymbol, // {"code":39997,"msg":"Symbol not listed sMOVRUSDT","data":null}
|
|
198323
198453
|
},
|
|
198324
198454
|
'broad': {
|
|
198325
198455
|
'401 Insufficient privilege': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.PermissionDenied,
|
|
@@ -291588,7 +291718,7 @@ SOFTWARE.
|
|
|
291588
291718
|
|
|
291589
291719
|
//-----------------------------------------------------------------------------
|
|
291590
291720
|
// this is updated by vss.js when building
|
|
291591
|
-
const version = '4.2.
|
|
291721
|
+
const version = '4.2.5';
|
|
291592
291722
|
_src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
|
|
291593
291723
|
//-----------------------------------------------------------------------------
|
|
291594
291724
|
|