edit a trade order https://docs.whitebit.com/private/http-trade-v4/#modify-order :param str id: cancel order id :param str symbol: unified symbol of the market to create an order in :param str type: 'market' or 'limit' :param str side: 'buy' or 'sel
(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={})
| 1968 | return self.parse_order(response) |
| 1969 | |
| 1970 | def edit_order(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}): |
| 1971 | """ |
| 1972 | edit a trade order |
| 1973 | |
| 1974 | https://docs.whitebit.com/private/http-trade-v4/#modify-order |
| 1975 | |
| 1976 | :param str id: cancel order id |
| 1977 | :param str symbol: unified symbol of the market to create an order in |
| 1978 | :param str type: 'market' or 'limit' |
| 1979 | :param str side: 'buy' or 'sell' |
| 1980 | :param float amount: how much of currency you want to trade in units of base currency |
| 1981 | :param float price: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders |
| 1982 | :param dict [params]: extra parameters specific to the exchange API endpoint |
| 1983 | :returns dict: an `order structure <https://docs.ccxt.com/?id=order-structure>` |
| 1984 | """ |
| 1985 | self.load_markets() |
| 1986 | market = self.market(symbol) |
| 1987 | request = { |
| 1988 | 'market': market['id'], |
| 1989 | } |
| 1990 | # Handle clientOrderId vs orderId(clientOrderId takes priority) |
| 1991 | clientOrderId = self.safe_string(params, 'clientOrderId') |
| 1992 | if clientOrderId is not None: |
| 1993 | request['clientOrderId'] = clientOrderId |
| 1994 | else: |
| 1995 | request['orderId'] = id |
| 1996 | # Handle amount vs total parameter based on order type and side |
| 1997 | triggerPrice = self.safe_number_n(params, ['triggerPrice', 'stopPrice', 'activationPrice']) |
| 1998 | isStopOrder = (triggerPrice is not None) |
| 1999 | # Handle activation price for stop orders |
| 2000 | if isStopOrder: |
| 2001 | request['activation_price'] = self.price_to_precision(symbol, triggerPrice) |
| 2002 | isLimitOrder = type == 'limit' |
| 2003 | total = self.safe_number(params, 'total') |
| 2004 | if total is not None: |
| 2005 | request['total'] = self.amount_to_precision(symbol, total) |
| 2006 | elif amount is not None: |
| 2007 | if isLimitOrder: |
| 2008 | # Limit orders always use amount parameter |
| 2009 | request['amount'] = self.amount_to_precision(symbol, amount) |
| 2010 | elif type == 'market' and side == 'buy': |
| 2011 | # Market buy orders use total parameter |
| 2012 | request['total'] = self.amount_to_precision(symbol, amount) |
| 2013 | else: |
| 2014 | # Market sell orders use amount parameter |
| 2015 | request['amount'] = self.amount_to_precision(symbol, amount) |
| 2016 | # Handle price parameter for limit orders |
| 2017 | if price is not None: |
| 2018 | request['price'] = self.price_to_precision(symbol, price) |
| 2019 | # Ensure at least one modifiable parameter is provided |
| 2020 | hasModifiableParam = (amount is not None) or (price is not None) or (triggerPrice is not None) or (total is not None) |
| 2021 | if not hasModifiableParam: |
| 2022 | raise ArgumentsRequired(self.id + ' editOrder() requires at least one of: amount, price, activationPrice, or total parameters') |
| 2023 | params = self.omit(params, ['clientOrderId', 'triggerPrice', 'stopPrice', 'activationPrice', 'total']) |
| 2024 | response = self.v4PrivatePostOrderModify(self.extend(request, params)) |
| 2025 | return self.parse_order(response) |
| 2026 | |
| 2027 | def cancel_order(self, id: str, symbol: Str = None, params={}): |
nothing calls this directly
no test coverage detected