cancels an open order https://doc.xt.com/#orderorderDel https://doc.xt.com/#futures_ordercancel https://doc.xt.com/#futures_entrustcancelPlan https://doc.xt.com/#futures_entrustcancelProfit :param str id: order id :param str [symbol]: unifie
(self, id: str, symbol: Str = None, params={})
| 3149 | return await self.fetch_orders_by_status('canceled', symbol, since, limit, params) |
| 3150 | |
| 3151 | async def cancel_order(self, id: str, symbol: Str = None, params={}): |
| 3152 | """ |
| 3153 | cancels an open order |
| 3154 | |
| 3155 | https://doc.xt.com/#orderorderDel |
| 3156 | https://doc.xt.com/#futures_ordercancel |
| 3157 | https://doc.xt.com/#futures_entrustcancelPlan |
| 3158 | https://doc.xt.com/#futures_entrustcancelProfit |
| 3159 | |
| 3160 | :param str id: order id |
| 3161 | :param str [symbol]: unified symbol of the market the order was made in |
| 3162 | :param dict params: extra parameters specific to the xt api endpoint |
| 3163 | :param bool [params.trigger]: if the order is a trigger order or not |
| 3164 | :param bool [params.stopLossTakeProfit]: if the order is a stop-loss or take-profit order |
| 3165 | :returns dict: An `order structure <https://docs.ccxt.com/en/latest/manual.html#order-structure>` |
| 3166 | """ |
| 3167 | await self.load_markets() |
| 3168 | market = None |
| 3169 | if symbol is not None: |
| 3170 | market = self.market(symbol) |
| 3171 | request = {} |
| 3172 | type = None |
| 3173 | subType = None |
| 3174 | response = None |
| 3175 | type, params = self.handle_market_type_and_params('cancelOrder', market, params) |
| 3176 | subType, params = self.handle_sub_type_and_params('cancelOrder', market, params) |
| 3177 | trigger = self.safe_value_2(params, 'trigger', 'stop') |
| 3178 | stopLossTakeProfit = self.safe_value(params, 'stopLossTakeProfit') |
| 3179 | if trigger: |
| 3180 | request['entrustId'] = id |
| 3181 | elif stopLossTakeProfit: |
| 3182 | request['profitId'] = id |
| 3183 | else: |
| 3184 | request['orderId'] = id |
| 3185 | if trigger: |
| 3186 | params = self.omit(params, ['trigger', 'stop']) |
| 3187 | if subType == 'inverse': |
| 3188 | response = await self.privateInversePostFutureTradeV1EntrustCancelPlan(self.extend(request, params)) |
| 3189 | else: |
| 3190 | response = await self.privateLinearPostFutureTradeV1EntrustCancelPlan(self.extend(request, params)) |
| 3191 | elif stopLossTakeProfit: |
| 3192 | params = self.omit(params, 'stopLossTakeProfit') |
| 3193 | if subType == 'inverse': |
| 3194 | response = await self.privateInversePostFutureTradeV1EntrustCancelProfitStop(self.extend(request, params)) |
| 3195 | else: |
| 3196 | response = await self.privateLinearPostFutureTradeV1EntrustCancelProfitStop(self.extend(request, params)) |
| 3197 | elif subType == 'inverse': |
| 3198 | response = await self.privateInversePostFutureTradeV1OrderCancel(self.extend(request, params)) |
| 3199 | elif (subType == 'linear') or (type == 'swap') or (type == 'future'): |
| 3200 | response = await self.privateLinearPostFutureTradeV1OrderCancel(self.extend(request, params)) |
| 3201 | else: |
| 3202 | response = await self.privateSpotDeleteOrderOrderId(self.extend(request, params)) |
| 3203 | # |
| 3204 | # spot |
| 3205 | # |
| 3206 | # { |
| 3207 | # "rc": 0, |
| 3208 | # "mc": "SUCCESS", |