ccxt 4.2.3 → 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 +247 -47
- package/dist/ccxt.browser.min.js +5 -5
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/alpaca.js +7 -1
- package/dist/cjs/src/base/Exchange.js +5 -2
- package/dist/cjs/src/bingx.js +17 -18
- package/dist/cjs/src/bitmart.js +18 -8
- package/dist/cjs/src/bybit.js +4 -0
- package/dist/cjs/src/coinsph.js +20 -2
- package/dist/cjs/src/delta.js +2 -2
- package/dist/cjs/src/htx.js +166 -12
- package/dist/cjs/src/okx.js +5 -0
- package/dist/cjs/src/phemex.js +3 -2
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bitmart.d.ts +1 -0
- package/js/src/abstract/bybit.d.ts +2 -0
- package/js/src/alpaca.js +7 -1
- package/js/src/base/Exchange.js +5 -2
- 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/bitmart.js +18 -8
- package/js/src/bybit.js +4 -0
- package/js/src/coinsph.js +20 -2
- package/js/src/delta.js +2 -2
- package/js/src/htx.js +166 -12
- package/js/src/okx.js +5 -0
- package/js/src/phemex.js +3 -2
- package/package.json +1 -1
- package/skip-tests.json +4 -1
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
|
//
|
|
@@ -5017,6 +5111,8 @@ export default class htx extends Exchange {
|
|
|
5017
5111
|
* @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
5018
5112
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5019
5113
|
* @param {string} [params.timeInForce] supports 'IOC' and 'FOK'
|
|
5114
|
+
* @param {float} [params.trailingPercent] *contract only* the percent to trail away from the current market price
|
|
5115
|
+
* @param {float} [params.trailingTriggerPrice] *contract only* the price to trigger a trailing order, default uses the price argument
|
|
5020
5116
|
* @returns {object} request to be sent to the exchange
|
|
5021
5117
|
*/
|
|
5022
5118
|
const market = this.market(symbol);
|
|
@@ -5040,6 +5136,9 @@ export default class htx extends Exchange {
|
|
|
5040
5136
|
const triggerPrice = this.safeNumber2(params, 'stopPrice', 'trigger_price');
|
|
5041
5137
|
const stopLossTriggerPrice = this.safeNumber2(params, 'stopLossPrice', 'sl_trigger_price');
|
|
5042
5138
|
const takeProfitTriggerPrice = this.safeNumber2(params, 'takeProfitPrice', 'tp_trigger_price');
|
|
5139
|
+
const trailingPercent = this.safeString2(params, 'trailingPercent', 'callback_rate');
|
|
5140
|
+
const trailingTriggerPrice = this.safeNumber(params, 'trailingTriggerPrice', price);
|
|
5141
|
+
const isTrailingPercentOrder = trailingPercent !== undefined;
|
|
5043
5142
|
const isStop = triggerPrice !== undefined;
|
|
5044
5143
|
const isStopLossTriggerOrder = stopLossTriggerPrice !== undefined;
|
|
5045
5144
|
const isTakeProfitTriggerOrder = takeProfitTriggerPrice !== undefined;
|
|
@@ -5067,6 +5166,12 @@ export default class htx extends Exchange {
|
|
|
5067
5166
|
}
|
|
5068
5167
|
}
|
|
5069
5168
|
}
|
|
5169
|
+
else if (isTrailingPercentOrder) {
|
|
5170
|
+
const trailingPercentString = Precise.stringDiv(trailingPercent, '100');
|
|
5171
|
+
request['callback_rate'] = this.parseToNumeric(trailingPercentString);
|
|
5172
|
+
request['active_price'] = trailingTriggerPrice;
|
|
5173
|
+
request['order_price_type'] = this.safeString(params, 'order_price_type', 'formula_price');
|
|
5174
|
+
}
|
|
5070
5175
|
else {
|
|
5071
5176
|
const clientOrderId = this.safeInteger2(params, 'client_order_id', 'clientOrderId');
|
|
5072
5177
|
if (clientOrderId !== undefined) {
|
|
@@ -5078,7 +5183,7 @@ export default class htx extends Exchange {
|
|
|
5078
5183
|
}
|
|
5079
5184
|
}
|
|
5080
5185
|
if (!isStopLossTriggerOrder && !isTakeProfitTriggerOrder) {
|
|
5081
|
-
const leverRate = this.
|
|
5186
|
+
const leverRate = this.safeIntegerN(params, ['leverRate', 'lever_rate', 'leverage'], 1);
|
|
5082
5187
|
const reduceOnly = this.safeValue2(params, 'reduceOnly', 'reduce_only', false);
|
|
5083
5188
|
const openOrClose = (reduceOnly) ? 'close' : 'open';
|
|
5084
5189
|
const offset = this.safeString(params, 'offset', openOrClose);
|
|
@@ -5087,12 +5192,14 @@ export default class htx extends Exchange {
|
|
|
5087
5192
|
request['reduce_only'] = 1;
|
|
5088
5193
|
}
|
|
5089
5194
|
request['lever_rate'] = leverRate;
|
|
5090
|
-
|
|
5195
|
+
if (!isTrailingPercentOrder) {
|
|
5196
|
+
request['order_price_type'] = type;
|
|
5197
|
+
}
|
|
5091
5198
|
}
|
|
5092
5199
|
const broker = this.safeValue(this.options, 'broker', {});
|
|
5093
5200
|
const brokerId = this.safeString(broker, 'id');
|
|
5094
5201
|
request['channel_code'] = brokerId;
|
|
5095
|
-
params = this.omit(params, ['reduceOnly', 'stopPrice', 'stopLossPrice', 'takeProfitPrice', 'triggerType', 'leverRate', 'timeInForce']);
|
|
5202
|
+
params = this.omit(params, ['reduceOnly', 'stopPrice', 'stopLossPrice', 'takeProfitPrice', 'triggerType', 'leverRate', 'timeInForce', 'leverage', 'trailingPercent', 'trailingTriggerPrice']);
|
|
5096
5203
|
return this.extend(request, params);
|
|
5097
5204
|
}
|
|
5098
5205
|
async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
|
@@ -5125,6 +5232,8 @@ export default class htx extends Exchange {
|
|
|
5125
5232
|
* @param {int} [params.leverRate] *contract only* required for all contract orders except tpsl, leverage greater than 20x requires prior approval of high-leverage agreement
|
|
5126
5233
|
* @param {string} [params.timeInForce] supports 'IOC' and 'FOK'
|
|
5127
5234
|
* @param {float} [params.cost] *spot market buy only* the quote quantity that can be used as an alternative for the amount
|
|
5235
|
+
* @param {float} [params.trailingPercent] *contract only* the percent to trail away from the current market price
|
|
5236
|
+
* @param {float} [params.trailingTriggerPrice] *contract only* the price to trigger a trailing order, default uses the price argument
|
|
5128
5237
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
5129
5238
|
*/
|
|
5130
5239
|
await this.loadMarkets();
|
|
@@ -5132,11 +5241,16 @@ export default class htx extends Exchange {
|
|
|
5132
5241
|
const triggerPrice = this.safeNumber2(params, 'stopPrice', 'trigger_price');
|
|
5133
5242
|
const stopLossTriggerPrice = this.safeNumber2(params, 'stopLossPrice', 'sl_trigger_price');
|
|
5134
5243
|
const takeProfitTriggerPrice = this.safeNumber2(params, 'takeProfitPrice', 'tp_trigger_price');
|
|
5244
|
+
const trailingPercent = this.safeNumber(params, 'trailingPercent');
|
|
5245
|
+
const isTrailingPercentOrder = trailingPercent !== undefined;
|
|
5135
5246
|
const isStop = triggerPrice !== undefined;
|
|
5136
5247
|
const isStopLossTriggerOrder = stopLossTriggerPrice !== undefined;
|
|
5137
5248
|
const isTakeProfitTriggerOrder = takeProfitTriggerPrice !== undefined;
|
|
5138
5249
|
let response = undefined;
|
|
5139
5250
|
if (market['spot']) {
|
|
5251
|
+
if (isTrailingPercentOrder) {
|
|
5252
|
+
throw new NotSupported(this.id + ' createOrder() does not support trailing orders for spot markets');
|
|
5253
|
+
}
|
|
5140
5254
|
const spotRequest = await this.createSpotOrderRequest(symbol, type, side, amount, price, params);
|
|
5141
5255
|
response = await this.spotPrivatePostV1OrderOrdersPlace(spotRequest);
|
|
5142
5256
|
}
|
|
@@ -5153,6 +5267,9 @@ export default class htx extends Exchange {
|
|
|
5153
5267
|
else if (isStopLossTriggerOrder || isTakeProfitTriggerOrder) {
|
|
5154
5268
|
response = await this.contractPrivatePostLinearSwapApiV1SwapTpslOrder(contractRequest);
|
|
5155
5269
|
}
|
|
5270
|
+
else if (isTrailingPercentOrder) {
|
|
5271
|
+
response = await this.contractPrivatePostLinearSwapApiV1SwapTrackOrder(contractRequest);
|
|
5272
|
+
}
|
|
5156
5273
|
else {
|
|
5157
5274
|
response = await this.contractPrivatePostLinearSwapApiV1SwapOrder(contractRequest);
|
|
5158
5275
|
}
|
|
@@ -5164,6 +5281,9 @@ export default class htx extends Exchange {
|
|
|
5164
5281
|
else if (isStopLossTriggerOrder || isTakeProfitTriggerOrder) {
|
|
5165
5282
|
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossTpslOrder(contractRequest);
|
|
5166
5283
|
}
|
|
5284
|
+
else if (isTrailingPercentOrder) {
|
|
5285
|
+
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossTrackOrder(contractRequest);
|
|
5286
|
+
}
|
|
5167
5287
|
else {
|
|
5168
5288
|
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossOrder(contractRequest);
|
|
5169
5289
|
}
|
|
@@ -5177,6 +5297,9 @@ export default class htx extends Exchange {
|
|
|
5177
5297
|
else if (isStopLossTriggerOrder || isTakeProfitTriggerOrder) {
|
|
5178
5298
|
response = await this.contractPrivatePostSwapApiV1SwapTpslOrder(contractRequest);
|
|
5179
5299
|
}
|
|
5300
|
+
else if (isTrailingPercentOrder) {
|
|
5301
|
+
response = await this.contractPrivatePostSwapApiV1SwapTrackOrder(contractRequest);
|
|
5302
|
+
}
|
|
5180
5303
|
else {
|
|
5181
5304
|
response = await this.contractPrivatePostSwapApiV1SwapOrder(contractRequest);
|
|
5182
5305
|
}
|
|
@@ -5188,6 +5311,9 @@ export default class htx extends Exchange {
|
|
|
5188
5311
|
else if (isStopLossTriggerOrder || isTakeProfitTriggerOrder) {
|
|
5189
5312
|
response = await this.contractPrivatePostApiV1ContractTpslOrder(contractRequest);
|
|
5190
5313
|
}
|
|
5314
|
+
else if (isTrailingPercentOrder) {
|
|
5315
|
+
response = await this.contractPrivatePostApiV1ContractTrackOrder(contractRequest);
|
|
5316
|
+
}
|
|
5191
5317
|
else {
|
|
5192
5318
|
response = await this.contractPrivatePostApiV1ContractOrder(contractRequest);
|
|
5193
5319
|
}
|
|
@@ -5405,8 +5531,9 @@ export default class htx extends Exchange {
|
|
|
5405
5531
|
* @param {string} id order id
|
|
5406
5532
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
5407
5533
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5408
|
-
* @param {
|
|
5409
|
-
* @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
|
|
5410
5537
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
5411
5538
|
*/
|
|
5412
5539
|
await this.loadMarkets();
|
|
@@ -5461,7 +5588,8 @@ export default class htx extends Exchange {
|
|
|
5461
5588
|
}
|
|
5462
5589
|
const stop = this.safeValue(params, 'stop');
|
|
5463
5590
|
const stopLossTakeProfit = this.safeValue(params, 'stopLossTakeProfit');
|
|
5464
|
-
|
|
5591
|
+
const trailing = this.safeValue(params, 'trailing', false);
|
|
5592
|
+
params = this.omit(params, ['stop', 'stopLossTakeProfit', 'trailing']);
|
|
5465
5593
|
if (market['linear']) {
|
|
5466
5594
|
let marginMode = undefined;
|
|
5467
5595
|
[marginMode, params] = this.handleMarginModeAndParams('cancelOrder', params);
|
|
@@ -5473,6 +5601,9 @@ export default class htx extends Exchange {
|
|
|
5473
5601
|
else if (stopLossTakeProfit) {
|
|
5474
5602
|
response = await this.contractPrivatePostLinearSwapApiV1SwapTpslCancel(this.extend(request, params));
|
|
5475
5603
|
}
|
|
5604
|
+
else if (trailing) {
|
|
5605
|
+
response = await this.contractPrivatePostLinearSwapApiV1SwapTrackCancel(this.extend(request, params));
|
|
5606
|
+
}
|
|
5476
5607
|
else {
|
|
5477
5608
|
response = await this.contractPrivatePostLinearSwapApiV1SwapCancel(this.extend(request, params));
|
|
5478
5609
|
}
|
|
@@ -5484,6 +5615,9 @@ export default class htx extends Exchange {
|
|
|
5484
5615
|
else if (stopLossTakeProfit) {
|
|
5485
5616
|
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossTpslCancel(this.extend(request, params));
|
|
5486
5617
|
}
|
|
5618
|
+
else if (trailing) {
|
|
5619
|
+
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossTrackCancel(this.extend(request, params));
|
|
5620
|
+
}
|
|
5487
5621
|
else {
|
|
5488
5622
|
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossCancel(this.extend(request, params));
|
|
5489
5623
|
}
|
|
@@ -5497,6 +5631,9 @@ export default class htx extends Exchange {
|
|
|
5497
5631
|
else if (stopLossTakeProfit) {
|
|
5498
5632
|
response = await this.contractPrivatePostSwapApiV1SwapTpslCancel(this.extend(request, params));
|
|
5499
5633
|
}
|
|
5634
|
+
else if (trailing) {
|
|
5635
|
+
response = await this.contractPrivatePostSwapApiV1SwapTrackCancel(this.extend(request, params));
|
|
5636
|
+
}
|
|
5500
5637
|
else {
|
|
5501
5638
|
response = await this.contractPrivatePostSwapApiV1SwapCancel(this.extend(request, params));
|
|
5502
5639
|
}
|
|
@@ -5508,6 +5645,9 @@ export default class htx extends Exchange {
|
|
|
5508
5645
|
else if (stopLossTakeProfit) {
|
|
5509
5646
|
response = await this.contractPrivatePostApiV1ContractTpslCancel(this.extend(request, params));
|
|
5510
5647
|
}
|
|
5648
|
+
else if (trailing) {
|
|
5649
|
+
response = await this.contractPrivatePostApiV1ContractTrackCancel(this.extend(request, params));
|
|
5650
|
+
}
|
|
5511
5651
|
else {
|
|
5512
5652
|
response = await this.contractPrivatePostApiV1ContractCancel(this.extend(request, params));
|
|
5513
5653
|
}
|
|
@@ -5730,8 +5870,9 @@ export default class htx extends Exchange {
|
|
|
5730
5870
|
* @description cancel all open orders
|
|
5731
5871
|
* @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
|
|
5732
5872
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5733
|
-
* @param {
|
|
5734
|
-
* @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
|
|
5735
5876
|
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
5736
5877
|
*/
|
|
5737
5878
|
await this.loadMarkets();
|
|
@@ -5772,7 +5913,8 @@ export default class htx extends Exchange {
|
|
|
5772
5913
|
request['contract_code'] = market['id'];
|
|
5773
5914
|
const stop = this.safeValue(params, 'stop');
|
|
5774
5915
|
const stopLossTakeProfit = this.safeValue(params, 'stopLossTakeProfit');
|
|
5775
|
-
|
|
5916
|
+
const trailing = this.safeValue(params, 'trailing', false);
|
|
5917
|
+
params = this.omit(params, ['stop', 'stopLossTakeProfit', 'trailing']);
|
|
5776
5918
|
if (market['linear']) {
|
|
5777
5919
|
let marginMode = undefined;
|
|
5778
5920
|
[marginMode, params] = this.handleMarginModeAndParams('cancelAllOrders', params);
|
|
@@ -5784,6 +5926,9 @@ export default class htx extends Exchange {
|
|
|
5784
5926
|
else if (stopLossTakeProfit) {
|
|
5785
5927
|
response = await this.contractPrivatePostLinearSwapApiV1SwapTpslCancelall(this.extend(request, params));
|
|
5786
5928
|
}
|
|
5929
|
+
else if (trailing) {
|
|
5930
|
+
response = await this.contractPrivatePostLinearSwapApiV1SwapTrackCancelall(this.extend(request, params));
|
|
5931
|
+
}
|
|
5787
5932
|
else {
|
|
5788
5933
|
response = await this.contractPrivatePostLinearSwapApiV1SwapCancelall(this.extend(request, params));
|
|
5789
5934
|
}
|
|
@@ -5795,6 +5940,9 @@ export default class htx extends Exchange {
|
|
|
5795
5940
|
else if (stopLossTakeProfit) {
|
|
5796
5941
|
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossTpslCancelall(this.extend(request, params));
|
|
5797
5942
|
}
|
|
5943
|
+
else if (trailing) {
|
|
5944
|
+
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossTrackCancelall(this.extend(request, params));
|
|
5945
|
+
}
|
|
5798
5946
|
else {
|
|
5799
5947
|
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossCancelall(this.extend(request, params));
|
|
5800
5948
|
}
|
|
@@ -5808,6 +5956,9 @@ export default class htx extends Exchange {
|
|
|
5808
5956
|
else if (stopLossTakeProfit) {
|
|
5809
5957
|
response = await this.contractPrivatePostSwapApiV1SwapTpslCancelall(this.extend(request, params));
|
|
5810
5958
|
}
|
|
5959
|
+
else if (trailing) {
|
|
5960
|
+
response = await this.contractPrivatePostSwapApiV1SwapTrackCancelall(this.extend(request, params));
|
|
5961
|
+
}
|
|
5811
5962
|
else {
|
|
5812
5963
|
response = await this.contractPrivatePostSwapApiV1SwapCancelall(this.extend(request, params));
|
|
5813
5964
|
}
|
|
@@ -5819,6 +5970,9 @@ export default class htx extends Exchange {
|
|
|
5819
5970
|
else if (stopLossTakeProfit) {
|
|
5820
5971
|
response = await this.contractPrivatePostApiV1ContractTpslCancelall(this.extend(request, params));
|
|
5821
5972
|
}
|
|
5973
|
+
else if (trailing) {
|
|
5974
|
+
response = await this.contractPrivatePostApiV1ContractTrackCancelall(this.extend(request, params));
|
|
5975
|
+
}
|
|
5822
5976
|
else {
|
|
5823
5977
|
response = await this.contractPrivatePostApiV1ContractCancelall(this.extend(request, params));
|
|
5824
5978
|
}
|
package/js/src/okx.js
CHANGED
|
@@ -3906,6 +3906,7 @@ export default class okx extends Exchange {
|
|
|
3906
3906
|
* @description fetches information on multiple closed orders made by the user
|
|
3907
3907
|
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-get-order-history-last-7-days
|
|
3908
3908
|
* @see https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-get-algo-order-history
|
|
3909
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-get-order-history-last-3-months
|
|
3909
3910
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
3910
3911
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
3911
3912
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
@@ -3915,6 +3916,7 @@ export default class okx extends Exchange {
|
|
|
3915
3916
|
* @param {string} [params.algoId] Algo ID "'433845797218942976'"
|
|
3916
3917
|
* @param {int} [params.until] timestamp in ms to fetch orders for
|
|
3917
3918
|
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
3919
|
+
* @param {string} [params.method] method to be used, either 'privateGetTradeOrdersHistory', 'privateGetTradeOrdersHistoryArchive' or 'privateGetTradeOrdersAlgoHistory' default is 'privateGetTradeOrdersHistory'
|
|
3918
3920
|
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3919
3921
|
*/
|
|
3920
3922
|
await this.loadMarkets();
|
|
@@ -3977,6 +3979,9 @@ export default class okx extends Exchange {
|
|
|
3977
3979
|
if (method === 'privateGetTradeOrdersAlgoHistory') {
|
|
3978
3980
|
response = await this.privateGetTradeOrdersAlgoHistory(this.extend(request, send));
|
|
3979
3981
|
}
|
|
3982
|
+
else if (method === 'privateGetTradeOrdersHistoryArchive') {
|
|
3983
|
+
response = await this.privateGetTradeOrdersHistoryArchive(this.extend(request, send));
|
|
3984
|
+
}
|
|
3980
3985
|
else {
|
|
3981
3986
|
response = await this.privateGetTradeOrdersHistory(this.extend(request, send));
|
|
3982
3987
|
}
|
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,
|
|
@@ -1488,7 +1489,7 @@ export default class phemex extends Exchange {
|
|
|
1488
1489
|
if (type === 'spot') {
|
|
1489
1490
|
response = await this.v1GetMdSpotTicker24hrAll(query);
|
|
1490
1491
|
}
|
|
1491
|
-
else if (subType === 'inverse' || market
|
|
1492
|
+
else if (subType === 'inverse' || this.safeString(market, 'settle') === 'USD') {
|
|
1492
1493
|
response = await this.v1GetMdTicker24hrAll(query);
|
|
1493
1494
|
}
|
|
1494
1495
|
else {
|
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": {
|