ccxt 4.4.37 → 4.4.39
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 +3 -3
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/alpaca.js +73 -2
- package/dist/cjs/src/base/Exchange.js +31 -10
- package/dist/cjs/src/binance.js +0 -2
- package/dist/cjs/src/bingx.js +93 -8
- package/dist/cjs/src/bitget.js +0 -2
- package/dist/cjs/src/bithumb.js +1 -1
- package/dist/cjs/src/bitmart.js +163 -15
- package/dist/cjs/src/bybit.js +3 -2
- package/dist/cjs/src/digifinex.js +58 -18
- package/dist/cjs/src/htx.js +154 -32
- package/dist/cjs/src/kucoin.js +77 -2
- package/dist/cjs/src/kucoinfutures.js +93 -5
- package/dist/cjs/src/mexc.js +36 -25
- package/dist/cjs/src/ndax.js +7 -2
- package/dist/cjs/src/okx.js +1 -1
- package/dist/cjs/src/pro/woo.js +1 -1
- package/dist/cjs/src/probit.js +3 -1
- package/dist/cjs/src/woo.js +4 -4
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bingx.d.ts +0 -1
- package/js/src/abstract/digifinex.d.ts +1 -0
- package/js/src/abstract/mexc.d.ts +1 -0
- package/js/src/alpaca.d.ts +11 -1
- package/js/src/alpaca.js +73 -2
- package/js/src/base/Exchange.js +31 -10
- package/js/src/binance.js +0 -2
- package/js/src/bingx.d.ts +14 -1
- package/js/src/bingx.js +93 -8
- package/js/src/bitget.js +0 -2
- package/js/src/bithumb.js +1 -1
- package/js/src/bitmart.js +163 -15
- package/js/src/bybit.js +3 -2
- package/js/src/digifinex.d.ts +4 -2
- package/js/src/digifinex.js +58 -18
- package/js/src/htx.d.ts +5 -5
- package/js/src/htx.js +154 -32
- package/js/src/kucoin.js +77 -2
- package/js/src/kucoinfutures.js +93 -5
- package/js/src/mexc.d.ts +7 -7
- package/js/src/mexc.js +36 -25
- package/js/src/ndax.d.ts +2 -0
- package/js/src/ndax.js +7 -2
- package/js/src/okx.d.ts +1 -0
- package/js/src/okx.js +1 -1
- package/js/src/pro/woo.js +1 -1
- package/js/src/probit.js +3 -1
- package/js/src/woo.js +4 -4
- package/package.json +1 -1
package/js/src/digifinex.js
CHANGED
|
@@ -214,6 +214,7 @@ export default class digifinex extends Exchange {
|
|
|
214
214
|
'trade/order_info',
|
|
215
215
|
],
|
|
216
216
|
'post': [
|
|
217
|
+
'account/transfer',
|
|
217
218
|
'account/leverage',
|
|
218
219
|
'account/position_mode',
|
|
219
220
|
'account/position_margin',
|
|
@@ -2942,12 +2943,23 @@ export default class digifinex extends Exchange {
|
|
|
2942
2943
|
}
|
|
2943
2944
|
parseTransfer(transfer, currency = undefined) {
|
|
2944
2945
|
//
|
|
2945
|
-
// transfer
|
|
2946
|
+
// transfer between spot, margin and OTC
|
|
2946
2947
|
//
|
|
2947
2948
|
// {
|
|
2948
2949
|
// "code": 0
|
|
2949
2950
|
// }
|
|
2950
2951
|
//
|
|
2952
|
+
// transfer between spot and swap
|
|
2953
|
+
//
|
|
2954
|
+
// {
|
|
2955
|
+
// "code": 0,
|
|
2956
|
+
// "data": {
|
|
2957
|
+
// "type": 2,
|
|
2958
|
+
// "currency": "USDT",
|
|
2959
|
+
// "transfer_amount": "5"
|
|
2960
|
+
// }
|
|
2961
|
+
// }
|
|
2962
|
+
//
|
|
2951
2963
|
// fetchTransfers
|
|
2952
2964
|
//
|
|
2953
2965
|
// {
|
|
@@ -2960,7 +2972,8 @@ export default class digifinex extends Exchange {
|
|
|
2960
2972
|
//
|
|
2961
2973
|
let fromAccount = undefined;
|
|
2962
2974
|
let toAccount = undefined;
|
|
2963
|
-
const
|
|
2975
|
+
const data = this.safeDict(transfer, 'data', transfer);
|
|
2976
|
+
const type = this.safeInteger(data, 'type');
|
|
2964
2977
|
if (type === 1) {
|
|
2965
2978
|
fromAccount = 'spot';
|
|
2966
2979
|
toAccount = 'swap';
|
|
@@ -2975,8 +2988,8 @@ export default class digifinex extends Exchange {
|
|
|
2975
2988
|
'id': this.safeString(transfer, 'transfer_id'),
|
|
2976
2989
|
'timestamp': timestamp,
|
|
2977
2990
|
'datetime': this.iso8601(timestamp),
|
|
2978
|
-
'currency': this.safeCurrencyCode(this.safeString(
|
|
2979
|
-
'amount': this.
|
|
2991
|
+
'currency': this.safeCurrencyCode(this.safeString(data, 'currency'), currency),
|
|
2992
|
+
'amount': this.safeNumber2(data, 'amount', 'transfer_amount'),
|
|
2980
2993
|
'fromAccount': fromAccount,
|
|
2981
2994
|
'toAccount': toAccount,
|
|
2982
2995
|
'status': this.parseTransferStatus(this.safeString(transfer, 'code')),
|
|
@@ -2986,31 +2999,58 @@ export default class digifinex extends Exchange {
|
|
|
2986
2999
|
* @method
|
|
2987
3000
|
* @name digifinex#transfer
|
|
2988
3001
|
* @description transfer currency internally between wallets on the same account
|
|
3002
|
+
* @see https://docs.digifinex.com/en-ww/spot/v3/rest.html#transfer-assets-among-accounts
|
|
3003
|
+
* @see https://docs.digifinex.com/en-ww/swap/v2/rest.html#accounttransfer
|
|
2989
3004
|
* @param {string} code unified currency code
|
|
2990
3005
|
* @param {float} amount amount to transfer
|
|
2991
|
-
* @param {string} fromAccount account to transfer from
|
|
2992
|
-
* @param {string} toAccount account to transfer to
|
|
3006
|
+
* @param {string} fromAccount 'spot', 'swap', 'margin', 'OTC' - account to transfer from
|
|
3007
|
+
* @param {string} toAccount 'spot', 'swap', 'margin', 'OTC' - account to transfer to
|
|
2993
3008
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2994
3009
|
* @returns {object} a [transfer structure]{@link https://docs.ccxt.com/#/?id=transfer-structure}
|
|
2995
3010
|
*/
|
|
2996
3011
|
async transfer(code, amount, fromAccount, toAccount, params = {}) {
|
|
2997
3012
|
await this.loadMarkets();
|
|
2998
3013
|
const currency = this.currency(code);
|
|
3014
|
+
const currencyId = currency['id'];
|
|
2999
3015
|
const accountsByType = this.safeValue(this.options, 'accountsByType', {});
|
|
3000
3016
|
const fromId = this.safeString(accountsByType, fromAccount, fromAccount);
|
|
3001
3017
|
const toId = this.safeString(accountsByType, toAccount, toAccount);
|
|
3002
|
-
const request = {
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3018
|
+
const request = {};
|
|
3019
|
+
const fromSwap = (fromAccount === 'swap');
|
|
3020
|
+
const toSwap = (toAccount === 'swap');
|
|
3021
|
+
let response = undefined;
|
|
3022
|
+
const amountString = this.currencyToPrecision(code, amount);
|
|
3023
|
+
if (fromSwap || toSwap) {
|
|
3024
|
+
if ((fromId !== '1') && (toId !== '1')) {
|
|
3025
|
+
throw new ExchangeError(this.id + ' transfer() supports transferring between spot and swap, spot and margin, spot and OTC only');
|
|
3026
|
+
}
|
|
3027
|
+
request['type'] = toSwap ? 1 : 2; // 1 = spot to swap, 2 = swap to spot
|
|
3028
|
+
request['currency'] = currencyId;
|
|
3029
|
+
request['transfer_amount'] = amountString;
|
|
3030
|
+
//
|
|
3031
|
+
// {
|
|
3032
|
+
// "code": 0,
|
|
3033
|
+
// "data": {
|
|
3034
|
+
// "type": 2,
|
|
3035
|
+
// "currency": "USDT",
|
|
3036
|
+
// "transfer_amount": "5"
|
|
3037
|
+
// }
|
|
3038
|
+
// }
|
|
3039
|
+
//
|
|
3040
|
+
response = await this.privateSwapPostAccountTransfer(this.extend(request, params));
|
|
3041
|
+
}
|
|
3042
|
+
else {
|
|
3043
|
+
request['currency_mark'] = currencyId;
|
|
3044
|
+
request['num'] = amountString;
|
|
3045
|
+
request['from'] = fromId; // 1 = SPOT, 2 = MARGIN, 3 = OTC
|
|
3046
|
+
request['to'] = toId; // 1 = SPOT, 2 = MARGIN, 3 = OTC
|
|
3047
|
+
//
|
|
3048
|
+
// {
|
|
3049
|
+
// "code": 0
|
|
3050
|
+
// }
|
|
3051
|
+
//
|
|
3052
|
+
response = await this.privateSpotPostTransfer(this.extend(request, params));
|
|
3053
|
+
}
|
|
3014
3054
|
return this.parseTransfer(response, currency);
|
|
3015
3055
|
}
|
|
3016
3056
|
/**
|
package/js/src/htx.d.ts
CHANGED
|
@@ -332,7 +332,7 @@ export default class htx extends Exchange {
|
|
|
332
332
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
333
333
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
334
334
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
335
|
-
* @param {bool} [params.
|
|
335
|
+
* @param {bool} [params.trigger] *contract only* if the orders are trigger trigger orders or not
|
|
336
336
|
* @param {bool} [params.stopLossTakeProfit] *contract only* if the orders are stop-loss or take-profit orders
|
|
337
337
|
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
338
338
|
* @param {boolean} [params.trailing] *contract only* set to true if you want to fetch trailing stop orders
|
|
@@ -369,7 +369,7 @@ export default class htx extends Exchange {
|
|
|
369
369
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
370
370
|
* @param {int} [limit] the maximum number of open order structures to retrieve
|
|
371
371
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
372
|
-
* @param {bool} [params.
|
|
372
|
+
* @param {bool} [params.trigger] *contract only* if the orders are trigger trigger orders or not
|
|
373
373
|
* @param {bool} [params.stopLossTakeProfit] *contract only* if the orders are stop-loss or take-profit orders
|
|
374
374
|
* @param {boolean} [params.trailing] *contract only* set to true if you want to fetch trailing stop orders
|
|
375
375
|
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
@@ -478,7 +478,7 @@ export default class htx extends Exchange {
|
|
|
478
478
|
* @param {string} id order id
|
|
479
479
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
480
480
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
481
|
-
* @param {boolean} [params.
|
|
481
|
+
* @param {boolean} [params.trigger] *contract only* if the order is a trigger trigger order or not
|
|
482
482
|
* @param {boolean} [params.stopLossTakeProfit] *contract only* if the order is a stop-loss or take-profit order
|
|
483
483
|
* @param {boolean} [params.trailing] *contract only* set to true if you want to cancel a trailing order
|
|
484
484
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
@@ -491,7 +491,7 @@ export default class htx extends Exchange {
|
|
|
491
491
|
* @param {string[]} ids order ids
|
|
492
492
|
* @param {string} symbol unified market symbol, default is undefined
|
|
493
493
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
494
|
-
* @param {bool} [params.
|
|
494
|
+
* @param {bool} [params.trigger] *contract only* if the orders are trigger trigger orders or not
|
|
495
495
|
* @param {bool} [params.stopLossTakeProfit] *contract only* if the orders are stop-loss or take-profit orders
|
|
496
496
|
* @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
497
497
|
*/
|
|
@@ -503,7 +503,7 @@ export default class htx extends Exchange {
|
|
|
503
503
|
* @description cancel all open orders
|
|
504
504
|
* @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
|
|
505
505
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
506
|
-
* @param {boolean} [params.
|
|
506
|
+
* @param {boolean} [params.trigger] *contract only* if the orders are trigger trigger orders or not
|
|
507
507
|
* @param {boolean} [params.stopLossTakeProfit] *contract only* if the orders are stop-loss or take-profit orders
|
|
508
508
|
* @param {boolean} [params.trailing] *contract only* set to true if you want to cancel all trailing orders
|
|
509
509
|
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
package/js/src/htx.js
CHANGED
|
@@ -1235,6 +1235,128 @@ export default class htx extends Exchange {
|
|
|
1235
1235
|
'BIFI': 'BITCOINFILE',
|
|
1236
1236
|
'FUD': 'FTX Users Debt',
|
|
1237
1237
|
},
|
|
1238
|
+
'features': {
|
|
1239
|
+
'spot': {
|
|
1240
|
+
'sandbox': true,
|
|
1241
|
+
'createOrder': {
|
|
1242
|
+
'marginMode': true,
|
|
1243
|
+
'triggerPrice': true,
|
|
1244
|
+
'triggerDirection': true,
|
|
1245
|
+
'triggerPriceType': undefined,
|
|
1246
|
+
'stopLossPrice': false,
|
|
1247
|
+
'takeProfitPrice': false,
|
|
1248
|
+
'attachedStopLossTakeProfit': undefined,
|
|
1249
|
+
'timeInForce': {
|
|
1250
|
+
'IOC': true,
|
|
1251
|
+
'FOK': true,
|
|
1252
|
+
'PO': true,
|
|
1253
|
+
'GTD': false,
|
|
1254
|
+
},
|
|
1255
|
+
'hedged': false,
|
|
1256
|
+
'trailing': false,
|
|
1257
|
+
// exchange-specific features
|
|
1258
|
+
'iceberg': false,
|
|
1259
|
+
'selfTradePrevention': true,
|
|
1260
|
+
},
|
|
1261
|
+
'createOrders': {
|
|
1262
|
+
'max': 10,
|
|
1263
|
+
},
|
|
1264
|
+
'fetchMyTrades': {
|
|
1265
|
+
'marginMode': false,
|
|
1266
|
+
'limit': 500,
|
|
1267
|
+
'daysBack': 120,
|
|
1268
|
+
'untilDays': 2,
|
|
1269
|
+
},
|
|
1270
|
+
'fetchOrder': {
|
|
1271
|
+
'marginMode': false,
|
|
1272
|
+
'trigger': false,
|
|
1273
|
+
'trailing': false,
|
|
1274
|
+
},
|
|
1275
|
+
'fetchOpenOrders': {
|
|
1276
|
+
'marginMode': false,
|
|
1277
|
+
'trigger': true,
|
|
1278
|
+
'trailing': false,
|
|
1279
|
+
'limit': 500,
|
|
1280
|
+
},
|
|
1281
|
+
'fetchOrders': {
|
|
1282
|
+
'marginMode': false,
|
|
1283
|
+
'trigger': true,
|
|
1284
|
+
'trailing': false,
|
|
1285
|
+
'limit': 500,
|
|
1286
|
+
'untilDays': 2,
|
|
1287
|
+
'daysBack': 180,
|
|
1288
|
+
},
|
|
1289
|
+
'fetchClosedOrders': {
|
|
1290
|
+
'marginMode': false,
|
|
1291
|
+
'trigger': true,
|
|
1292
|
+
'trailing': false,
|
|
1293
|
+
'untilDays': 2,
|
|
1294
|
+
'limit': 500,
|
|
1295
|
+
'daysBackClosed': 180,
|
|
1296
|
+
'daysBackCanceled': 1 / 12,
|
|
1297
|
+
},
|
|
1298
|
+
'fetchOHLCV': {
|
|
1299
|
+
'limit': 1000, // 2000 for non-historical
|
|
1300
|
+
},
|
|
1301
|
+
},
|
|
1302
|
+
'forDerivatives': {
|
|
1303
|
+
'extends': 'spot',
|
|
1304
|
+
'createOrder': {
|
|
1305
|
+
'stopLossPrice': true,
|
|
1306
|
+
'takeProfitPrice': true,
|
|
1307
|
+
'trailing': true,
|
|
1308
|
+
'hedged': true,
|
|
1309
|
+
// 'leverage': true, // todo
|
|
1310
|
+
},
|
|
1311
|
+
'createOrders': {
|
|
1312
|
+
'max': 25,
|
|
1313
|
+
},
|
|
1314
|
+
'fetchOrder': {
|
|
1315
|
+
'marginMode': true,
|
|
1316
|
+
},
|
|
1317
|
+
'fetchOpenOrders': {
|
|
1318
|
+
'marginMode': true,
|
|
1319
|
+
'trigger': false,
|
|
1320
|
+
'trailing': false,
|
|
1321
|
+
'limit': 50,
|
|
1322
|
+
},
|
|
1323
|
+
'fetchOrders': {
|
|
1324
|
+
'marginMode': true,
|
|
1325
|
+
'trigger': false,
|
|
1326
|
+
'trailing': false,
|
|
1327
|
+
'limit': 50,
|
|
1328
|
+
'daysBack': 90,
|
|
1329
|
+
},
|
|
1330
|
+
'fetchClosedOrders': {
|
|
1331
|
+
'marginMode': true,
|
|
1332
|
+
'trigger': false,
|
|
1333
|
+
'trailing': false,
|
|
1334
|
+
'untilDays': 2,
|
|
1335
|
+
'limit': 50,
|
|
1336
|
+
'daysBackClosed': 90,
|
|
1337
|
+
'daysBackCanceled': 1 / 12,
|
|
1338
|
+
},
|
|
1339
|
+
'fetchOHLCV': {
|
|
1340
|
+
'limit': 2000,
|
|
1341
|
+
},
|
|
1342
|
+
},
|
|
1343
|
+
'swap': {
|
|
1344
|
+
'linear': {
|
|
1345
|
+
'extends': 'forDerivatives',
|
|
1346
|
+
},
|
|
1347
|
+
'inverse': {
|
|
1348
|
+
'extends': 'forDerivatives',
|
|
1349
|
+
},
|
|
1350
|
+
},
|
|
1351
|
+
'future': {
|
|
1352
|
+
'linear': {
|
|
1353
|
+
'extends': 'forDerivatives',
|
|
1354
|
+
},
|
|
1355
|
+
'inverse': {
|
|
1356
|
+
'extends': 'forDerivatives',
|
|
1357
|
+
},
|
|
1358
|
+
},
|
|
1359
|
+
},
|
|
1238
1360
|
});
|
|
1239
1361
|
}
|
|
1240
1362
|
/**
|
|
@@ -4084,11 +4206,11 @@ export default class htx extends Exchange {
|
|
|
4084
4206
|
'status': '0', // support multiple query seperated by ',',such as '3,4,5', 0: all. 3. Have sumbmitted the orders; 4. Orders partially matched; 5. Orders cancelled with partially matched; 6. Orders fully matched; 7. Orders cancelled;
|
|
4085
4207
|
};
|
|
4086
4208
|
let response = undefined;
|
|
4087
|
-
const
|
|
4209
|
+
const trigger = this.safeBool2(params, 'stop', 'trigger');
|
|
4088
4210
|
const stopLossTakeProfit = this.safeValue(params, 'stopLossTakeProfit');
|
|
4089
4211
|
const trailing = this.safeBool(params, 'trailing', false);
|
|
4090
4212
|
params = this.omit(params, ['stop', 'stopLossTakeProfit', 'trailing', 'trigger']);
|
|
4091
|
-
if (
|
|
4213
|
+
if (trigger || stopLossTakeProfit || trailing) {
|
|
4092
4214
|
if (limit !== undefined) {
|
|
4093
4215
|
request['page_size'] = limit;
|
|
4094
4216
|
}
|
|
@@ -4109,7 +4231,7 @@ export default class htx extends Exchange {
|
|
|
4109
4231
|
[marginMode, params] = this.handleMarginModeAndParams('fetchContractOrders', params);
|
|
4110
4232
|
marginMode = (marginMode === undefined) ? 'cross' : marginMode;
|
|
4111
4233
|
if (marginMode === 'isolated') {
|
|
4112
|
-
if (
|
|
4234
|
+
if (trigger) {
|
|
4113
4235
|
response = await this.contractPrivatePostLinearSwapApiV1SwapTriggerHisorders(this.extend(request, params));
|
|
4114
4236
|
}
|
|
4115
4237
|
else if (stopLossTakeProfit) {
|
|
@@ -4123,7 +4245,7 @@ export default class htx extends Exchange {
|
|
|
4123
4245
|
}
|
|
4124
4246
|
}
|
|
4125
4247
|
else if (marginMode === 'cross') {
|
|
4126
|
-
if (
|
|
4248
|
+
if (trigger) {
|
|
4127
4249
|
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossTriggerHisorders(this.extend(request, params));
|
|
4128
4250
|
}
|
|
4129
4251
|
else if (stopLossTakeProfit) {
|
|
@@ -4139,7 +4261,7 @@ export default class htx extends Exchange {
|
|
|
4139
4261
|
}
|
|
4140
4262
|
else if (market['inverse']) {
|
|
4141
4263
|
if (market['swap']) {
|
|
4142
|
-
if (
|
|
4264
|
+
if (trigger) {
|
|
4143
4265
|
response = await this.contractPrivatePostSwapApiV1SwapTriggerHisorders(this.extend(request, params));
|
|
4144
4266
|
}
|
|
4145
4267
|
else if (stopLossTakeProfit) {
|
|
@@ -4154,7 +4276,7 @@ export default class htx extends Exchange {
|
|
|
4154
4276
|
}
|
|
4155
4277
|
else if (market['future']) {
|
|
4156
4278
|
request['symbol'] = market['settleId'];
|
|
4157
|
-
if (
|
|
4279
|
+
if (trigger) {
|
|
4158
4280
|
response = await this.contractPrivatePostApiV1ContractTriggerHisorders(this.extend(request, params));
|
|
4159
4281
|
}
|
|
4160
4282
|
else if (stopLossTakeProfit) {
|
|
@@ -4336,7 +4458,7 @@ export default class htx extends Exchange {
|
|
|
4336
4458
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
4337
4459
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
4338
4460
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4339
|
-
* @param {bool} [params.
|
|
4461
|
+
* @param {bool} [params.trigger] *contract only* if the orders are trigger trigger orders or not
|
|
4340
4462
|
* @param {bool} [params.stopLossTakeProfit] *contract only* if the orders are stop-loss or take-profit orders
|
|
4341
4463
|
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
4342
4464
|
* @param {boolean} [params.trailing] *contract only* set to true if you want to fetch trailing stop orders
|
|
@@ -4410,7 +4532,7 @@ export default class htx extends Exchange {
|
|
|
4410
4532
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
4411
4533
|
* @param {int} [limit] the maximum number of open order structures to retrieve
|
|
4412
4534
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4413
|
-
* @param {bool} [params.
|
|
4535
|
+
* @param {bool} [params.trigger] *contract only* if the orders are trigger trigger orders or not
|
|
4414
4536
|
* @param {bool} [params.stopLossTakeProfit] *contract only* if the orders are stop-loss or take-profit orders
|
|
4415
4537
|
* @param {boolean} [params.trailing] *contract only* set to true if you want to fetch trailing stop orders
|
|
4416
4538
|
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
@@ -4459,7 +4581,7 @@ export default class htx extends Exchange {
|
|
|
4459
4581
|
request['page_size'] = limit;
|
|
4460
4582
|
}
|
|
4461
4583
|
request['contract_code'] = market['id'];
|
|
4462
|
-
const
|
|
4584
|
+
const trigger = this.safeBool2(params, 'stop', 'trigger');
|
|
4463
4585
|
const stopLossTakeProfit = this.safeValue(params, 'stopLossTakeProfit');
|
|
4464
4586
|
const trailing = this.safeBool(params, 'trailing', false);
|
|
4465
4587
|
params = this.omit(params, ['stop', 'stopLossTakeProfit', 'trailing', 'trigger']);
|
|
@@ -4468,7 +4590,7 @@ export default class htx extends Exchange {
|
|
|
4468
4590
|
[marginMode, params] = this.handleMarginModeAndParams('fetchOpenOrders', params);
|
|
4469
4591
|
marginMode = (marginMode === undefined) ? 'cross' : marginMode;
|
|
4470
4592
|
if (marginMode === 'isolated') {
|
|
4471
|
-
if (
|
|
4593
|
+
if (trigger) {
|
|
4472
4594
|
response = await this.contractPrivatePostLinearSwapApiV1SwapTriggerOpenorders(this.extend(request, params));
|
|
4473
4595
|
}
|
|
4474
4596
|
else if (stopLossTakeProfit) {
|
|
@@ -4482,7 +4604,7 @@ export default class htx extends Exchange {
|
|
|
4482
4604
|
}
|
|
4483
4605
|
}
|
|
4484
4606
|
else if (marginMode === 'cross') {
|
|
4485
|
-
if (
|
|
4607
|
+
if (trigger) {
|
|
4486
4608
|
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossTriggerOpenorders(this.extend(request, params));
|
|
4487
4609
|
}
|
|
4488
4610
|
else if (stopLossTakeProfit) {
|
|
@@ -4498,7 +4620,7 @@ export default class htx extends Exchange {
|
|
|
4498
4620
|
}
|
|
4499
4621
|
else if (market['inverse']) {
|
|
4500
4622
|
if (market['swap']) {
|
|
4501
|
-
if (
|
|
4623
|
+
if (trigger) {
|
|
4502
4624
|
response = await this.contractPrivatePostSwapApiV1SwapTriggerOpenorders(this.extend(request, params));
|
|
4503
4625
|
}
|
|
4504
4626
|
else if (stopLossTakeProfit) {
|
|
@@ -4513,7 +4635,7 @@ export default class htx extends Exchange {
|
|
|
4513
4635
|
}
|
|
4514
4636
|
else if (market['future']) {
|
|
4515
4637
|
request['symbol'] = market['settleId'];
|
|
4516
|
-
if (
|
|
4638
|
+
if (trigger) {
|
|
4517
4639
|
response = await this.contractPrivatePostApiV1ContractTriggerOpenorders(this.extend(request, params));
|
|
4518
4640
|
}
|
|
4519
4641
|
else if (stopLossTakeProfit) {
|
|
@@ -5262,7 +5384,7 @@ export default class htx extends Exchange {
|
|
|
5262
5384
|
if (triggerPrice === undefined) {
|
|
5263
5385
|
const stopOrderTypes = this.safeValue(options, 'stopOrderTypes', {});
|
|
5264
5386
|
if (orderType in stopOrderTypes) {
|
|
5265
|
-
throw new ArgumentsRequired(this.id + ' createOrder() requires a triggerPrice for a
|
|
5387
|
+
throw new ArgumentsRequired(this.id + ' createOrder() requires a triggerPrice for a trigger order');
|
|
5266
5388
|
}
|
|
5267
5389
|
}
|
|
5268
5390
|
else {
|
|
@@ -5792,7 +5914,7 @@ export default class htx extends Exchange {
|
|
|
5792
5914
|
* @param {string} id order id
|
|
5793
5915
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
5794
5916
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5795
|
-
* @param {boolean} [params.
|
|
5917
|
+
* @param {boolean} [params.trigger] *contract only* if the order is a trigger trigger order or not
|
|
5796
5918
|
* @param {boolean} [params.stopLossTakeProfit] *contract only* if the order is a stop-loss or take-profit order
|
|
5797
5919
|
* @param {boolean} [params.trailing] *contract only* set to true if you want to cancel a trailing order
|
|
5798
5920
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
@@ -5848,7 +5970,7 @@ export default class htx extends Exchange {
|
|
|
5848
5970
|
else {
|
|
5849
5971
|
request['contract_code'] = market['id'];
|
|
5850
5972
|
}
|
|
5851
|
-
const
|
|
5973
|
+
const trigger = this.safeBool2(params, 'stop', 'trigger');
|
|
5852
5974
|
const stopLossTakeProfit = this.safeValue(params, 'stopLossTakeProfit');
|
|
5853
5975
|
const trailing = this.safeBool(params, 'trailing', false);
|
|
5854
5976
|
params = this.omit(params, ['stop', 'stopLossTakeProfit', 'trailing', 'trigger']);
|
|
@@ -5857,7 +5979,7 @@ export default class htx extends Exchange {
|
|
|
5857
5979
|
[marginMode, params] = this.handleMarginModeAndParams('cancelOrder', params);
|
|
5858
5980
|
marginMode = (marginMode === undefined) ? 'cross' : marginMode;
|
|
5859
5981
|
if (marginMode === 'isolated') {
|
|
5860
|
-
if (
|
|
5982
|
+
if (trigger) {
|
|
5861
5983
|
response = await this.contractPrivatePostLinearSwapApiV1SwapTriggerCancel(this.extend(request, params));
|
|
5862
5984
|
}
|
|
5863
5985
|
else if (stopLossTakeProfit) {
|
|
@@ -5871,7 +5993,7 @@ export default class htx extends Exchange {
|
|
|
5871
5993
|
}
|
|
5872
5994
|
}
|
|
5873
5995
|
else if (marginMode === 'cross') {
|
|
5874
|
-
if (
|
|
5996
|
+
if (trigger) {
|
|
5875
5997
|
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossTriggerCancel(this.extend(request, params));
|
|
5876
5998
|
}
|
|
5877
5999
|
else if (stopLossTakeProfit) {
|
|
@@ -5887,7 +6009,7 @@ export default class htx extends Exchange {
|
|
|
5887
6009
|
}
|
|
5888
6010
|
else if (market['inverse']) {
|
|
5889
6011
|
if (market['swap']) {
|
|
5890
|
-
if (
|
|
6012
|
+
if (trigger) {
|
|
5891
6013
|
response = await this.contractPrivatePostSwapApiV1SwapTriggerCancel(this.extend(request, params));
|
|
5892
6014
|
}
|
|
5893
6015
|
else if (stopLossTakeProfit) {
|
|
@@ -5901,7 +6023,7 @@ export default class htx extends Exchange {
|
|
|
5901
6023
|
}
|
|
5902
6024
|
}
|
|
5903
6025
|
else if (market['future']) {
|
|
5904
|
-
if (
|
|
6026
|
+
if (trigger) {
|
|
5905
6027
|
response = await this.contractPrivatePostApiV1ContractTriggerCancel(this.extend(request, params));
|
|
5906
6028
|
}
|
|
5907
6029
|
else if (stopLossTakeProfit) {
|
|
@@ -5950,7 +6072,7 @@ export default class htx extends Exchange {
|
|
|
5950
6072
|
* @param {string[]} ids order ids
|
|
5951
6073
|
* @param {string} symbol unified market symbol, default is undefined
|
|
5952
6074
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5953
|
-
* @param {bool} [params.
|
|
6075
|
+
* @param {bool} [params.trigger] *contract only* if the orders are trigger trigger orders or not
|
|
5954
6076
|
* @param {bool} [params.stopLossTakeProfit] *contract only* if the orders are stop-loss or take-profit orders
|
|
5955
6077
|
* @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
5956
6078
|
*/
|
|
@@ -6014,7 +6136,7 @@ export default class htx extends Exchange {
|
|
|
6014
6136
|
else {
|
|
6015
6137
|
request['contract_code'] = market['id'];
|
|
6016
6138
|
}
|
|
6017
|
-
const
|
|
6139
|
+
const trigger = this.safeBool2(params, 'stop', 'trigger');
|
|
6018
6140
|
const stopLossTakeProfit = this.safeValue(params, 'stopLossTakeProfit');
|
|
6019
6141
|
params = this.omit(params, ['stop', 'stopLossTakeProfit', 'trigger']);
|
|
6020
6142
|
if (market['linear']) {
|
|
@@ -6022,7 +6144,7 @@ export default class htx extends Exchange {
|
|
|
6022
6144
|
[marginMode, params] = this.handleMarginModeAndParams('cancelOrders', params);
|
|
6023
6145
|
marginMode = (marginMode === undefined) ? 'cross' : marginMode;
|
|
6024
6146
|
if (marginMode === 'isolated') {
|
|
6025
|
-
if (
|
|
6147
|
+
if (trigger) {
|
|
6026
6148
|
response = await this.contractPrivatePostLinearSwapApiV1SwapTriggerCancel(this.extend(request, params));
|
|
6027
6149
|
}
|
|
6028
6150
|
else if (stopLossTakeProfit) {
|
|
@@ -6033,7 +6155,7 @@ export default class htx extends Exchange {
|
|
|
6033
6155
|
}
|
|
6034
6156
|
}
|
|
6035
6157
|
else if (marginMode === 'cross') {
|
|
6036
|
-
if (
|
|
6158
|
+
if (trigger) {
|
|
6037
6159
|
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossTriggerCancel(this.extend(request, params));
|
|
6038
6160
|
}
|
|
6039
6161
|
else if (stopLossTakeProfit) {
|
|
@@ -6046,7 +6168,7 @@ export default class htx extends Exchange {
|
|
|
6046
6168
|
}
|
|
6047
6169
|
else if (market['inverse']) {
|
|
6048
6170
|
if (market['swap']) {
|
|
6049
|
-
if (
|
|
6171
|
+
if (trigger) {
|
|
6050
6172
|
response = await this.contractPrivatePostSwapApiV1SwapTriggerCancel(this.extend(request, params));
|
|
6051
6173
|
}
|
|
6052
6174
|
else if (stopLossTakeProfit) {
|
|
@@ -6057,7 +6179,7 @@ export default class htx extends Exchange {
|
|
|
6057
6179
|
}
|
|
6058
6180
|
}
|
|
6059
6181
|
else if (market['future']) {
|
|
6060
|
-
if (
|
|
6182
|
+
if (trigger) {
|
|
6061
6183
|
response = await this.contractPrivatePostApiV1ContractTriggerCancel(this.extend(request, params));
|
|
6062
6184
|
}
|
|
6063
6185
|
else if (stopLossTakeProfit) {
|
|
@@ -6190,7 +6312,7 @@ export default class htx extends Exchange {
|
|
|
6190
6312
|
* @description cancel all open orders
|
|
6191
6313
|
* @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
|
|
6192
6314
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6193
|
-
* @param {boolean} [params.
|
|
6315
|
+
* @param {boolean} [params.trigger] *contract only* if the orders are trigger trigger orders or not
|
|
6194
6316
|
* @param {boolean} [params.stopLossTakeProfit] *contract only* if the orders are stop-loss or take-profit orders
|
|
6195
6317
|
* @param {boolean} [params.trailing] *contract only* set to true if you want to cancel all trailing orders
|
|
6196
6318
|
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
@@ -6248,7 +6370,7 @@ export default class htx extends Exchange {
|
|
|
6248
6370
|
request['symbol'] = market['settleId'];
|
|
6249
6371
|
}
|
|
6250
6372
|
request['contract_code'] = market['id'];
|
|
6251
|
-
const
|
|
6373
|
+
const trigger = this.safeBool2(params, 'stop', 'trigger');
|
|
6252
6374
|
const stopLossTakeProfit = this.safeValue(params, 'stopLossTakeProfit');
|
|
6253
6375
|
const trailing = this.safeBool(params, 'trailing', false);
|
|
6254
6376
|
params = this.omit(params, ['stop', 'stopLossTakeProfit', 'trailing', 'trigger']);
|
|
@@ -6257,7 +6379,7 @@ export default class htx extends Exchange {
|
|
|
6257
6379
|
[marginMode, params] = this.handleMarginModeAndParams('cancelAllOrders', params);
|
|
6258
6380
|
marginMode = (marginMode === undefined) ? 'cross' : marginMode;
|
|
6259
6381
|
if (marginMode === 'isolated') {
|
|
6260
|
-
if (
|
|
6382
|
+
if (trigger) {
|
|
6261
6383
|
response = await this.contractPrivatePostLinearSwapApiV1SwapTriggerCancelall(this.extend(request, params));
|
|
6262
6384
|
}
|
|
6263
6385
|
else if (stopLossTakeProfit) {
|
|
@@ -6271,7 +6393,7 @@ export default class htx extends Exchange {
|
|
|
6271
6393
|
}
|
|
6272
6394
|
}
|
|
6273
6395
|
else if (marginMode === 'cross') {
|
|
6274
|
-
if (
|
|
6396
|
+
if (trigger) {
|
|
6275
6397
|
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossTriggerCancelall(this.extend(request, params));
|
|
6276
6398
|
}
|
|
6277
6399
|
else if (stopLossTakeProfit) {
|
|
@@ -6287,7 +6409,7 @@ export default class htx extends Exchange {
|
|
|
6287
6409
|
}
|
|
6288
6410
|
else if (market['inverse']) {
|
|
6289
6411
|
if (market['swap']) {
|
|
6290
|
-
if (
|
|
6412
|
+
if (trigger) {
|
|
6291
6413
|
response = await this.contractPrivatePostSwapApiV1SwapTriggerCancelall(this.extend(request, params));
|
|
6292
6414
|
}
|
|
6293
6415
|
else if (stopLossTakeProfit) {
|
|
@@ -6301,7 +6423,7 @@ export default class htx extends Exchange {
|
|
|
6301
6423
|
}
|
|
6302
6424
|
}
|
|
6303
6425
|
else if (market['future']) {
|
|
6304
|
-
if (
|
|
6426
|
+
if (trigger) {
|
|
6305
6427
|
response = await this.contractPrivatePostApiV1ContractTriggerCancelall(this.extend(request, params));
|
|
6306
6428
|
}
|
|
6307
6429
|
else if (stopLossTakeProfit) {
|