diff --git a/freqtrade/data/btanalysis.py b/freqtrade/data/btanalysis.py index 76670d0e9..7e4d02f75 100644 --- a/freqtrade/data/btanalysis.py +++ b/freqtrade/data/btanalysis.py @@ -244,9 +244,10 @@ def delete_backtest_result(file_abs: Path): """ # *.meta.json logger.info(f"Deleting backtest result file: {file_abs.name}") - file_abs_meta = file_abs.with_suffix(".meta.json") - file_abs.unlink() - file_abs_meta.unlink() + + for file in file_abs.parent.glob(f"{file_abs.stem}*"): + logger.info(f"Deleting file: {file}") + file.unlink() def update_backtest_metadata(filename: Path, strategy: str, content: dict[str, Any]): diff --git a/tests/rpc/test_rpc_apiserver.py b/tests/rpc/test_rpc_apiserver.py index 02ee6ab89..98c97ad53 100644 --- a/tests/rpc/test_rpc_apiserver.py +++ b/tests/rpc/test_rpc_apiserver.py @@ -2598,6 +2598,8 @@ def test_api_delete_backtest_history_entry(botclient, tmp_path: Path): file_path.touch() meta_path = file_path.with_suffix(".meta.json") meta_path.touch() + market_change_path = file_path.with_name(file_path.stem + "_market_change.feather") + market_change_path.touch() rc = client_delete(client, f"{BASE_URI}/backtest/history/randomFile.json") assert_response(rc, 503) @@ -2614,6 +2616,7 @@ def test_api_delete_backtest_history_entry(botclient, tmp_path: Path): assert not file_path.exists() assert not meta_path.exists() + assert not market_change_path.exists() def test_api_patch_backtest_history_entry(botclient, tmp_path: Path):