cancels an open order https://www.htx.com/en-us/opend/newApiPages/?id=8cb89359-77b5-11ed-9966-1958947efe6 https://www.htx.com/en-us/opend/newApiPages/?id=8cb89359-77b5-11ed-9966-19b935d4997 :param str id: order id :param str symbol: unified symbol of the ma
(self, id: str, symbol: Str = None, params={})
| 5501 | return self.parse_orders(result, market) |
| 5502 | |
| 5503 | async def cancel_order(self, id: str, symbol: Str = None, params={}): |
| 5504 | """ |
| 5505 | cancels an open order |
| 5506 | |
| 5507 | https://www.htx.com/en-us/opend/newApiPages/?id=8cb89359-77b5-11ed-9966-1958947efe6 |
| 5508 | https://www.htx.com/en-us/opend/newApiPages/?id=8cb89359-77b5-11ed-9966-19b935d4997 |
| 5509 | |
| 5510 | :param str id: order id |
| 5511 | :param str symbol: unified symbol of the market the order was made in |
| 5512 | :param dict [params]: extra parameters specific to the exchange API endpoint |
| 5513 | :param bool [params.trigger]: *contract only* if the order is a trigger trigger order or not |
| 5514 | :param bool [params.stopLossTakeProfit]: *contract only* if the order is a stop-loss or take-profit order |
| 5515 | :param bool [params.stopLoss]: *contract only* if the order is a stop-loss order |
| 5516 | :param bool [params.takeProfit]: *contract only* if the order is a take-profit order |
| 5517 | :param bool [params.trailing]: *contract only* set to True if you want to cancel a trailing order |
| 5518 | :returns dict: An `order structure <https://docs.ccxt.com/?id=order-structure>` |
| 5519 | """ |
| 5520 | await self.load_markets() |
| 5521 | market = None |
| 5522 | if symbol is not None: |
| 5523 | market = self.market(symbol) |
| 5524 | marketType = None |
| 5525 | marketType, params = self.handle_market_type_and_params('cancelOrder', market, params) |
| 5526 | subType = None |
| 5527 | subType, params = self.handle_sub_type_and_params('cancelOrder', market, params) |
| 5528 | isLinear = (subType == 'linear') |
| 5529 | request = { |
| 5530 | # spot ----------------------------------------------------------- |
| 5531 | # 'order-id': 'id', |
| 5532 | # 'symbol': market['id'], |
| 5533 | # 'client-order-id': clientOrderId, |
| 5534 | # contracts ------------------------------------------------------ |
| 5535 | # 'order_id': id, |
| 5536 | # 'client_order_id': clientOrderId, |
| 5537 | # 'contract_code': market['id'], |
| 5538 | # 'pair': 'BTC-USDT', |
| 5539 | # 'contract_type': 'this_week', # swap, self_week, next_week, quarter, next_ quarter |
| 5540 | } |
| 5541 | trigger = self.safe_bool_2(params, 'stop', 'trigger') |
| 5542 | stopLossTakeProfit = self.safe_bool_n(params, ['stopLossTakeProfit', 'stopLoss', 'takeProfit']) |
| 5543 | trailing = self.safe_bool(params, 'trailing', False) |
| 5544 | params = self.omit(params, ['stop', 'stopLossTakeProfit', 'trailing', 'trigger', 'stopLoss', 'takeProfit']) |
| 5545 | response = None |
| 5546 | if marketType == 'spot': |
| 5547 | clientOrderId = self.safe_string_2(params, 'client-order-id', 'clientOrderId') |
| 5548 | if clientOrderId is None: |
| 5549 | request['order-id'] = id |
| 5550 | response = await self.spotPrivatePostV1OrderOrdersOrderIdSubmitcancel(self.extend(request, params)) |
| 5551 | else: |
| 5552 | request['client-order-id'] = clientOrderId |
| 5553 | params = self.omit(params, ['client-order-id', 'clientOrderId']) |
| 5554 | response = await self.spotPrivatePostV1OrderOrdersSubmitCancelClientOrder(self.extend(request, params)) |
| 5555 | else: |
| 5556 | if symbol is None: |
| 5557 | raise ArgumentsRequired(self.id + ' cancelOrder() requires a symbol argument') |
| 5558 | clientOrderId = self.safe_string_n(params, ['client_order_id', 'clientOrderId', 'algo_client_order_id']) |
| 5559 | if not (isLinear and (trigger or stopLossTakeProfit or trailing)): |
| 5560 | if clientOrderId is None: |
nothing calls this directly
no test coverage detected