@@ -82,22 +82,23 @@ def test_save_without_algorithm(self):
8282 # Check if the report was saved correctly
8383 self .assertTrue (os .path .exists (output_path ))
8484
85- # Check if the strategy directory was created
86- strategy_dir = os .path .join (output_path , "strategies" )
87- self .assertTrue (os .path .exists (strategy_dir ))
88-
89- # Check if the strategy.py file exists within the strategy directory
90- strategy_file_path = os .path .join (strategy_dir , "strategy_one.py" )
91- self .assertTrue (os .path .exists (strategy_file_path ))
92-
93- # Check if the metrics JSON file exists
94- metrics_json_path = os .path .join (output_path , "metrics.json" )
95- self .assertTrue (os .path .exists (metrics_json_path ))
85+ # Check if the runs directory exists
86+ runs_dir = os .path .join (output_path , "runs" )
87+ self .assertTrue (os .path .exists (runs_dir ))
9688
89+ # Check if the backtest run directory exists
90+ backtest_run_dir = os .path .join (
91+ runs_dir , "backtest_EUR_20230807_20231201"
92+ )
93+ self .assertTrue (os .path .exists (backtest_run_dir ))
9794
9895 # Check if the results were saved correctly
99- self .assertTrue (os .path .exists (os .path .join (output_path , "results.json" )))
100- self .assertTrue (os .path .exists (os .path .join (output_path , "strategies" )))
96+ self .assertTrue (
97+ os .path .exists (os .path .join (backtest_run_dir , "run.json" ))
98+ )
99+ self .assertTrue (
100+ os .path .exists (os .path .join (backtest_run_dir , "metrics.json" ))
101+ )
101102
102103 def test_save_with_strategies_directory (self ):
103104 """
@@ -156,10 +157,6 @@ def test_save_with_strategies_directory(self):
156157 max_daily_drawdown = 0.05
157158 )
158159 )
159- data_files = [
160- "tests/resources/market_data_sources_for_testing/OHLCV_BTC-EUR_BINANCE_2h_2023-08-07-07-59_2023-12-02-00-00.csv" ,
161- "tests/resources/market_data_sources_for_testing/OHLCV_BTC-EUR_BINANCE_15m_2023-12-14-22-00_2023-12-25-00-00.csv" ,
162- ]
163160
164161 backtest = Backtest (
165162 algorithm_id = "alg-025" ,
@@ -169,21 +166,26 @@ def test_save_with_strategies_directory(self):
169166 output_path = os .path .join (self .resource_dir , "backtest_report" )
170167 backtest .save (output_path )
171168
169+ print (output_path )
170+
172171 # Check if the report was saved correctly
173172 self .assertTrue (os .path .exists (output_path ))
174173
175- # Check if the strategy directory was created
176- strategy_dir = os .path .join (output_path , "strategies " )
177- self .assertTrue (os .path .exists (strategy_dir ))
174+ # Check if the runs directory exists
175+ runs_dir = os .path .join (output_path , "runs " )
176+ self .assertTrue (os .path .exists (runs_dir ))
178177
179- # Check if the strategy.py file exists within the strategy directory
180- strategy_file_path = os .path .join (strategy_dir , "strategy_one.py" )
181- self .assertTrue (os .path .exists (strategy_file_path ))
182-
183- # Check if the metrics JSON file exists
184- metrics_json_path = os .path .join (output_path , "metrics.json" )
185- self .assertTrue (os .path .exists (metrics_json_path ))
178+ # Check if the backtest run directory exists
179+ backtest_run_dir = os .path .join (
180+ runs_dir , "backtest_EUR_20230807_20231201"
181+ )
182+ self .assertTrue (os .path .exists (backtest_run_dir ))
186183
187184 # Check if the results were saved correctly
188- self .assertTrue (os .path .exists (os .path .join (output_path , "results.json" )))
189- self .assertTrue (os .path .exists (os .path .join (output_path , "strategies" )))
185+ self .assertTrue (
186+ os .path .exists (os .path .join (backtest_run_dir , "run.json" ))
187+ )
188+ self .assertTrue (
189+ os .path .exists (os .path .join (backtest_run_dir , "metrics.json" ))
190+ )
191+
0 commit comments