ccxt 4.4.17 → 4.4.19

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/dist/cjs/ccxt.js CHANGED
@@ -194,7 +194,7 @@ var xt$1 = require('./src/pro/xt.js');
194
194
 
195
195
  //-----------------------------------------------------------------------------
196
196
  // this is updated by vss.js when building
197
- const version = '4.4.17';
197
+ const version = '4.4.19';
198
198
  Exchange["default"].ccxtVersion = version;
199
199
  const exchanges = {
200
200
  'ace': ace,
@@ -804,6 +804,7 @@ class binance extends binance$1 {
804
804
  'constituents': 2,
805
805
  'apiTradingStatus': { 'cost': 1, 'noSymbol': 10 },
806
806
  'lvtKlines': 1,
807
+ 'convert/exchangeInfo': 4,
807
808
  },
808
809
  },
809
810
  'fapiData': {
@@ -857,6 +858,7 @@ class binance extends binance$1 {
857
858
  'feeBurn': 1,
858
859
  'symbolConfig': 5,
859
860
  'accountConfig': 5,
861
+ 'convert/orderStatus': 5,
860
862
  },
861
863
  'post': {
862
864
  'batchOrders': 5,
@@ -872,6 +874,8 @@ class binance extends binance$1 {
872
874
  'apiReferral/customization': 1,
873
875
  'apiReferral/userCustomization': 1,
874
876
  'feeBurn': 1,
877
+ 'convert/getQuote': 200,
878
+ 'convert/acceptQuote': 20,
875
879
  },
876
880
  'put': {
877
881
  'listenKey': 1,
@@ -3199,8 +3203,8 @@ class binance extends binance$1 {
3199
3203
  let fees = this.fees;
3200
3204
  let linear = undefined;
3201
3205
  let inverse = undefined;
3202
- const strike = this.safeString(market, 'strikePrice');
3203
3206
  let symbol = base + '/' + quote;
3207
+ let strike = undefined;
3204
3208
  if (contract) {
3205
3209
  if (swap) {
3206
3210
  symbol = symbol + ':' + settle;
@@ -3209,6 +3213,7 @@ class binance extends binance$1 {
3209
3213
  symbol = symbol + ':' + settle + '-' + this.yymmdd(expiry);
3210
3214
  }
3211
3215
  else if (option) {
3216
+ strike = this.numberToString(this.parseToNumeric(this.safeString(market, 'strikePrice')));
3212
3217
  symbol = symbol + ':' + settle + '-' + this.yymmdd(expiry) + '-' + strike + '-' + this.safeString(optionParts, 3);
3213
3218
  }
3214
3219
  contractSize = this.safeNumber2(market, 'contractSize', 'unit', this.parseNumber('1'));
@@ -6282,14 +6287,28 @@ class binance extends binance$1 {
6282
6287
  request['quantity'] = this.parseToNumeric(amount);
6283
6288
  }
6284
6289
  else {
6285
- request['quantity'] = this.amountToPrecision(symbol, amount);
6290
+ const marketAmountPrecision = this.safeString(market['precision'], 'amount');
6291
+ const isPrecisionAvailable = (marketAmountPrecision !== undefined);
6292
+ if (isPrecisionAvailable) {
6293
+ request['quantity'] = this.amountToPrecision(symbol, amount);
6294
+ }
6295
+ else {
6296
+ request['quantity'] = this.parseToNumeric(amount); // some options don't have the precision available
6297
+ }
6286
6298
  }
6287
6299
  }
6288
6300
  if (priceIsRequired && !isPriceMatch) {
6289
6301
  if (price === undefined) {
6290
6302
  throw new errors.InvalidOrder(this.id + ' createOrder() requires a price argument for a ' + type + ' order');
6291
6303
  }
6292
- request['price'] = this.priceToPrecision(symbol, price);
6304
+ const pricePrecision = this.safeString(market['precision'], 'price');
6305
+ const isPricePrecisionAvailable = (pricePrecision !== undefined);
6306
+ if (isPricePrecisionAvailable) {
6307
+ request['price'] = this.priceToPrecision(symbol, price);
6308
+ }
6309
+ else {
6310
+ request['price'] = this.parseToNumeric(price); // some options don't have the precision available
6311
+ }
6293
6312
  }
6294
6313
  if (stopPriceIsRequired) {
6295
6314
  if (market['contract']) {
@@ -493,6 +493,7 @@ class bingx extends bingx$1 {
493
493
  },
494
494
  'networks': {
495
495
  'ARB': 'ARBITRUM',
496
+ 'MATIC': 'POLYGON',
496
497
  },
497
498
  },
498
499
  });
@@ -606,10 +607,11 @@ class bingx extends bingx$1 {
606
607
  'max': this.safeNumber(rawNetwork, 'withdrawMax'),
607
608
  },
608
609
  };
610
+ fee = this.safeNumber(rawNetwork, 'withdrawFee');
609
611
  if (isDefault) {
610
- fee = this.safeNumber(rawNetwork, 'withdrawFee');
611
612
  defaultLimits = limits;
612
613
  }
614
+ const precision = this.safeNumber(rawNetwork, 'withdrawPrecision');
613
615
  const networkActive = networkDepositEnabled || networkWithdrawEnabled;
614
616
  networks[networkCode] = {
615
617
  'info': rawNetwork,
@@ -619,7 +621,7 @@ class bingx extends bingx$1 {
619
621
  'active': networkActive,
620
622
  'deposit': networkDepositEnabled,
621
623
  'withdraw': networkWithdrawEnabled,
622
- 'precision': undefined,
624
+ 'precision': precision,
623
625
  'limits': limits,
624
626
  };
625
627
  }
@@ -771,7 +773,7 @@ class bingx extends bingx$1 {
771
773
  if ((this.safeString(market, 'apiStateOpen') === 'true') && (this.safeString(market, 'apiStateClose') === 'true')) {
772
774
  isActive = true; // swap active
773
775
  }
774
- else if (this.safeBool(market, 'apiStateSell') && this.safeBool(market, 'apiStateBuy') && (this.safeNumber(market, 'status') === 1)) {
776
+ else if (this.safeBool(market, 'apiStateSell') && this.safeBool(market, 'apiStateBuy') && (this.safeString(market, 'status') === '1')) {
775
777
  isActive = true; // spot active
776
778
  }
777
779
  const isInverse = (spot) ? undefined : checkIsInverse;
@@ -1423,7 +1423,7 @@ class bitget extends bitget$1 {
1423
1423
  'ARB': 'ArbitrumOne',
1424
1424
  'ZKSYNC': 'zkSyncEra',
1425
1425
  'STARKNET': 'Starknet',
1426
- 'APT': 'APTOS',
1426
+ 'APT': 'Aptos',
1427
1427
  'MATIC': 'Polygon',
1428
1428
  'VIC': 'VICTION',
1429
1429
  'AVAXC': 'C-Chain',
@@ -1294,7 +1294,7 @@ class bitmart extends bitmart$1 {
1294
1294
  'close': last,
1295
1295
  'last': last,
1296
1296
  'previousClose': undefined,
1297
- 'change': change,
1297
+ 'change': undefined,
1298
1298
  'percentage': percentage,
1299
1299
  'average': average,
1300
1300
  'baseVolume': baseVolume,
@@ -116,6 +116,12 @@ class bitso extends bitso$1 {
116
116
  'TUSD': 0.01,
117
117
  },
118
118
  'defaultPrecision': 0.00000001,
119
+ 'networks': {
120
+ 'TRC20': 'trx',
121
+ 'ERC20': 'erc20',
122
+ 'BEP20': 'bsc',
123
+ 'BEP2': 'bep2',
124
+ },
119
125
  },
120
126
  'timeframes': {
121
127
  '1m': '60',
@@ -1633,19 +1639,6 @@ class bitso extends bitso$1 {
1633
1639
  const first = this.safeDict(payload, 0);
1634
1640
  return this.parseTransaction(first, currency);
1635
1641
  }
1636
- safeNetwork(networkId) {
1637
- if (networkId === undefined) {
1638
- return undefined;
1639
- }
1640
- networkId = networkId.toUpperCase();
1641
- const networksById = {
1642
- 'trx': 'TRC20',
1643
- 'erc20': 'ERC20',
1644
- 'bsc': 'BEP20',
1645
- 'bep2': 'BEP2',
1646
- };
1647
- return this.safeString(networksById, networkId, networkId);
1648
- }
1649
1642
  parseTransaction(transaction, currency = undefined) {
1650
1643
  //
1651
1644
  // deposit
@@ -1692,12 +1685,14 @@ class bitso extends bitso$1 {
1692
1685
  const networkId = this.safeString2(transaction, 'network', 'method');
1693
1686
  const status = this.safeString(transaction, 'status');
1694
1687
  const withdrawId = this.safeString(transaction, 'wid');
1688
+ const networkCode = this.networkIdToCode(networkId);
1689
+ const networkCodeUpper = (networkCode !== undefined) ? networkCode.toUpperCase() : undefined;
1695
1690
  return {
1696
1691
  'id': this.safeString2(transaction, 'wid', 'fid'),
1697
1692
  'txid': this.safeString(details, 'tx_hash'),
1698
1693
  'timestamp': this.parse8601(datetime),
1699
1694
  'datetime': datetime,
1700
- 'network': this.safeNetwork(networkId),
1695
+ 'network': networkCodeUpper,
1701
1696
  'addressFrom': receivingAddress,
1702
1697
  'address': (withdrawalAddress !== undefined) ? withdrawalAddress : receivingAddress,
1703
1698
  'addressTo': withdrawalAddress,
@@ -3685,32 +3685,61 @@ class gate extends gate$1 {
3685
3685
  }
3686
3686
  parseTransaction(transaction, currency = undefined) {
3687
3687
  //
3688
- // deposits
3688
+ // fetchDeposits
3689
3689
  //
3690
- // {
3691
- // "id": "d33361395",
3692
- // "currency": "USDT_TRX",
3693
- // "address": "TErdnxenuLtXfnMafLbfappYdHtnXQ5U4z",
3694
- // "amount": "100",
3695
- // "txid": "ae9374de34e558562fe18cbb1bf9ab4d9eb8aa7669d65541c9fa2a532c1474a0",
3696
- // "timestamp": "1626345819",
3697
- // "status": "DONE",
3698
- // "memo": ""
3699
- // }
3690
+ // {
3691
+ // "id": "d33361395",
3692
+ // "currency": "USDT_TRX",
3693
+ // "address": "TErdnxenuLtXfnMafLbfappYdHtnXQ5U4z",
3694
+ // "amount": "100",
3695
+ // "txid": "ae9374de34e558562fe18cbb1bf9ab4d9eb8aa7669d65541c9fa2a532c1474a0",
3696
+ // "timestamp": "1626345819",
3697
+ // "status": "DONE",
3698
+ // "memo": ""
3699
+ // }
3700
3700
  //
3701
3701
  // withdraw
3702
3702
  //
3703
- // {
3704
- // "id": "w13389675",
3705
- // "currency": "USDT",
3706
- // "amount": "50",
3707
- // "address": "TUu2rLFrmzUodiWfYki7QCNtv1akL682p1",
3708
- // "memo": null
3709
- // }
3703
+ // {
3704
+ // "id":"w64413318",
3705
+ // "currency":"usdt",
3706
+ // "amount":"10150",
3707
+ // "address":"0x0ab891497116f7f5532a4c2f4f7b1784488628e1",
3708
+ // "memo":null,
3709
+ // "status":"REQUEST",
3710
+ // "chain":"eth",
3711
+ // "withdraw_order_id":"",
3712
+ // "fee_amount":"4.15000000"
3713
+ // }
3714
+ //
3715
+ // fetchWithdrawals
3716
+ //
3717
+ // {
3718
+ // "id": "210496",
3719
+ // "timestamp": "1542000000",
3720
+ // "withdraw_order_id": "order_123456",
3721
+ // "currency": "USDT",
3722
+ // "address": "1HkxtBAMrA3tP5ENnYY2CZortjZvFDH5Cs",
3723
+ // "txid": "128988928203223323290",
3724
+ // "block_number": "41575382",
3725
+ // "amount": "222.61",
3726
+ // "fee": "0.01",
3727
+ // "memo": "",
3728
+ // "status": "DONE",
3729
+ // "chain": "TRX"
3730
+ // }
3731
+ //
3732
+ // {
3733
+ // "id": "w13389675",
3734
+ // "currency": "USDT",
3735
+ // "amount": "50",
3736
+ // "address": "TUu2rLFrmzUodiWfYki7QCNtv1akL682p1",
3737
+ // "memo": null
3738
+ // }
3710
3739
  //
3711
3740
  // {
3712
3741
  // "currency":"usdt",
3713
- // "address":"0x01b0A9b7b4CdE774AF0f3E47CB4f1c2CCdBa0806",
3742
+ // "address":"0x01c0A9b7b4CdE774AF0f3E47CB4f1c2CCdBa0806",
3714
3743
  // "amount":"1880",
3715
3744
  // "chain":"eth"
3716
3745
  // }
@@ -3728,7 +3757,7 @@ class gate extends gate$1 {
3728
3757
  type = this.parseTransactionType(id[0]);
3729
3758
  }
3730
3759
  }
3731
- const feeCostString = this.safeString(transaction, 'fee');
3760
+ const feeCostString = this.safeString2(transaction, 'fee', 'fee_amount');
3732
3761
  if (type === 'withdrawal') {
3733
3762
  amountString = Precise["default"].stringSub(amountString, feeCostString);
3734
3763
  }
@@ -1235,6 +1235,18 @@ class htx extends htx$1 {
1235
1235
  });
1236
1236
  }
1237
1237
  async fetchStatus(params = {}) {
1238
+ /**
1239
+ * @method
1240
+ * @name htx#fetchStatus
1241
+ * @description the latest known information on the availability of the exchange API
1242
+ * @see https://huobiapi.github.io/docs/spot/v1/en/#get-system-status
1243
+ * @see https://huobiapi.github.io/docs/dm/v1/en/#get-system-status
1244
+ * @see https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#get-system-status
1245
+ * @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#get-system-status
1246
+ * @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#query-whether-the-system-is-available // contractPublicGetHeartbeat
1247
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1248
+ * @returns {object} a [status structure]{@link https://docs.ccxt.com/#/?id=exchange-status-structure}
1249
+ */
1238
1250
  await this.loadMarkets();
1239
1251
  let marketType = undefined;
1240
1252
  [marketType, params] = this.handleMarketTypeAndParams('fetchStatus', undefined, params);
@@ -1461,6 +1473,8 @@ class htx extends htx$1 {
1461
1473
  * @method
1462
1474
  * @name htx#fetchTime
1463
1475
  * @description fetches the current integer timestamp in milliseconds from the exchange server
1476
+ * @see https://huobiapi.github.io/docs/spot/v1/en/#get-current-timestamp
1477
+ * @see https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#get-current-system-timestamp
1464
1478
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1465
1479
  * @returns {int} the current integer timestamp in milliseconds from the exchange server
1466
1480
  */
@@ -1511,6 +1525,7 @@ class htx extends htx$1 {
1511
1525
  * @method
1512
1526
  * @name htx#fetchTradingFee
1513
1527
  * @description fetch the trading fees for a market
1528
+ * @see https://huobiapi.github.io/docs/spot/v1/en/#get-current-fee-rate-applied-to-the-user
1514
1529
  * @param {string} symbol unified market symbol
1515
1530
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1516
1531
  * @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
@@ -1556,6 +1571,15 @@ class htx extends htx$1 {
1556
1571
  return result;
1557
1572
  }
1558
1573
  async fetchTradingLimitsById(id, params = {}) {
1574
+ /**
1575
+ * @ignore
1576
+ * @method
1577
+ * @name htx#fetchTradingLimitsById
1578
+ * @see https://huobiapi.github.io/docs/spot/v1/en/#get-current-fee-rate-applied-to-the-user
1579
+ * @param {string} id market id
1580
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1581
+ * @returns {object} the limits object of a market structure
1582
+ */
1559
1583
  const request = {
1560
1584
  'symbol': id,
1561
1585
  };
@@ -6471,6 +6495,7 @@ class htx extends htx$1 {
6471
6495
  * @method
6472
6496
  * @name htx#fetchWithdrawals
6473
6497
  * @description fetch all withdrawals made from an account
6498
+ * @see https://huobiapi.github.io/docs/spot/v1/en/#search-for-existed-withdraws-and-deposits
6474
6499
  * @param {string} code unified currency code
6475
6500
  * @param {int} [since] the earliest time in ms to fetch withdrawals for
6476
6501
  * @param {int} [limit] the maximum number of withdrawals structures to retrieve
@@ -6826,6 +6851,7 @@ class htx extends htx$1 {
6826
6851
  * @method
6827
6852
  * @name htx#fetchIsolatedBorrowRates
6828
6853
  * @description fetch the borrow interest rates of all currencies
6854
+ * @see https://huobiapi.github.io/docs/spot/v1/en/#get-loan-interest-rate-and-quota-isolated
6829
6855
  * @param {object} [params] extra parameters specific to the exchange API endpoint
6830
6856
  * @returns {object} a list of [isolated borrow rate structures]{@link https://docs.ccxt.com/#/?id=isolated-borrow-rate-structure}
6831
6857
  */
@@ -7046,6 +7072,8 @@ class htx extends htx$1 {
7046
7072
  * @method
7047
7073
  * @name htx#fetchFundingRate
7048
7074
  * @description fetch the current funding rate
7075
+ * @see https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#query-funding-rate
7076
+ * @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-query-funding-rate
7049
7077
  * @param {string} symbol unified market symbol
7050
7078
  * @param {object} [params] extra parameters specific to the exchange API endpoint
7051
7079
  * @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
@@ -7088,6 +7116,8 @@ class htx extends htx$1 {
7088
7116
  * @method
7089
7117
  * @name htx#fetchFundingRates
7090
7118
  * @description fetch the funding rate for multiple markets
7119
+ * @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-query-a-batch-of-funding-rate
7120
+ * @see https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#query-a-batch-of-funding-rate
7091
7121
  * @param {string[]|undefined} symbols list of unified market symbols
7092
7122
  * @param {object} [params] extra parameters specific to the exchange API endpoint
7093
7123
  * @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rates-structure}, indexed by market symbols
@@ -1983,6 +1983,10 @@ class hyperliquid extends hyperliquid$1 {
1983
1983
  const statuses = {
1984
1984
  'triggered': 'open',
1985
1985
  'filled': 'closed',
1986
+ 'open': 'open',
1987
+ 'canceled': 'canceled',
1988
+ 'rejected': 'rejected',
1989
+ 'marginCanceled': 'canceled',
1986
1990
  };
1987
1991
  return this.safeString(statuses, status, status);
1988
1992
  }
@@ -5037,7 +5037,7 @@ class kucoin extends kucoin$1 {
5037
5037
  headers = (headers !== undefined) ? headers : {};
5038
5038
  let url = this.urls['api'][api];
5039
5039
  if (!this.isEmpty(query)) {
5040
- if ((method === 'GET') || (method === 'DELETE')) {
5040
+ if (((method === 'GET') || (method === 'DELETE')) && (path !== 'orders/multi-cancel')) {
5041
5041
  endpoint += '?' + this.rawencode(query);
5042
5042
  }
5043
5043
  else {
@@ -33,12 +33,14 @@ class kucoinfutures extends kucoinfutures$1 {
33
33
  'addMargin': true,
34
34
  'cancelAllOrders': true,
35
35
  'cancelOrder': true,
36
+ 'cancelOrders': true,
36
37
  'closeAllPositions': false,
37
38
  'closePosition': true,
38
39
  'closePositions': false,
39
40
  'createDepositAddress': true,
40
41
  'createOrder': true,
41
42
  'createOrders': true,
43
+ 'createOrderWithTakeProfitAndStopLoss': true,
42
44
  'createReduceOnlyOrder': true,
43
45
  'createStopLimitOrder': true,
44
46
  'createStopLossOrder': true,
@@ -203,6 +205,7 @@ class kucoinfutures extends kucoinfutures$1 {
203
205
  'stopOrders': 1,
204
206
  'sub/api-key': 1,
205
207
  'orders/client-order/{clientOid}': 1,
208
+ 'orders/multi-cancel': 20,
206
209
  },
207
210
  },
208
211
  'webExchange': {
@@ -241,7 +244,8 @@ class kucoinfutures extends kucoinfutures$1 {
241
244
  '404000': errors.NotSupported,
242
245
  '400100': errors.BadRequest,
243
246
  '411100': errors.AccountSuspended,
244
- '500000': errors.ExchangeNotAvailable, // Internal Server Error -- We had a problem with our server. Try again later.
247
+ '500000': errors.ExchangeNotAvailable,
248
+ '300009': errors.InvalidOrder, // {"msg":"No open positions to close.","code":"300009"}
245
249
  },
246
250
  'broad': {
247
251
  'Position does not exist': errors.OrderNotFound, // { "code":"200000", "msg":"Position does not exist" }
@@ -1422,12 +1426,15 @@ class kucoinfutures extends kucoinfutures$1 {
1422
1426
  * @name kucoinfutures#createOrder
1423
1427
  * @description Create an order on the exchange
1424
1428
  * @see https://docs.kucoin.com/futures/#place-an-order
1429
+ * @see https://www.kucoin.com/docs/rest/futures-trading/orders/place-take-profit-and-stop-loss-order#http-request
1425
1430
  * @param {string} symbol Unified CCXT market symbol
1426
1431
  * @param {string} type 'limit' or 'market'
1427
1432
  * @param {string} side 'buy' or 'sell'
1428
1433
  * @param {float} amount the amount of currency to trade
1429
1434
  * @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
1430
1435
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1436
+ * @param {object} [params.takeProfit] *takeProfit object in params* containing the triggerPrice at which the attached take profit order will be triggered
1437
+ * @param {object} [params.stopLoss] *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered
1431
1438
  * @param {float} [params.triggerPrice] The price a trigger order is triggered at
1432
1439
  * @param {float} [params.stopLossPrice] price to trigger stop-loss orders
1433
1440
  * @param {float} [params.takeProfitPrice] price to trigger take-profit orders
@@ -1449,13 +1456,19 @@ class kucoinfutures extends kucoinfutures$1 {
1449
1456
  const market = this.market(symbol);
1450
1457
  const testOrder = this.safeBool(params, 'test', false);
1451
1458
  params = this.omit(params, 'test');
1459
+ const isTpAndSlOrder = (this.safeValue(params, 'stopLoss') !== undefined) || (this.safeValue(params, 'takeProfit') !== undefined);
1452
1460
  const orderRequest = this.createContractOrderRequest(symbol, type, side, amount, price, params);
1453
1461
  let response = undefined;
1454
1462
  if (testOrder) {
1455
1463
  response = await this.futuresPrivatePostOrdersTest(orderRequest);
1456
1464
  }
1457
1465
  else {
1458
- response = await this.futuresPrivatePostOrders(orderRequest);
1466
+ if (isTpAndSlOrder) {
1467
+ response = await this.futuresPrivatePostStOrders(orderRequest);
1468
+ }
1469
+ else {
1470
+ response = await this.futuresPrivatePostOrders(orderRequest);
1471
+ }
1459
1472
  }
1460
1473
  //
1461
1474
  // {
@@ -1535,6 +1548,9 @@ class kucoinfutures extends kucoinfutures$1 {
1535
1548
  'leverage': 1,
1536
1549
  };
1537
1550
  const [triggerPrice, stopLossPrice, takeProfitPrice] = this.handleTriggerPrices(params);
1551
+ const stopLoss = this.safeDict(params, 'stopLoss');
1552
+ const takeProfit = this.safeDict(params, 'takeProfit');
1553
+ // const isTpAndSl = stopLossPrice && takeProfitPrice;
1538
1554
  const triggerPriceTypes = {
1539
1555
  'mark': 'MP',
1540
1556
  'last': 'TP',
@@ -1542,12 +1558,26 @@ class kucoinfutures extends kucoinfutures$1 {
1542
1558
  };
1543
1559
  const triggerPriceType = this.safeString(params, 'triggerPriceType', 'mark');
1544
1560
  const triggerPriceTypeValue = this.safeString(triggerPriceTypes, triggerPriceType, triggerPriceType);
1545
- params = this.omit(params, ['stopLossPrice', 'takeProfitPrice', 'triggerPrice', 'stopPrice']);
1561
+ params = this.omit(params, ['stopLossPrice', 'takeProfitPrice', 'triggerPrice', 'stopPrice', 'takeProfit', 'stopLoss']);
1546
1562
  if (triggerPrice) {
1547
1563
  request['stop'] = (side === 'buy') ? 'up' : 'down';
1548
1564
  request['stopPrice'] = this.priceToPrecision(symbol, triggerPrice);
1549
1565
  request['stopPriceType'] = triggerPriceTypeValue;
1550
1566
  }
1567
+ else if (stopLoss !== undefined || takeProfit !== undefined) {
1568
+ let priceType = triggerPriceTypeValue;
1569
+ if (stopLoss !== undefined) {
1570
+ const slPrice = this.safeString2(stopLoss, 'triggerPrice', 'stopPrice');
1571
+ request['triggerStopDownPrice'] = this.priceToPrecision(symbol, slPrice);
1572
+ priceType = this.safeString(stopLoss, 'triggerPriceType', triggerPriceTypeValue);
1573
+ }
1574
+ if (takeProfit !== undefined) {
1575
+ const tpPrice = this.safeString2(takeProfit, 'triggerPrice', 'takeProfitPrice');
1576
+ request['triggerStopUpPrice'] = this.priceToPrecision(symbol, tpPrice);
1577
+ priceType = this.safeString(stopLoss, 'triggerPriceType', triggerPriceTypeValue);
1578
+ }
1579
+ request['stopPriceType'] = priceType;
1580
+ }
1551
1581
  else if (stopLossPrice || takeProfitPrice) {
1552
1582
  if (stopLossPrice) {
1553
1583
  request['stop'] = (side === 'buy') ? 'up' : 'down';
@@ -1634,6 +1664,67 @@ class kucoinfutures extends kucoinfutures$1 {
1634
1664
  //
1635
1665
  return this.safeValue(response, 'data');
1636
1666
  }
1667
+ async cancelOrders(ids, symbol = undefined, params = {}) {
1668
+ /**
1669
+ * @method
1670
+ * @name kucoinfutures#cancelOrders
1671
+ * @description cancel multiple orders
1672
+ * @see https://www.kucoin.com/docs/rest/futures-trading/orders/batch-cancel-orders
1673
+ * @param {string[]} ids order ids
1674
+ * @param {string} symbol unified symbol of the market the order was made in
1675
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1676
+ * @param {string[]} [params.clientOrderIds] client order ids
1677
+ * @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1678
+ */
1679
+ await this.loadMarkets();
1680
+ let market = undefined;
1681
+ if (symbol !== undefined) {
1682
+ market = this.market(symbol);
1683
+ }
1684
+ const ordersRequests = [];
1685
+ const clientOrderIds = this.safeList2(params, 'clientOrderIds', 'clientOids', []);
1686
+ params = this.omit(params, ['clientOrderIds', 'clientOids']);
1687
+ let useClientorderId = false;
1688
+ for (let i = 0; i < clientOrderIds.length; i++) {
1689
+ useClientorderId = true;
1690
+ if (symbol === undefined) {
1691
+ throw new errors.ArgumentsRequired(this.id + ' cancelOrders() requires a symbol argument when cancelling by clientOrderIds');
1692
+ }
1693
+ ordersRequests.push({
1694
+ 'symbol': market['id'],
1695
+ 'clientOid': this.safeString(clientOrderIds, i),
1696
+ });
1697
+ }
1698
+ for (let i = 0; i < ids.length; i++) {
1699
+ ordersRequests.push(ids[i]);
1700
+ }
1701
+ const requestKey = useClientorderId ? 'clientOidsList' : 'orderIdsList';
1702
+ const request = {};
1703
+ request[requestKey] = ordersRequests;
1704
+ const response = await this.futuresPrivateDeleteOrdersMultiCancel(this.extend(request, params));
1705
+ //
1706
+ // {
1707
+ // "code": "200000",
1708
+ // "data":
1709
+ // [
1710
+ // {
1711
+ // "orderId": "80465574458560512",
1712
+ // "clientOid": null,
1713
+ // "code": "200",
1714
+ // "msg": "success"
1715
+ // },
1716
+ // {
1717
+ // "orderId": "80465575289094144",
1718
+ // "clientOid": null,
1719
+ // "code": "200",
1720
+ // "msg": "success"
1721
+ // }
1722
+ // ]
1723
+ // }
1724
+ //
1725
+ const orders = this.safeList(response, 'data', []);
1726
+ return this.parseOrders(orders, market);
1727
+ }
1637
1728
  async cancelAllOrders(symbol = undefined, params = {}) {
1638
1729
  /**
1639
1730
  * @method
@@ -2272,8 +2272,12 @@ class mexc extends mexc$1 {
2272
2272
  const order = this.parseOrder(response, market);
2273
2273
  order['side'] = side;
2274
2274
  order['type'] = type;
2275
- order['price'] = price;
2276
- order['amount'] = amount;
2275
+ if (this.safeString(order, 'price') === undefined) {
2276
+ order['price'] = price;
2277
+ }
2278
+ if (this.safeString(order, 'amount') === undefined) {
2279
+ order['amount'] = amount;
2280
+ }
2277
2281
  return order;
2278
2282
  }
2279
2283
  async createSwapOrder(market, type, side, amount, price = undefined, marginMode = undefined, params = {}) {
@@ -7318,6 +7318,7 @@ class okx extends okx$1 {
7318
7318
  // "instType": "OPTION",
7319
7319
  // "oi": "300",
7320
7320
  // "oiCcy": "3",
7321
+ // "oiUsd": "3",
7321
7322
  // "ts": "1684551166251"
7322
7323
  // }
7323
7324
  //
@@ -7343,7 +7344,7 @@ class okx extends okx$1 {
7343
7344
  else {
7344
7345
  baseVolume = this.safeNumber(interest, 'oiCcy');
7345
7346
  openInterestAmount = this.safeNumber(interest, 'oi');
7346
- openInterestValue = this.safeNumber(interest, 'oiCcy');
7347
+ openInterestValue = this.safeNumber(interest, 'oiUsd');
7347
7348
  }
7348
7349
  return this.safeOpenInterest({
7349
7350
  'symbol': this.safeSymbol(id),
@@ -1140,7 +1140,7 @@ class bitget extends bitget$1 {
1140
1140
  let subType = undefined;
1141
1141
  [subType, params] = this.handleSubTypeAndParams('watchOrders', market, params, 'linear');
1142
1142
  if ((type === 'spot' || type === 'margin') && (symbol === undefined)) {
1143
- throw new errors.ArgumentsRequired(this.id + ' watchOrders requires a symbol argument for ' + type + ' markets.');
1143
+ marketId = 'default';
1144
1144
  }
1145
1145
  if ((productType === undefined) && (type !== 'spot') && (symbol === undefined)) {
1146
1146
  messageHash = messageHash + ':' + subType;
@@ -1155,7 +1155,12 @@ class bitget extends bitget$1 {
1155
1155
  messageHash = messageHash + ':usdcfutures'; // non unified channel
1156
1156
  }
1157
1157
  let instType = undefined;
1158
- [instType, params] = this.getInstType(market, params);
1158
+ if (market === undefined && type === 'spot') {
1159
+ instType = 'SPOT';
1160
+ }
1161
+ else {
1162
+ [instType, params] = this.getInstType(market, params);
1163
+ }
1159
1164
  if (type === 'spot') {
1160
1165
  subscriptionHash = subscriptionHash + ':' + symbol;
1161
1166
  }
@@ -1531,8 +1536,15 @@ class bitget extends bitget$1 {
1531
1536
  symbol = market['symbol'];
1532
1537
  messageHash = messageHash + ':' + symbol;
1533
1538
  }
1539
+ let type = undefined;
1540
+ [type, params] = this.handleMarketTypeAndParams('watchMyTrades', market, params);
1534
1541
  let instType = undefined;
1535
- [instType, params] = this.getInstType(market, params);
1542
+ if (market === undefined && type === 'spot') {
1543
+ instType = 'SPOT';
1544
+ }
1545
+ else {
1546
+ [instType, params] = this.getInstType(market, params);
1547
+ }
1536
1548
  const subscriptionHash = 'fill:' + instType;
1537
1549
  const args = {
1538
1550
  'instType': instType,