DOn't update open orders in dry-run mode
This commit is contained in:
parent
c010cdf894
commit
91f8667881
@ -246,6 +246,10 @@ class FreqtradeBot(LoggingMixin):
|
|||||||
Updates open orders based on order list kept in the database.
|
Updates open orders based on order list kept in the database.
|
||||||
Mainly updates the state of orders - but may also close trades
|
Mainly updates the state of orders - but may also close trades
|
||||||
"""
|
"""
|
||||||
|
if self.config['dry_run']:
|
||||||
|
# Updating open orders in dry-run does not make sense and will fail.
|
||||||
|
return
|
||||||
|
|
||||||
orders = Order.get_open_orders()
|
orders = Order.get_open_orders()
|
||||||
logger.info(f"Updating {len(orders)} open orders.")
|
logger.info(f"Updating {len(orders)} open orders.")
|
||||||
for order in orders:
|
for order in orders:
|
||||||
@ -256,6 +260,7 @@ class FreqtradeBot(LoggingMixin):
|
|||||||
self.update_trade_state(order.trade, order.order_id, fo)
|
self.update_trade_state(order.trade, order.order_id, fo)
|
||||||
|
|
||||||
except ExchangeError as e:
|
except ExchangeError as e:
|
||||||
|
|
||||||
logger.warning(f"Error updating Order {order.order_id} due to {e}")
|
logger.warning(f"Error updating Order {order.order_id} due to {e}")
|
||||||
|
|
||||||
def update_closed_trades_without_assigned_fees(self):
|
def update_closed_trades_without_assigned_fees(self):
|
||||||
|
@ -4313,6 +4313,11 @@ def test_update_open_orders(mocker, default_conf, fee, caplog):
|
|||||||
create_mock_trades(fee)
|
create_mock_trades(fee)
|
||||||
|
|
||||||
freqtrade.update_open_orders()
|
freqtrade.update_open_orders()
|
||||||
|
assert not log_has_re(r"Error updating Order .*", caplog)
|
||||||
|
|
||||||
|
freqtrade.config['dry_run'] = False
|
||||||
|
freqtrade.update_open_orders()
|
||||||
|
|
||||||
assert log_has_re(r"Error updating Order .*", caplog)
|
assert log_has_re(r"Error updating Order .*", caplog)
|
||||||
caplog.clear()
|
caplog.clear()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user