mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-11-29 08:33:07 +00:00
test: update pair_detail_simplified test
parallel analysis should cover more detailed cases to prevent intra-candle parallelism
This commit is contained in:
@@ -1772,15 +1772,18 @@ def test_backtest_multi_pair_detail_simplified(
|
|||||||
if use_detail:
|
if use_detail:
|
||||||
# Backtest loop is called once per candle per pair
|
# Backtest loop is called once per candle per pair
|
||||||
# Exact numbers depend on trade state - but should be around 3_800
|
# Exact numbers depend on trade state - but should be around 3_800
|
||||||
assert bl_spy.call_count > 3_350
|
assert bl_spy.call_count > 2_250
|
||||||
assert bl_spy.call_count < 3_800
|
assert bl_spy.call_count < 2_800
|
||||||
else:
|
else:
|
||||||
assert bl_spy.call_count < 995
|
assert bl_spy.call_count < 995
|
||||||
|
|
||||||
# Make sure we have parallel trades
|
# Make sure we have parallel trades
|
||||||
assert len(evaluate_result_multi(results["results"], "1h", 2)) > 0
|
assert len(evaluate_result_multi(results["results"], "1h", 2)) > 0
|
||||||
# make sure we don't have trades with more than configured max_open_trades
|
# 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"], "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
|
# # Cached data correctly removed amounts
|
||||||
offset = 1 if tres == 0 else 0
|
offset = 1 if tres == 0 else 0
|
||||||
@@ -1800,6 +1803,8 @@ def test_backtest_multi_pair_detail_simplified(
|
|||||||
}
|
}
|
||||||
results = backtesting.backtest(**backtest_conf)
|
results = backtesting.backtest(**backtest_conf)
|
||||||
assert len(evaluate_result_multi(results["results"], "1h", 1)) == 0
|
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])
|
@pytest.mark.parametrize("use_detail", [True, False])
|
||||||
|
|||||||
Reference in New Issue
Block a user