From 4a6027b43f6b0f011d5dbd9ce2bc3c2e12d1a8c0 Mon Sep 17 00:00:00 2001 From: Matthias Date: Wed, 15 Jan 2025 18:15:15 +0100 Subject: [PATCH] test: update pair_detail_simplified test parallel analysis should cover more detailed cases to prevent intra-candle parallelism --- tests/optimize/test_backtesting.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/optimize/test_backtesting.py b/tests/optimize/test_backtesting.py index 81d63cf64..b34e533e4 100644 --- a/tests/optimize/test_backtesting.py +++ b/tests/optimize/test_backtesting.py @@ -1772,15 +1772,18 @@ def test_backtest_multi_pair_detail_simplified( if use_detail: # Backtest loop is called once per candle per pair # Exact numbers depend on trade state - but should be around 3_800 - assert bl_spy.call_count > 3_350 - assert bl_spy.call_count < 3_800 + assert bl_spy.call_count > 2_250 + assert bl_spy.call_count < 2_800 else: assert bl_spy.call_count < 995 # Make sure we have parallel trades assert len(evaluate_result_multi(results["results"], "1h", 2)) > 0 # make sure we don't have trades with more than configured max_open_trades + # This must evaluate on detail timeframe - as we can have entries within the candle. assert len(evaluate_result_multi(results["results"], "1h", 3)) == 0 + assert len(evaluate_result_multi(results["results"], "5m", 3)) == 0 + assert len(evaluate_result_multi(results["results"], "1m", 3)) == 0 # # Cached data correctly removed amounts offset = 1 if tres == 0 else 0 @@ -1800,6 +1803,8 @@ def test_backtest_multi_pair_detail_simplified( } results = backtesting.backtest(**backtest_conf) assert len(evaluate_result_multi(results["results"], "1h", 1)) == 0 + assert len(evaluate_result_multi(results["results"], "5m", 1)) == 0 + assert len(evaluate_result_multi(results["results"], "1m", 1)) == 0 @pytest.mark.parametrize("use_detail", [True, False])