mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-12-14 03:41:14 +00:00
test: update bt tests for new timeout behavior
This commit is contained in:
@@ -879,6 +879,10 @@ def test_backtest_one_detail(default_conf_usdt, mocker, testdatadir, use_detail)
|
|||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
mocker.patch(f"{EXMS}.get_min_pair_stake_amount", return_value=0.00001)
|
mocker.patch(f"{EXMS}.get_min_pair_stake_amount", return_value=0.00001)
|
||||||
mocker.patch(f"{EXMS}.get_max_pair_stake_amount", return_value=float("inf"))
|
mocker.patch(f"{EXMS}.get_max_pair_stake_amount", return_value=float("inf"))
|
||||||
|
default_conf_usdt["unfilledtimeout"] = {
|
||||||
|
"entry": 11,
|
||||||
|
"exit": 30,
|
||||||
|
}
|
||||||
if use_detail:
|
if use_detail:
|
||||||
default_conf_usdt["timeframe_detail"] = "1m"
|
default_conf_usdt["timeframe_detail"] = "1m"
|
||||||
|
|
||||||
@@ -916,7 +920,7 @@ def test_backtest_one_detail(default_conf_usdt, mocker, testdatadir, use_detail)
|
|||||||
)
|
)
|
||||||
results = result["results"]
|
results = result["results"]
|
||||||
assert not results.empty
|
assert not results.empty
|
||||||
# Timeout settings from default_conf = entry: 10, exit: 30
|
# Timeout settings from = entry: 11, exit: 30
|
||||||
assert len(results) == (2 if use_detail else 3)
|
assert len(results) == (2 if use_detail else 3)
|
||||||
|
|
||||||
assert "orders" in results.columns
|
assert "orders" in results.columns
|
||||||
@@ -1800,7 +1804,7 @@ 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 2_600
|
# Exact numbers depend on trade state - but should be around 2_600
|
||||||
assert bl_spy.call_count > 2_170
|
assert bl_spy.call_count > 2_159
|
||||||
assert bl_spy.call_count < 2_800
|
assert bl_spy.call_count < 2_800
|
||||||
assert len(evaluate_result_multi(results["results"], "1h", 3)) > 0
|
assert len(evaluate_result_multi(results["results"], "1h", 3)) > 0
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user