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

Method cancel_order

python/ccxt/pacifica.py:1613–1649  ·  view source on GitHub ↗

cancels an open order https://docs.pacifica.fi/api-documentation/api/rest-api/orders/cancel-stop-order#response https://docs.pacifica.fi/api-documentation/api/rest-api/orders/cancel-order :param str id: order id :param str symbol: unified symbol of the mark

(self, id: str, symbol: Str = None, params={})

Source from the content-addressed store, hash-verified

1611 return request
1612
1613 def cancel_order(self, id: str, symbol: Str = None, params={}):
1614 """
1615 cancels an open order
1616
1617 https://docs.pacifica.fi/api-documentation/api/rest-api/orders/cancel-stop-order#response
1618 https://docs.pacifica.fi/api-documentation/api/rest-api/orders/cancel-order
1619
1620 :param str id: order id
1621 :param str symbol: unified symbol of the market the order was made in
1622 :param dict [params]: extra parameters specific to the exchange API endpoint
1623 :param boolean [params.stop]: necessary if self is to cancel a stop order.
1624 :param str [params.clientOrderId]: client order id,(optional uuid v4 e.g.: f47ac10b-58cc-4372-a567-0e02b2c3d479)
1625 :param int [params.expiryWindow]: time to live in milliseconds
1626 :returns dict: An `order structure <https://docs.ccxt.com/?id=order-structure>`
1627 """
1628 self.load_markets()
1629 self.initialize_client()
1630 if symbol is None:
1631 raise ArgumentsRequired(self.id + ' cancelOrder() requires a symbol argument')
1632 request = self.cancel_order_request(id, symbol, params)
1633 isStopOrder = self.safe_bool_2(params, 'trigger', 'stop', False)
1634 params = self.omit(params, ['expiryWindow', 'trigger', 'stop', 'clientOrderId'])
1635 response = None
1636 if isStopOrder:
1637 response = self.privatePostOrdersStopCancel(self.extend(request, params))
1638 else:
1639 response = self.privatePostOrdersCancel(self.extend(request, params))
1640 #
1641 # response:
1642 # {
1643 # "success": True,
1644 # "data": null
1645 # }
1646 #
1647 success = self.safe_bool(response, 'success', False)
1648 status = 'canceled' if success else 'closed'
1649 return self.safe_order({'id': id, 'status': status, 'info': response, 'symbol': symbol})
1650
1651 def cancel_order_request(self, id: Str, symbol: Str = None, params={}):
1652 market = self.market(symbol)

Callers

nothing calls this directly

Calls 11

initialize_clientMethod · 0.95
cancel_order_requestMethod · 0.95
ArgumentsRequiredClass · 0.90
safe_bool_2Method · 0.80
safe_boolMethod · 0.80
safe_orderMethod · 0.80
load_marketsMethod · 0.45
omitMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected