MCPcopy Create free account
hub / github.com/ccxt/ccxt / cancel_orders

Method cancel_orders

python/ccxt/binance.py:7672–7745  ·  view source on GitHub ↗

cancel multiple orders https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Cancel-Multiple-Orders https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/rest-api/Cancel-Multiple-Orders :param str[] ids: order id

(self, ids: List[str], symbol: Str = None, params={})

Source from the content-addressed store, hash-verified

7670 ]
7671
7672 def cancel_orders(self, ids: List[str], symbol: Str = None, params={}):
7673 """
7674 cancel multiple orders
7675
7676 https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Cancel-Multiple-Orders
7677 https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/rest-api/Cancel-Multiple-Orders
7678
7679 :param str[] ids: order ids
7680 :param str [symbol]: unified market symbol
7681 :param dict [params]: extra parameters specific to the exchange API endpoint
7682 :param str[] [params.clientOrderIds]: alternative to ids, array of client order ids
7683
7684 EXCHANGE SPECIFIC PARAMETERS
7685 :param str[] [params.origClientOrderIdList]: max length 10 e.g. ["my_id_1","my_id_2"], encode the double quotes. No space after comma
7686 :param int[] [params.recvWindow]:
7687 :returns dict: an list of `order structures <https://docs.ccxt.com/?id=order-structure>`
7688 """
7689 if symbol is None:
7690 raise ArgumentsRequired(self.id + ' cancelOrders() requires a symbol argument')
7691 self.load_markets()
7692 market = self.market(symbol)
7693 if not market['contract']:
7694 raise BadRequest(self.id + ' cancelOrders is only supported for swap markets.')
7695 request = {
7696 'symbol': market['id'],
7697 # 'orderidlist': ids,
7698 }
7699 origClientOrderIdList = self.safe_list_2(params, 'origClientOrderIdList', 'clientOrderIds')
7700 if origClientOrderIdList is not None:
7701 params = self.omit(params, ['clientOrderIds'])
7702 request['origClientOrderIdList'] = origClientOrderIdList
7703 else:
7704 request['orderidlist'] = ids
7705 response = None
7706 if market['linear']:
7707 response = self.fapiPrivateDeleteBatchOrders(self.extend(request, params))
7708 elif market['inverse']:
7709 response = self.dapiPrivateDeleteBatchOrders(self.extend(request, params))
7710 #
7711 # [
7712 # {
7713 # "clientOrderId": "myOrder1",
7714 # "cumQty": "0",
7715 # "cumQuote": "0",
7716 # "executedQty": "0",
7717 # "orderId": 283194212,
7718 # "origQty": "11",
7719 # "origType": "TRAILING_STOP_MARKET",
7720 # "price": "0",
7721 # "reduceOnly": False,
7722 # "side": "BUY",
7723 # "positionSide": "SHORT",
7724 # "status": "CANCELED",
7725 # "stopPrice": "9300", # please ignore when order type is TRAILING_STOP_MARKET
7726 # "closePosition": False, # if Close-All
7727 # "symbol": "BTCUSDT",
7728 # "timeInForce": "GTC",
7729 # "type": "TRAILING_STOP_MARKET",

Callers

nothing calls this directly

Calls 10

marketMethod · 0.95
ArgumentsRequiredClass · 0.90
BadRequestClass · 0.90
safe_list_2Method · 0.80
parse_ordersMethod · 0.80
load_marketsMethod · 0.45
omitMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected