cancels an open order https://www.bitmex.com/api/explorer/#not /Order/Order_cancel :param str id: order id :param str symbol: not used by bitmex cancelOrder() :param dict [params]: extra parameters specific to the exchange API endpoint :returns dict
(self, id: str, symbol: Str = None, params={})
| 2143 | return self.parse_order(response) |
| 2144 | |
| 2145 | async def cancel_order(self, id: str, symbol: Str = None, params={}): |
| 2146 | """ |
| 2147 | cancels an open order |
| 2148 | |
| 2149 | https://www.bitmex.com/api/explorer/#not /Order/Order_cancel |
| 2150 | |
| 2151 | :param str id: order id |
| 2152 | :param str symbol: not used by bitmex cancelOrder() |
| 2153 | :param dict [params]: extra parameters specific to the exchange API endpoint |
| 2154 | :returns dict: An `order structure <https://docs.ccxt.com/?id=order-structure>` |
| 2155 | """ |
| 2156 | await self.load_markets() |
| 2157 | # https://github.com/ccxt/ccxt/issues/6507 |
| 2158 | clientOrderId = self.safe_value_2(params, 'clOrdID', 'clientOrderId') |
| 2159 | request = {} |
| 2160 | if clientOrderId is None: |
| 2161 | request['orderID'] = id |
| 2162 | else: |
| 2163 | request['clOrdID'] = clientOrderId |
| 2164 | params = self.omit(params, ['clOrdID', 'clientOrderId']) |
| 2165 | response = await self.privateDeleteOrder(self.extend(request, params)) |
| 2166 | order = self.safe_value(response, 0, {}) |
| 2167 | error = self.safe_string(order, 'error') |
| 2168 | if error is not None: |
| 2169 | if error.find('Unable to cancel order due to existing state') >= 0: |
| 2170 | raise OrderNotFound(self.id + ' cancelOrder() failed: ' + error) |
| 2171 | return self.parse_order(order) |
| 2172 | |
| 2173 | async def cancel_orders(self, ids: List[str], symbol: Str = None, params={}): |
| 2174 | """ |
nothing calls this directly
no test coverage detected