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

Method cancel_order

python/ccxt/async_support/delta.py:2065–2122  ·  view source on GitHub ↗

cancels an open order https://docs.delta.exchange/#cancel-order :param str id: order id :param str symbol: unified symbol of the market the order was made in :param dict [params]: extra parameters specific to the exchange API endpoint :returns dict:

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

Source from the content-addressed store, hash-verified

2063 return self.parse_order(result, market)
2064
2065 async def cancel_order(self, id: str, symbol: Str = None, params={}):
2066 """
2067 cancels an open order
2068
2069 https://docs.delta.exchange/#cancel-order
2070
2071 :param str id: order id
2072 :param str symbol: unified symbol of the market the order was made in
2073 :param dict [params]: extra parameters specific to the exchange API endpoint
2074 :returns dict: An `order structure <https://docs.ccxt.com/?id=order-structure>`
2075 """
2076 if symbol is None:
2077 raise ArgumentsRequired(self.id + ' cancelOrder() requires a symbol argument')
2078 await self.load_markets()
2079 market = self.market(symbol)
2080 request = {
2081 'id': int(id),
2082 'product_id': market['numericId'],
2083 }
2084 response = await self.privateDeleteOrders(self.extend(request, params))
2085 #
2086 # {
2087 # "result":{
2088 # "average_fill_price":null,
2089 # "bracket_order":null,
2090 # "bracket_stop_loss_limit_price":null,
2091 # "bracket_stop_loss_price":null,
2092 # "bracket_take_profit_limit_price":null,
2093 # "bracket_take_profit_price":null,
2094 # "bracket_trail_amount":null,
2095 # "cancellation_reason":"cancelled_by_user",
2096 # "client_order_id":null,
2097 # "close_on_trigger":"false",
2098 # "commission":"0",
2099 # "created_at":"2020-11-16T02:38:26Z",
2100 # "id":152870626,
2101 # "limit_price":"10000",
2102 # "meta_data":{"source":"api"},
2103 # "order_type":"limit_order",
2104 # "paid_commission":"0",
2105 # "product_id":139,
2106 # "reduce_only":false,
2107 # "side":"buy",
2108 # "size":0,
2109 # "state":"cancelled",
2110 # "stop_order_type":null,
2111 # "stop_price":null,
2112 # "stop_trigger_method":"mark_price",
2113 # "time_in_force":"gtc",
2114 # "trail_amount":null,
2115 # "unfilled_size":0,
2116 # "user_id":22142
2117 # },
2118 # "success":true
2119 # }
2120 #
2121 result = self.safe_dict(response, 'result')
2122 return self.parse_order(result, market)

Callers

nothing calls this directly

Calls 7

load_marketsMethod · 0.95
parse_orderMethod · 0.95
ArgumentsRequiredClass · 0.90
safe_dictMethod · 0.80
privateDeleteOrdersMethod · 0.65
marketMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected