From 1fdce89806b6f638cf88146fb4bf8ca0851df7ce Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 24 Mar 2025 06:41:58 +0100 Subject: [PATCH] chore: Implement safeguard against non-existing strategy files --- freqtrade/optimize/optimize_reports/bt_storage.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/freqtrade/optimize/optimize_reports/bt_storage.py b/freqtrade/optimize/optimize_reports/bt_storage.py index 202db7c21..1e6a67e81 100644 --- a/freqtrade/optimize/optimize_reports/bt_storage.py +++ b/freqtrade/optimize/optimize_reports/bt_storage.py @@ -95,6 +95,9 @@ def store_backtest_results( # Store the strategy file and its parameters strategy_buf = BytesIO() strategy_path = Path(strategy_file) + if not strategy_path.is_file(): + logger.warning(f"Strategy file '{strategy_path}' does not exist. Skipping.") + continue with strategy_path.open("rb") as strategy_file_obj: strategy_buf.write(strategy_file_obj.read()) strategy_buf.seek(0)