cancels an order and places a new order https://doc.xt.com/#orderorderUpdate https://doc.xt.com/#futures_orderupdate https://doc.xt.com/#futures_entrustupdateProfit :param str id: order id :param str symbol: unified symbol of the market to create an
(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={})
| 4706 | return response # unify return type |
| 4707 | |
| 4708 | def edit_order(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}) -> Order: |
| 4709 | """ |
| 4710 | cancels an order and places a new order |
| 4711 | |
| 4712 | https://doc.xt.com/#orderorderUpdate |
| 4713 | https://doc.xt.com/#futures_orderupdate |
| 4714 | https://doc.xt.com/#futures_entrustupdateProfit |
| 4715 | |
| 4716 | :param str id: order id |
| 4717 | :param str symbol: unified symbol of the market to create an order in |
| 4718 | :param str type: 'market' or 'limit' |
| 4719 | :param str side: 'buy' or 'sell' |
| 4720 | :param float amount: how much of the currency you want to trade in units of the base currency |
| 4721 | :param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders |
| 4722 | :param dict [params]: extra parameters specific to the exchange API endpoint |
| 4723 | :param float [params.stopLoss]: price to set a stop-loss on an open position |
| 4724 | :param float [params.takeProfit]: price to set a take-profit on an open position |
| 4725 | :returns dict: an `order structure <https://docs.ccxt.com/?id=order-structure>` |
| 4726 | """ |
| 4727 | if amount is None: |
| 4728 | raise ArgumentsRequired(self.id + ' editOrder() requires an amount argument') |
| 4729 | self.load_markets() |
| 4730 | market = self.market(symbol) |
| 4731 | request = {} |
| 4732 | stopLoss = self.safe_number_2(params, 'stopLoss', 'triggerStopPrice') |
| 4733 | takeProfit = self.safe_number_2(params, 'takeProfit', 'triggerProfitPrice') |
| 4734 | params = self.omit(params, ['stopLoss', 'takeProfit']) |
| 4735 | isStopLoss = (stopLoss is not None) |
| 4736 | isTakeProfit = (takeProfit is not None) |
| 4737 | if isStopLoss or isTakeProfit: |
| 4738 | request['profitId'] = id |
| 4739 | else: |
| 4740 | request['orderId'] = id |
| 4741 | request['price'] = self.price_to_precision(symbol, price) |
| 4742 | response = None |
| 4743 | if market['swap']: |
| 4744 | if isStopLoss: |
| 4745 | request['triggerStopPrice'] = self.price_to_precision(symbol, stopLoss) |
| 4746 | elif takeProfit is not None: |
| 4747 | request['triggerProfitPrice'] = self.price_to_precision(symbol, takeProfit) |
| 4748 | else: |
| 4749 | request['origQty'] = self.amount_to_precision(symbol, amount) |
| 4750 | subType = None |
| 4751 | subType, params = self.handle_sub_type_and_params('editOrder', market, params) |
| 4752 | if subType == 'inverse': |
| 4753 | if isStopLoss or isTakeProfit: |
| 4754 | response = self.privateInversePostFutureTradeV1EntrustUpdateProfitStop(self.extend(request, params)) |
| 4755 | else: |
| 4756 | response = self.privateInversePostFutureTradeV1OrderUpdate(self.extend(request, params)) |
| 4757 | # |
| 4758 | # { |
| 4759 | # "returnCode": 0, |
| 4760 | # "msgInfo": "success", |
| 4761 | # "error": null, |
| 4762 | # "result": "483869474947826752" |
| 4763 | # } |
| 4764 | # |
| 4765 | else: |
nothing calls this directly
no test coverage detected