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