ccxt 4.4.18 → 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.
@@ -36,6 +36,7 @@ export default class kucoinfutures extends kucoin {
36
36
  'addMargin': true,
37
37
  'cancelAllOrders': true,
38
38
  'cancelOrder': true,
39
+ 'cancelOrders': true,
39
40
  'closeAllPositions': false,
40
41
  'closePosition': true,
41
42
  'closePositions': false,
@@ -207,6 +208,7 @@ export default class kucoinfutures extends kucoin {
207
208
  'stopOrders': 1,
208
209
  'sub/api-key': 1,
209
210
  'orders/client-order/{clientOid}': 1,
211
+ 'orders/multi-cancel': 20,
210
212
  },
211
213
  },
212
214
  'webExchange': {
@@ -1665,6 +1667,67 @@ export default class kucoinfutures extends kucoin {
1665
1667
  //
1666
1668
  return this.safeValue(response, 'data');
1667
1669
  }
1670
+ async cancelOrders(ids, symbol = undefined, params = {}) {
1671
+ /**
1672
+ * @method
1673
+ * @name kucoinfutures#cancelOrders
1674
+ * @description cancel multiple orders
1675
+ * @see https://www.kucoin.com/docs/rest/futures-trading/orders/batch-cancel-orders
1676
+ * @param {string[]} ids order ids
1677
+ * @param {string} symbol unified symbol of the market the order was made in
1678
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1679
+ * @param {string[]} [params.clientOrderIds] client order ids
1680
+ * @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1681
+ */
1682
+ await this.loadMarkets();
1683
+ let market = undefined;
1684
+ if (symbol !== undefined) {
1685
+ market = this.market(symbol);
1686
+ }
1687
+ const ordersRequests = [];
1688
+ const clientOrderIds = this.safeList2(params, 'clientOrderIds', 'clientOids', []);
1689
+ params = this.omit(params, ['clientOrderIds', 'clientOids']);
1690
+ let useClientorderId = false;
1691
+ for (let i = 0; i < clientOrderIds.length; i++) {
1692
+ useClientorderId = true;
1693
+ if (symbol === undefined) {
1694
+ throw new ArgumentsRequired(this.id + ' cancelOrders() requires a symbol argument when cancelling by clientOrderIds');
1695
+ }
1696
+ ordersRequests.push({
1697
+ 'symbol': market['id'],
1698
+ 'clientOid': this.safeString(clientOrderIds, i),
1699
+ });
1700
+ }
1701
+ for (let i = 0; i < ids.length; i++) {
1702
+ ordersRequests.push(ids[i]);
1703
+ }
1704
+ const requestKey = useClientorderId ? 'clientOidsList' : 'orderIdsList';
1705
+ const request = {};
1706
+ request[requestKey] = ordersRequests;
1707
+ const response = await this.futuresPrivateDeleteOrdersMultiCancel(this.extend(request, params));
1708
+ //
1709
+ // {
1710
+ // "code": "200000",
1711
+ // "data":
1712
+ // [
1713
+ // {
1714
+ // "orderId": "80465574458560512",
1715
+ // "clientOid": null,
1716
+ // "code": "200",
1717
+ // "msg": "success"
1718
+ // },
1719
+ // {
1720
+ // "orderId": "80465575289094144",
1721
+ // "clientOid": null,
1722
+ // "code": "200",
1723
+ // "msg": "success"
1724
+ // }
1725
+ // ]
1726
+ // }
1727
+ //
1728
+ const orders = this.safeList(response, 'data', []);
1729
+ return this.parseOrders(orders, market);
1730
+ }
1668
1731
  async cancelAllOrders(symbol = undefined, params = {}) {
1669
1732
  /**
1670
1733
  * @method
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt",
3
- "version": "4.4.18",
3
+ "version": "4.4.19",
4
4
  "description": "A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 100+ exchanges",
5
5
  "unpkg": "dist/ccxt.browser.min.js",
6
6
  "type": "module",