rename handle_timedout to handle_cancel_order
This commit is contained in:
parent
c3ef8ebb10
commit
5a7008f377
@ -355,7 +355,7 @@ class FreqtradeBot(LoggingMixin):
|
|||||||
"Order is older than 5 days. Assuming order was fully cancelled.")
|
"Order is older than 5 days. Assuming order was fully cancelled.")
|
||||||
fo = order.to_ccxt_object()
|
fo = order.to_ccxt_object()
|
||||||
fo['status'] = 'canceled'
|
fo['status'] = 'canceled'
|
||||||
self.handle_timedout_order(fo, order.trade)
|
self.handle_cancel_order(fo, order.trade)
|
||||||
|
|
||||||
except ExchangeError as e:
|
except ExchangeError as e:
|
||||||
|
|
||||||
@ -1253,11 +1253,11 @@ class FreqtradeBot(LoggingMixin):
|
|||||||
if not_closed:
|
if not_closed:
|
||||||
if fully_cancelled or (order_obj and self.strategy.ft_check_timed_out(
|
if fully_cancelled or (order_obj and self.strategy.ft_check_timed_out(
|
||||||
trade, order_obj, datetime.now(timezone.utc))):
|
trade, order_obj, datetime.now(timezone.utc))):
|
||||||
self.handle_timedout_order(order, trade)
|
self.handle_cancel_order(order, trade)
|
||||||
else:
|
else:
|
||||||
self.replace_order(order, order_obj, trade)
|
self.replace_order(order, order_obj, trade)
|
||||||
|
|
||||||
def handle_timedout_order(self, order: Dict, trade: Trade) -> None:
|
def handle_cancel_order(self, order: Dict, trade: Trade) -> None:
|
||||||
"""
|
"""
|
||||||
Check if current analyzed order timed out and cancel if necessary.
|
Check if current analyzed order timed out and cancel if necessary.
|
||||||
:param order: Order dict grabbed with exchange.fetch_order()
|
:param order: Order dict grabbed with exchange.fetch_order()
|
||||||
|
@ -5028,7 +5028,7 @@ def test_startup_update_open_orders(mocker, default_conf_usdt, fee, caplog, is_s
|
|||||||
assert log_has_re(r"Error updating Order .*", caplog)
|
assert log_has_re(r"Error updating Order .*", caplog)
|
||||||
|
|
||||||
mocker.patch('freqtrade.exchange.Exchange.fetch_order', side_effect=InvalidOrderException)
|
mocker.patch('freqtrade.exchange.Exchange.fetch_order', side_effect=InvalidOrderException)
|
||||||
hto_mock = mocker.patch('freqtrade.freqtradebot.FreqtradeBot.handle_timedout_order')
|
hto_mock = mocker.patch('freqtrade.freqtradebot.FreqtradeBot.handle_cancel_order')
|
||||||
# Orders which are no longer found after X days should be assumed as canceled.
|
# Orders which are no longer found after X days should be assumed as canceled.
|
||||||
freqtrade.startup_update_open_orders()
|
freqtrade.startup_update_open_orders()
|
||||||
assert log_has_re(r"Order is older than \d days.*", caplog)
|
assert log_has_re(r"Order is older than \d days.*", caplog)
|
||||||
|
Loading…
Reference in New Issue
Block a user