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/js/src/bingx.js
CHANGED
|
@@ -1334,18 +1334,11 @@ export default class bingx extends Exchange {
|
|
|
1334
1334
|
const close = this.safeString(ticker, 'lastPrice');
|
|
1335
1335
|
const quoteVolume = this.safeString(ticker, 'quoteVolume');
|
|
1336
1336
|
const baseVolume = this.safeString(ticker, 'volume');
|
|
1337
|
-
let percentage =
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
change = this.safeString(ticker, 'priceChange');
|
|
1343
|
-
}
|
|
1344
|
-
// let percentage = this.safeString (ticker, 'priceChangePercent');
|
|
1345
|
-
// if (percentage !== undefined) {
|
|
1346
|
-
// percentage = percentage.replace ('%', '');
|
|
1347
|
-
// } similarly to change, it's not ccxt's percentage because it does priceChange/open, and priceChange is high-low
|
|
1348
|
-
// const change = this.safeString (ticker, 'priceChange'); // this is not ccxt's change because it does high-low instead of last-open
|
|
1337
|
+
let percentage = this.safeString(ticker, 'priceChangePercent');
|
|
1338
|
+
if (percentage !== undefined) {
|
|
1339
|
+
percentage = percentage.replace('%', '');
|
|
1340
|
+
}
|
|
1341
|
+
const change = this.safeString(ticker, 'priceChange');
|
|
1349
1342
|
const ts = this.safeInteger(ticker, 'closeTime');
|
|
1350
1343
|
const datetime = this.iso8601(ts);
|
|
1351
1344
|
const bid = this.safeString(ticker, 'bidPrice');
|
|
@@ -1674,6 +1667,11 @@ export default class bingx extends Exchange {
|
|
|
1674
1667
|
};
|
|
1675
1668
|
const isMarketOrder = type === 'MARKET';
|
|
1676
1669
|
const isSpot = marketType === 'spot';
|
|
1670
|
+
const exchangeClientOrderId = isSpot ? 'newClientOrderId' : 'clientOrderID';
|
|
1671
|
+
const clientOrderId = this.safeString2(params, exchangeClientOrderId, 'clientOrderId');
|
|
1672
|
+
if (clientOrderId !== undefined) {
|
|
1673
|
+
request[exchangeClientOrderId] = clientOrderId;
|
|
1674
|
+
}
|
|
1677
1675
|
const timeInForce = this.safeStringUpper(params, 'timeInForce');
|
|
1678
1676
|
if (timeInForce === 'IOC') {
|
|
1679
1677
|
request['timeInForce'] = 'IOC';
|
|
@@ -1818,7 +1816,7 @@ export default class bingx extends Exchange {
|
|
|
1818
1816
|
}
|
|
1819
1817
|
request['positionSide'] = positionSide;
|
|
1820
1818
|
request['quantity'] = this.parseToNumeric(this.amountToPrecision(symbol, amount));
|
|
1821
|
-
params = this.omit(params, ['reduceOnly', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice', 'trailingAmount', 'trailingPercent', 'takeProfit', 'stopLoss']);
|
|
1819
|
+
params = this.omit(params, ['reduceOnly', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice', 'trailingAmount', 'trailingPercent', 'takeProfit', 'stopLoss', 'clientOrderId']);
|
|
1822
1820
|
}
|
|
1823
1821
|
return this.extend(request, params);
|
|
1824
1822
|
}
|
|
@@ -1835,6 +1833,7 @@ export default class bingx extends Exchange {
|
|
|
1835
1833
|
* @param {float} amount how much you want to trade in units of the base currency
|
|
1836
1834
|
* @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
1837
1835
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1836
|
+
* @param {string} [params.clientOrderId] a unique id for the order
|
|
1838
1837
|
* @param {bool} [params.postOnly] true to place a post only order
|
|
1839
1838
|
* @param {string} [params.timeInForce] spot supports 'PO' and 'IOC', swap supports 'PO', 'GTC', 'IOC' and 'FOK'
|
|
1840
1839
|
* @param {bool} [params.reduceOnly] *swap only* true or false whether the order is reduce only
|
|
@@ -1899,7 +1898,7 @@ export default class bingx extends Exchange {
|
|
|
1899
1898
|
// }
|
|
1900
1899
|
//
|
|
1901
1900
|
if (typeof response === 'string') {
|
|
1902
|
-
response =
|
|
1901
|
+
response = this.parseJson(response);
|
|
1903
1902
|
}
|
|
1904
1903
|
const data = this.safeValue(response, 'data', {});
|
|
1905
1904
|
const order = this.safeValue(data, 'order', data);
|
|
@@ -2160,7 +2159,7 @@ export default class bingx extends Exchange {
|
|
|
2160
2159
|
'currency': feeCurrencyCode,
|
|
2161
2160
|
'cost': Precise.stringAbs(feeCost),
|
|
2162
2161
|
};
|
|
2163
|
-
const clientOrderId = this.
|
|
2162
|
+
const clientOrderId = this.safeStringN(order, ['clientOrderID', 'origClientOrderId', 'c']);
|
|
2164
2163
|
let stopLoss = this.safeValue(order, 'stopLoss');
|
|
2165
2164
|
let stopLossPrice = undefined;
|
|
2166
2165
|
if (stopLoss !== undefined) {
|
|
@@ -2169,7 +2168,7 @@ export default class bingx extends Exchange {
|
|
|
2169
2168
|
if ((stopLoss !== undefined) && (typeof stopLoss !== 'number')) {
|
|
2170
2169
|
// stopLoss: '{"stopPrice":50,"workingType":"MARK_PRICE","type":"STOP_MARKET","quantity":1}',
|
|
2171
2170
|
if (typeof stopLoss === 'string') {
|
|
2172
|
-
stopLoss =
|
|
2171
|
+
stopLoss = this.parseJson(stopLoss);
|
|
2173
2172
|
}
|
|
2174
2173
|
stopLossPrice = this.safeNumber(stopLoss, 'stopPrice');
|
|
2175
2174
|
}
|
|
@@ -2181,7 +2180,7 @@ export default class bingx extends Exchange {
|
|
|
2181
2180
|
if ((takeProfit !== undefined) && (typeof takeProfit !== 'number')) {
|
|
2182
2181
|
// takeProfit: '{"stopPrice":150,"workingType":"MARK_PRICE","type":"TAKE_PROFIT_MARKET","quantity":1}',
|
|
2183
2182
|
if (typeof takeProfit === 'string') {
|
|
2184
|
-
takeProfit =
|
|
2183
|
+
takeProfit = this.parseJson(takeProfit);
|
|
2185
2184
|
}
|
|
2186
2185
|
takeProfitPrice = this.safeNumber(takeProfit, 'stopPrice');
|
|
2187
2186
|
}
|
|
@@ -2421,7 +2420,7 @@ export default class bingx extends Exchange {
|
|
|
2421
2420
|
}
|
|
2422
2421
|
let response = undefined;
|
|
2423
2422
|
if (market['spot']) {
|
|
2424
|
-
const spotReqKey = areClientOrderIds ? '
|
|
2423
|
+
const spotReqKey = areClientOrderIds ? 'clientOrderIDs' : 'orderIds';
|
|
2425
2424
|
request[spotReqKey] = parsedIds.join(',');
|
|
2426
2425
|
response = await this.spotV1PrivatePostTradeCancelOrders(this.extend(request, params));
|
|
2427
2426
|
}
|
package/js/src/bybit.js
CHANGED
|
@@ -283,6 +283,7 @@ export default class bybit extends Exchange {
|
|
|
283
283
|
'v5/position/list': 5,
|
|
284
284
|
'v5/execution/list': 5,
|
|
285
285
|
'v5/position/closed-pnl': 5,
|
|
286
|
+
'v5/position/move-history': 5,
|
|
286
287
|
// pre-upgrade
|
|
287
288
|
'v5/pre-upgrade/order/history': 5,
|
|
288
289
|
'v5/pre-upgrade/execution/list': 5,
|
|
@@ -447,6 +448,7 @@ export default class bybit extends Exchange {
|
|
|
447
448
|
'v5/position/trading-stop': 5,
|
|
448
449
|
'v5/position/set-auto-add-margin': 5,
|
|
449
450
|
'v5/position/add-margin': 5,
|
|
451
|
+
'v5/position/move-positions': 5,
|
|
450
452
|
'v5/position/confirm-pending-mmr': 5,
|
|
451
453
|
// account
|
|
452
454
|
'v5/account/upgrade-to-uta': 5,
|
package/js/src/delta.js
CHANGED
|
@@ -330,14 +330,14 @@ export default class delta extends Exchange {
|
|
|
330
330
|
const markets = this.markets_by_id[symbol];
|
|
331
331
|
return markets[0];
|
|
332
332
|
}
|
|
333
|
-
else if ((symbol.
|
|
333
|
+
else if ((symbol.endsWith('-C')) || (symbol.endsWith('-P')) || (symbol.startsWith('C-')) || (symbol.startsWith('P-'))) {
|
|
334
334
|
return this.createExpiredOptionMarket(symbol);
|
|
335
335
|
}
|
|
336
336
|
}
|
|
337
337
|
throw new BadSymbol(this.id + ' does not have market symbol ' + symbol);
|
|
338
338
|
}
|
|
339
339
|
safeMarket(marketId = undefined, market = undefined, delimiter = undefined, marketType = undefined) {
|
|
340
|
-
const isOption = (marketId !== undefined) && ((marketId.
|
|
340
|
+
const isOption = (marketId !== undefined) && ((marketId.endsWith('-C')) || (marketId.endsWith('-P')) || (marketId.startsWith('C-')) || (marketId.startsWith('P-')));
|
|
341
341
|
if (isOption && !(marketId in this.markets_by_id)) {
|
|
342
342
|
// handle expired option contracts
|
|
343
343
|
return this.createExpiredOptionMarket(marketId);
|
package/js/src/htx.js
CHANGED
|
@@ -3855,8 +3855,9 @@ export default class htx extends Exchange {
|
|
|
3855
3855
|
let response = undefined;
|
|
3856
3856
|
const stop = this.safeValue(params, 'stop');
|
|
3857
3857
|
const stopLossTakeProfit = this.safeValue(params, 'stopLossTakeProfit');
|
|
3858
|
-
|
|
3859
|
-
|
|
3858
|
+
const trailing = this.safeValue(params, 'trailing', false);
|
|
3859
|
+
params = this.omit(params, ['stop', 'stopLossTakeProfit', 'trailing']);
|
|
3860
|
+
if (stop || stopLossTakeProfit || trailing) {
|
|
3860
3861
|
if (limit !== undefined) {
|
|
3861
3862
|
request['page_size'] = limit;
|
|
3862
3863
|
}
|
|
@@ -3883,6 +3884,9 @@ export default class htx extends Exchange {
|
|
|
3883
3884
|
else if (stopLossTakeProfit) {
|
|
3884
3885
|
response = await this.contractPrivatePostLinearSwapApiV1SwapTpslHisorders(this.extend(request, params));
|
|
3885
3886
|
}
|
|
3887
|
+
else if (trailing) {
|
|
3888
|
+
response = await this.contractPrivatePostLinearSwapApiV1SwapTrackHisorders(this.extend(request, params));
|
|
3889
|
+
}
|
|
3886
3890
|
else {
|
|
3887
3891
|
response = await this.contractPrivatePostLinearSwapApiV3SwapHisorders(this.extend(request, params));
|
|
3888
3892
|
}
|
|
@@ -3894,6 +3898,9 @@ export default class htx extends Exchange {
|
|
|
3894
3898
|
else if (stopLossTakeProfit) {
|
|
3895
3899
|
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossTpslHisorders(this.extend(request, params));
|
|
3896
3900
|
}
|
|
3901
|
+
else if (trailing) {
|
|
3902
|
+
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossTrackHisorders(this.extend(request, params));
|
|
3903
|
+
}
|
|
3897
3904
|
else {
|
|
3898
3905
|
response = await this.contractPrivatePostLinearSwapApiV3SwapCrossHisorders(this.extend(request, params));
|
|
3899
3906
|
}
|
|
@@ -3907,6 +3914,9 @@ export default class htx extends Exchange {
|
|
|
3907
3914
|
else if (stopLossTakeProfit) {
|
|
3908
3915
|
response = await this.contractPrivatePostSwapApiV1SwapTpslHisorders(this.extend(request, params));
|
|
3909
3916
|
}
|
|
3917
|
+
else if (trailing) {
|
|
3918
|
+
response = await this.contractPrivatePostSwapApiV1SwapTrackHisorders(this.extend(request, params));
|
|
3919
|
+
}
|
|
3910
3920
|
else {
|
|
3911
3921
|
response = await this.contractPrivatePostSwapApiV3SwapHisorders(this.extend(request, params));
|
|
3912
3922
|
}
|
|
@@ -3919,6 +3929,9 @@ export default class htx extends Exchange {
|
|
|
3919
3929
|
else if (stopLossTakeProfit) {
|
|
3920
3930
|
response = await this.contractPrivatePostApiV1ContractTpslHisorders(this.extend(request, params));
|
|
3921
3931
|
}
|
|
3932
|
+
else if (trailing) {
|
|
3933
|
+
response = await this.contractPrivatePostApiV1ContractTrackHisorders(this.extend(request, params));
|
|
3934
|
+
}
|
|
3922
3935
|
else {
|
|
3923
3936
|
response = await this.contractPrivatePostApiV3ContractHisorders(this.extend(request, params));
|
|
3924
3937
|
}
|
|
@@ -4096,6 +4109,7 @@ export default class htx extends Exchange {
|
|
|
4096
4109
|
* @param {bool} [params.stop] *contract only* if the orders are stop trigger orders or not
|
|
4097
4110
|
* @param {bool} [params.stopLossTakeProfit] *contract only* if the orders are stop-loss or take-profit orders
|
|
4098
4111
|
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
4112
|
+
* @param {boolean} [params.trailing] *contract only* set to true if you want to fetch trailing stop orders
|
|
4099
4113
|
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4100
4114
|
*/
|
|
4101
4115
|
await this.loadMarkets();
|
|
@@ -4168,6 +4182,7 @@ export default class htx extends Exchange {
|
|
|
4168
4182
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4169
4183
|
* @param {bool} [params.stop] *contract only* if the orders are stop trigger orders or not
|
|
4170
4184
|
* @param {bool} [params.stopLossTakeProfit] *contract only* if the orders are stop-loss or take-profit orders
|
|
4185
|
+
* @param {boolean} [params.trailing] *contract only* set to true if you want to fetch trailing stop orders
|
|
4171
4186
|
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4172
4187
|
*/
|
|
4173
4188
|
await this.loadMarkets();
|
|
@@ -4215,7 +4230,8 @@ export default class htx extends Exchange {
|
|
|
4215
4230
|
request['contract_code'] = market['id'];
|
|
4216
4231
|
const stop = this.safeValue(params, 'stop');
|
|
4217
4232
|
const stopLossTakeProfit = this.safeValue(params, 'stopLossTakeProfit');
|
|
4218
|
-
|
|
4233
|
+
const trailing = this.safeValue(params, 'trailing', false);
|
|
4234
|
+
params = this.omit(params, ['stop', 'stopLossTakeProfit', 'trailing']);
|
|
4219
4235
|
if (market['linear']) {
|
|
4220
4236
|
let marginMode = undefined;
|
|
4221
4237
|
[marginMode, params] = this.handleMarginModeAndParams('fetchOpenOrders', params);
|
|
@@ -4227,6 +4243,9 @@ export default class htx extends Exchange {
|
|
|
4227
4243
|
else if (stopLossTakeProfit) {
|
|
4228
4244
|
response = await this.contractPrivatePostLinearSwapApiV1SwapTpslOpenorders(this.extend(request, params));
|
|
4229
4245
|
}
|
|
4246
|
+
else if (trailing) {
|
|
4247
|
+
response = await this.contractPrivatePostLinearSwapApiV1SwapTrackOpenorders(this.extend(request, params));
|
|
4248
|
+
}
|
|
4230
4249
|
else {
|
|
4231
4250
|
response = await this.contractPrivatePostLinearSwapApiV1SwapOpenorders(this.extend(request, params));
|
|
4232
4251
|
}
|
|
@@ -4238,6 +4257,9 @@ export default class htx extends Exchange {
|
|
|
4238
4257
|
else if (stopLossTakeProfit) {
|
|
4239
4258
|
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossTpslOpenorders(this.extend(request, params));
|
|
4240
4259
|
}
|
|
4260
|
+
else if (trailing) {
|
|
4261
|
+
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossTrackOpenorders(this.extend(request, params));
|
|
4262
|
+
}
|
|
4241
4263
|
else {
|
|
4242
4264
|
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossOpenorders(this.extend(request, params));
|
|
4243
4265
|
}
|
|
@@ -4251,6 +4273,9 @@ export default class htx extends Exchange {
|
|
|
4251
4273
|
else if (stopLossTakeProfit) {
|
|
4252
4274
|
response = await this.contractPrivatePostSwapApiV1SwapTpslOpenorders(this.extend(request, params));
|
|
4253
4275
|
}
|
|
4276
|
+
else if (trailing) {
|
|
4277
|
+
response = await this.contractPrivatePostSwapApiV1SwapTrackOpenorders(this.extend(request, params));
|
|
4278
|
+
}
|
|
4254
4279
|
else {
|
|
4255
4280
|
response = await this.contractPrivatePostSwapApiV1SwapOpenorders(this.extend(request, params));
|
|
4256
4281
|
}
|
|
@@ -4263,6 +4288,9 @@ export default class htx extends Exchange {
|
|
|
4263
4288
|
else if (stopLossTakeProfit) {
|
|
4264
4289
|
response = await this.contractPrivatePostApiV1ContractTpslOpenorders(this.extend(request, params));
|
|
4265
4290
|
}
|
|
4291
|
+
else if (trailing) {
|
|
4292
|
+
response = await this.contractPrivatePostApiV1ContractTrackOpenorders(this.extend(request, params));
|
|
4293
|
+
}
|
|
4266
4294
|
else {
|
|
4267
4295
|
response = await this.contractPrivatePostApiV1ContractOpenorders(this.extend(request, params));
|
|
4268
4296
|
}
|
|
@@ -4414,6 +4442,45 @@ export default class htx extends Exchange {
|
|
|
4414
4442
|
// "ts": 1683179527011
|
|
4415
4443
|
// }
|
|
4416
4444
|
//
|
|
4445
|
+
// trailing
|
|
4446
|
+
//
|
|
4447
|
+
// {
|
|
4448
|
+
// "status": "ok",
|
|
4449
|
+
// "data": {
|
|
4450
|
+
// "orders": [
|
|
4451
|
+
// {
|
|
4452
|
+
// "contract_type": "swap",
|
|
4453
|
+
// "business_type": "swap",
|
|
4454
|
+
// "pair": "BTC-USDT",
|
|
4455
|
+
// "symbol": "BTC",
|
|
4456
|
+
// "contract_code": "BTC-USDT",
|
|
4457
|
+
// "volume": 1.000000000000000000,
|
|
4458
|
+
// "order_type": 1,
|
|
4459
|
+
// "direction": "sell",
|
|
4460
|
+
// "offset": "close",
|
|
4461
|
+
// "lever_rate": 1,
|
|
4462
|
+
// "order_id": 1192021437253877761,
|
|
4463
|
+
// "order_id_str": "1192021437253877761",
|
|
4464
|
+
// "order_source": "api",
|
|
4465
|
+
// "created_at": 1704241657328,
|
|
4466
|
+
// "order_price_type": "formula_price",
|
|
4467
|
+
// "status": 2,
|
|
4468
|
+
// "callback_rate": 0.050000000000000000,
|
|
4469
|
+
// "active_price": 50000.000000000000000000,
|
|
4470
|
+
// "is_active": 0,
|
|
4471
|
+
// "margin_mode": "cross",
|
|
4472
|
+
// "margin_account": "USDT",
|
|
4473
|
+
// "trade_partition": "USDT",
|
|
4474
|
+
// "reduce_only": 1
|
|
4475
|
+
// },
|
|
4476
|
+
// ],
|
|
4477
|
+
// "total_page": 1,
|
|
4478
|
+
// "current_page": 1,
|
|
4479
|
+
// "total_size": 2
|
|
4480
|
+
// },
|
|
4481
|
+
// "ts": 1704242440106
|
|
4482
|
+
// }
|
|
4483
|
+
//
|
|
4417
4484
|
let orders = this.safeValue(response, 'data');
|
|
4418
4485
|
if (!Array.isArray(orders)) {
|
|
4419
4486
|
orders = this.safeValue(orders, 'orders', []);
|
|
@@ -4673,6 +4740,33 @@ export default class htx extends Exchange {
|
|
|
4673
4740
|
// "trade_partition": "USDT"
|
|
4674
4741
|
// }
|
|
4675
4742
|
//
|
|
4743
|
+
// trailing: fetchOpenOrders
|
|
4744
|
+
//
|
|
4745
|
+
// {
|
|
4746
|
+
// "contract_type": "swap",
|
|
4747
|
+
// "business_type": "swap",
|
|
4748
|
+
// "pair": "BTC-USDT",
|
|
4749
|
+
// "symbol": "BTC",
|
|
4750
|
+
// "contract_code": "BTC-USDT",
|
|
4751
|
+
// "volume": 1.000000000000000000,
|
|
4752
|
+
// "order_type": 1,
|
|
4753
|
+
// "direction": "sell",
|
|
4754
|
+
// "offset": "close",
|
|
4755
|
+
// "lever_rate": 1,
|
|
4756
|
+
// "order_id": 1192021437253877761,
|
|
4757
|
+
// "order_id_str": "1192021437253877761",
|
|
4758
|
+
// "order_source": "api",
|
|
4759
|
+
// "created_at": 1704241657328,
|
|
4760
|
+
// "order_price_type": "formula_price",
|
|
4761
|
+
// "status": 2,
|
|
4762
|
+
// "callback_rate": 0.050000000000000000,
|
|
4763
|
+
// "active_price": 50000.000000000000000000,
|
|
4764
|
+
// "is_active": 0,
|
|
4765
|
+
// "margin_mode": "cross",
|
|
4766
|
+
// "margin_account": "USDT",
|
|
4767
|
+
// "trade_partition": "USDT",
|
|
4768
|
+
// "reduce_only": 1
|
|
4769
|
+
// }
|
|
4676
4770
|
//
|
|
4677
4771
|
// trigger: fetchOrders
|
|
4678
4772
|
//
|
|
@@ -5437,8 +5531,9 @@ export default class htx extends Exchange {
|
|
|
5437
5531
|
* @param {string} id order id
|
|
5438
5532
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
5439
5533
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5440
|
-
* @param {
|
|
5441
|
-
* @param {
|
|
5534
|
+
* @param {boolean} [params.stop] *contract only* if the order is a stop trigger order or not
|
|
5535
|
+
* @param {boolean} [params.stopLossTakeProfit] *contract only* if the order is a stop-loss or take-profit order
|
|
5536
|
+
* @param {boolean} [params.trailing] *contract only* set to true if you want to cancel a trailing order
|
|
5442
5537
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
5443
5538
|
*/
|
|
5444
5539
|
await this.loadMarkets();
|
|
@@ -5493,7 +5588,8 @@ export default class htx extends Exchange {
|
|
|
5493
5588
|
}
|
|
5494
5589
|
const stop = this.safeValue(params, 'stop');
|
|
5495
5590
|
const stopLossTakeProfit = this.safeValue(params, 'stopLossTakeProfit');
|
|
5496
|
-
|
|
5591
|
+
const trailing = this.safeValue(params, 'trailing', false);
|
|
5592
|
+
params = this.omit(params, ['stop', 'stopLossTakeProfit', 'trailing']);
|
|
5497
5593
|
if (market['linear']) {
|
|
5498
5594
|
let marginMode = undefined;
|
|
5499
5595
|
[marginMode, params] = this.handleMarginModeAndParams('cancelOrder', params);
|
|
@@ -5505,6 +5601,9 @@ export default class htx extends Exchange {
|
|
|
5505
5601
|
else if (stopLossTakeProfit) {
|
|
5506
5602
|
response = await this.contractPrivatePostLinearSwapApiV1SwapTpslCancel(this.extend(request, params));
|
|
5507
5603
|
}
|
|
5604
|
+
else if (trailing) {
|
|
5605
|
+
response = await this.contractPrivatePostLinearSwapApiV1SwapTrackCancel(this.extend(request, params));
|
|
5606
|
+
}
|
|
5508
5607
|
else {
|
|
5509
5608
|
response = await this.contractPrivatePostLinearSwapApiV1SwapCancel(this.extend(request, params));
|
|
5510
5609
|
}
|
|
@@ -5516,6 +5615,9 @@ export default class htx extends Exchange {
|
|
|
5516
5615
|
else if (stopLossTakeProfit) {
|
|
5517
5616
|
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossTpslCancel(this.extend(request, params));
|
|
5518
5617
|
}
|
|
5618
|
+
else if (trailing) {
|
|
5619
|
+
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossTrackCancel(this.extend(request, params));
|
|
5620
|
+
}
|
|
5519
5621
|
else {
|
|
5520
5622
|
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossCancel(this.extend(request, params));
|
|
5521
5623
|
}
|
|
@@ -5529,6 +5631,9 @@ export default class htx extends Exchange {
|
|
|
5529
5631
|
else if (stopLossTakeProfit) {
|
|
5530
5632
|
response = await this.contractPrivatePostSwapApiV1SwapTpslCancel(this.extend(request, params));
|
|
5531
5633
|
}
|
|
5634
|
+
else if (trailing) {
|
|
5635
|
+
response = await this.contractPrivatePostSwapApiV1SwapTrackCancel(this.extend(request, params));
|
|
5636
|
+
}
|
|
5532
5637
|
else {
|
|
5533
5638
|
response = await this.contractPrivatePostSwapApiV1SwapCancel(this.extend(request, params));
|
|
5534
5639
|
}
|
|
@@ -5540,6 +5645,9 @@ export default class htx extends Exchange {
|
|
|
5540
5645
|
else if (stopLossTakeProfit) {
|
|
5541
5646
|
response = await this.contractPrivatePostApiV1ContractTpslCancel(this.extend(request, params));
|
|
5542
5647
|
}
|
|
5648
|
+
else if (trailing) {
|
|
5649
|
+
response = await this.contractPrivatePostApiV1ContractTrackCancel(this.extend(request, params));
|
|
5650
|
+
}
|
|
5543
5651
|
else {
|
|
5544
5652
|
response = await this.contractPrivatePostApiV1ContractCancel(this.extend(request, params));
|
|
5545
5653
|
}
|
|
@@ -5762,8 +5870,9 @@ export default class htx extends Exchange {
|
|
|
5762
5870
|
* @description cancel all open orders
|
|
5763
5871
|
* @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
|
|
5764
5872
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5765
|
-
* @param {
|
|
5766
|
-
* @param {
|
|
5873
|
+
* @param {boolean} [params.stop] *contract only* if the orders are stop trigger orders or not
|
|
5874
|
+
* @param {boolean} [params.stopLossTakeProfit] *contract only* if the orders are stop-loss or take-profit orders
|
|
5875
|
+
* @param {boolean} [params.trailing] *contract only* set to true if you want to cancel all trailing orders
|
|
5767
5876
|
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
5768
5877
|
*/
|
|
5769
5878
|
await this.loadMarkets();
|
|
@@ -5804,7 +5913,8 @@ export default class htx extends Exchange {
|
|
|
5804
5913
|
request['contract_code'] = market['id'];
|
|
5805
5914
|
const stop = this.safeValue(params, 'stop');
|
|
5806
5915
|
const stopLossTakeProfit = this.safeValue(params, 'stopLossTakeProfit');
|
|
5807
|
-
|
|
5916
|
+
const trailing = this.safeValue(params, 'trailing', false);
|
|
5917
|
+
params = this.omit(params, ['stop', 'stopLossTakeProfit', 'trailing']);
|
|
5808
5918
|
if (market['linear']) {
|
|
5809
5919
|
let marginMode = undefined;
|
|
5810
5920
|
[marginMode, params] = this.handleMarginModeAndParams('cancelAllOrders', params);
|
|
@@ -5816,6 +5926,9 @@ export default class htx extends Exchange {
|
|
|
5816
5926
|
else if (stopLossTakeProfit) {
|
|
5817
5927
|
response = await this.contractPrivatePostLinearSwapApiV1SwapTpslCancelall(this.extend(request, params));
|
|
5818
5928
|
}
|
|
5929
|
+
else if (trailing) {
|
|
5930
|
+
response = await this.contractPrivatePostLinearSwapApiV1SwapTrackCancelall(this.extend(request, params));
|
|
5931
|
+
}
|
|
5819
5932
|
else {
|
|
5820
5933
|
response = await this.contractPrivatePostLinearSwapApiV1SwapCancelall(this.extend(request, params));
|
|
5821
5934
|
}
|
|
@@ -5827,6 +5940,9 @@ export default class htx extends Exchange {
|
|
|
5827
5940
|
else if (stopLossTakeProfit) {
|
|
5828
5941
|
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossTpslCancelall(this.extend(request, params));
|
|
5829
5942
|
}
|
|
5943
|
+
else if (trailing) {
|
|
5944
|
+
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossTrackCancelall(this.extend(request, params));
|
|
5945
|
+
}
|
|
5830
5946
|
else {
|
|
5831
5947
|
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossCancelall(this.extend(request, params));
|
|
5832
5948
|
}
|
|
@@ -5840,6 +5956,9 @@ export default class htx extends Exchange {
|
|
|
5840
5956
|
else if (stopLossTakeProfit) {
|
|
5841
5957
|
response = await this.contractPrivatePostSwapApiV1SwapTpslCancelall(this.extend(request, params));
|
|
5842
5958
|
}
|
|
5959
|
+
else if (trailing) {
|
|
5960
|
+
response = await this.contractPrivatePostSwapApiV1SwapTrackCancelall(this.extend(request, params));
|
|
5961
|
+
}
|
|
5843
5962
|
else {
|
|
5844
5963
|
response = await this.contractPrivatePostSwapApiV1SwapCancelall(this.extend(request, params));
|
|
5845
5964
|
}
|
|
@@ -5851,6 +5970,9 @@ export default class htx extends Exchange {
|
|
|
5851
5970
|
else if (stopLossTakeProfit) {
|
|
5852
5971
|
response = await this.contractPrivatePostApiV1ContractTpslCancelall(this.extend(request, params));
|
|
5853
5972
|
}
|
|
5973
|
+
else if (trailing) {
|
|
5974
|
+
response = await this.contractPrivatePostApiV1ContractTrackCancelall(this.extend(request, params));
|
|
5975
|
+
}
|
|
5854
5976
|
else {
|
|
5855
5977
|
response = await this.contractPrivatePostApiV1ContractCancelall(this.extend(request, params));
|
|
5856
5978
|
}
|
package/js/src/phemex.js
CHANGED
|
@@ -442,7 +442,8 @@ export default class phemex extends Exchange {
|
|
|
442
442
|
'34003': PermissionDenied,
|
|
443
443
|
'35104': InsufficientFunds,
|
|
444
444
|
'39995': RateLimitExceeded,
|
|
445
|
-
'39996': PermissionDenied,
|
|
445
|
+
'39996': PermissionDenied,
|
|
446
|
+
'39997': BadSymbol, // {"code":39997,"msg":"Symbol not listed sMOVRUSDT","data":null}
|
|
446
447
|
},
|
|
447
448
|
'broad': {
|
|
448
449
|
'401 Insufficient privilege': PermissionDenied,
|
package/package.json
CHANGED
package/skip-tests.json
CHANGED
|
@@ -106,7 +106,8 @@
|
|
|
106
106
|
},
|
|
107
107
|
"watchTicker": {
|
|
108
108
|
"quoteVolume": "https://app.travis-ci.com/github/ccxt/ccxt/builds/267900037#L2466"
|
|
109
|
-
}
|
|
109
|
+
},
|
|
110
|
+
"watchOrderBook": "out of order update"
|
|
110
111
|
}
|
|
111
112
|
},
|
|
112
113
|
"binanceusdm": {
|
|
@@ -743,6 +744,7 @@
|
|
|
743
744
|
}
|
|
744
745
|
},
|
|
745
746
|
"cryptocom": {
|
|
747
|
+
"skipWs": "timeout",
|
|
746
748
|
"skipMethods": {
|
|
747
749
|
"proxies": "probably they do not permit our proxy",
|
|
748
750
|
"loadMarkets": {
|
|
@@ -1653,6 +1655,7 @@
|
|
|
1653
1655
|
}
|
|
1654
1656
|
},
|
|
1655
1657
|
"bitteam": {
|
|
1658
|
+
"skip": "tmp timeout",
|
|
1656
1659
|
"skipPhpAsync": true,
|
|
1657
1660
|
"skipMethods": {
|
|
1658
1661
|
"loadMarkets": {
|