cancel multiple orders https://www.gate.com/docs/developers/apiv4/en/#cancel-batch-orders-by-specified-id-list https://www.gate.com/docs/developers/apiv4/en/#cancel-batch-orders-by-specified-id-list-2 :param str[] ids: order ids :param str symbol: unified s
(self, ids: List[str], symbol: Str = None, params={})
| 5437 | return self.parse_order(response, market) |
| 5438 | |
| 5439 | def cancel_orders(self, ids: List[str], symbol: Str = None, params={}): |
| 5440 | """ |
| 5441 | cancel multiple orders |
| 5442 | |
| 5443 | https://www.gate.com/docs/developers/apiv4/en/#cancel-batch-orders-by-specified-id-list |
| 5444 | https://www.gate.com/docs/developers/apiv4/en/#cancel-batch-orders-by-specified-id-list-2 |
| 5445 | |
| 5446 | :param str[] ids: order ids |
| 5447 | :param str symbol: unified symbol of the market the order was made in |
| 5448 | :param dict [params]: extra parameters specific to the exchange API endpoint |
| 5449 | :param bool [params.unifiedAccount]: set to True for canceling unified account orders |
| 5450 | :returns dict: an list of `order structures <https://docs.ccxt.com/?id=order-structure>` |
| 5451 | """ |
| 5452 | self.load_markets() |
| 5453 | self.load_unified_status() |
| 5454 | market = None |
| 5455 | if symbol is not None: |
| 5456 | market = self.market(symbol) |
| 5457 | type = None |
| 5458 | defaultSettle = 'usdt' if (market is None) else market['settle'] |
| 5459 | settle = self.safe_string_lower(params, 'settle', defaultSettle) |
| 5460 | type, params = self.handle_market_type_and_params('cancelOrders', market, params) |
| 5461 | isSpot = (type == 'spot') |
| 5462 | if isSpot and (symbol is None): |
| 5463 | raise ArgumentsRequired(self.id + ' cancelOrders requires a symbol argument for spot markets') |
| 5464 | if isSpot: |
| 5465 | ordersRequests = [] |
| 5466 | for i in range(0, len(ids)): |
| 5467 | id = ids[i] |
| 5468 | orderItem = { |
| 5469 | 'id': id, |
| 5470 | 'symbol': symbol, |
| 5471 | } |
| 5472 | ordersRequests.append(orderItem) |
| 5473 | return self.cancel_orders_for_symbols(ordersRequests, params) |
| 5474 | request = { |
| 5475 | 'settle': settle, |
| 5476 | } |
| 5477 | finalList = [request] # hacky but needs to be done here |
| 5478 | for i in range(0, len(ids)): |
| 5479 | finalList.append(ids[i]) |
| 5480 | response = self.privateFuturesPostSettleBatchCancelOrders(finalList) |
| 5481 | return self.parse_orders(response) |
| 5482 | |
| 5483 | def cancel_orders_for_symbols(self, orders: List[CancellationRequest], params={}): |
| 5484 | """ |
nothing calls this directly
no test coverage detected