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

Method cancel_orders

python/ccxt/pacifica.py:1487–1539  ·  view source on GitHub ↗

cancel multiple orders https://docs.pacifica.fi/api-documentation/api/rest-api/orders/batch-order :param str[] ids: order ids. An ids list is always required(can be empty). Both ids and clientOrderIds can be passed simultaneously. :param str [symbol]: unified marke

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

Source from the content-addressed store, hash-verified

1485 return ordersToReturn
1486
1487 def cancel_orders(self, ids: List[str], symbol: Str = None, params={}):
1488 """
1489 cancel multiple orders
1490
1491 https://docs.pacifica.fi/api-documentation/api/rest-api/orders/batch-order
1492
1493 :param str[] ids: order ids. An ids list is always required(can be empty). Both ids and clientOrderIds can be passed simultaneously.
1494 :param str [symbol]: unified market symbol
1495 :param dict [params]: extra parameters specific to the exchange API endpoint
1496 :param string|str[] [params.clientOrderIds]: client order ids,(optional uuid v4 e.g.: f47ac10b-58cc-4372-a567-0e02b2c3d479)
1497 :param int [params.expiryWindow]: time to live in milliseconds
1498 :returns dict: an list of `order structures <https://docs.ccxt.com/?id=order-structure>`
1499 """
1500 self.load_markets()
1501 self.initialize_client()
1502 if symbol is None:
1503 raise ArgumentsRequired(self.id + ' cancelOrders() requires a "symbol" argument!')
1504 request = self.cancel_orders_request(ids, symbol, params)
1505 params = self.omit(params, ['expiryWindow', 'clientOrderIds'])
1506 response = self.privatePostOrdersBatch(self.extend(request, params))
1507 #
1508 # {
1509 # "success": True,
1510 # "data": {
1511 # "results": [
1512 # {
1513 # "success": True,
1514 # "order_id": 470506,
1515 # "error": null
1516 # },
1517 # {
1518 # "success": True,
1519 # }
1520 # ]
1521 # },
1522 # "error": null,
1523 # "code": null
1524 # }
1525 #
1526 data = self.safe_dict(response, 'data', {})
1527 results = self.safe_list(data, 'results', [])
1528 ordersToReturn = []
1529 for i in range(0, len(results)):
1530 order = results[i]
1531 error = self.safe_string(order, 'error', None)
1532 success = self.safe_bool(order, 'success', False)
1533 status = None
1534 if (error is not None) or (not success):
1535 status = 'closed'
1536 else:
1537 status = 'canceled'
1538 ordersToReturn.append(self.safe_order({'info': order, 'status': status, 'symbol': symbol}))
1539 return ordersToReturn
1540
1541 def cancel_orders_request(self, ids: List[Str], symbol: Str = None, params={}):
1542 actions = []

Callers

nothing calls this directly

Calls 14

initialize_clientMethod · 0.95
cancel_orders_requestMethod · 0.95
ArgumentsRequiredClass · 0.90
safe_dictMethod · 0.80
safe_listMethod · 0.80
safe_stringMethod · 0.80
safe_boolMethod · 0.80
safe_orderMethod · 0.80
rangeFunction · 0.50
load_marketsMethod · 0.45
omitMethod · 0.45

Tested by

no test coverage detected