From c90cfa896cbb3bc5233127b4513993669c2ad055 Mon Sep 17 00:00:00 2001 From: Matthias Date: Fri, 10 Jan 2025 07:19:57 +0100 Subject: [PATCH] test: never have more than 1 open order at a time. --- tests/freqtradebot/test_integration.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/freqtradebot/test_integration.py b/tests/freqtradebot/test_integration.py index cd4158734..9fc580753 100644 --- a/tests/freqtradebot/test_integration.py +++ b/tests/freqtradebot/test_integration.py @@ -746,6 +746,7 @@ def test_dca_handle_similar_open_order( freqtrade.strategy.ft_check_timed_out = MagicMock(return_value=False) assert len(trade.orders) == 2 + assert len(trade.open_orders) == 1 # Adjust with new amount, should cancel and replace existing order freqtrade.strategy.adjust_trade_position = MagicMock( @@ -755,6 +756,7 @@ def test_dca_handle_similar_open_order( trade = Trade.get_trades().first() assert len(trade.orders) == 3 + assert len(trade.open_orders) == 1 # Fill entry order assert freqtrade.strategy.custom_exit.call_count == 0 @@ -780,6 +782,7 @@ def test_dca_handle_similar_open_order( assert trade.orders[-1].status == "open" assert trade.orders[-1].side == trade.exit_side assert len(trade.orders) == 5 + assert len(trade.open_orders) == 1 assert freqtrade.strategy.custom_exit.call_count == 1 freqtrade.strategy.custom_exit.reset_mock() @@ -794,6 +797,7 @@ def test_dca_handle_similar_open_order( assert trade.orders[-2].status == "canceled" assert len(trade.orders) == 6 + assert len(trade.open_orders) == 1 # Adjust with new exit price, should cancel and replace existing exit order freqtrade.strategy.custom_exit_price = MagicMock(return_value=1.95) @@ -806,6 +810,7 @@ def test_dca_handle_similar_open_order( assert trade.orders[-2].status == "canceled" assert len(trade.orders) == 7 + assert len(trade.open_orders) == 1 similar_msg = r"A similar open order was found for.*" assert not log_has_re(similar_msg, caplog) @@ -817,3 +822,4 @@ def test_dca_handle_similar_open_order( assert log_has_re(similar_msg, caplog) assert len(trade.orders) == 7 + assert len(trade.open_orders) == 1