Skip to content

Commit 1a7c523

Browse files
authored
Merge pull request #372 from coding-kitties/fix/371-ohlcv-data-windows-paths
fix: Use existing OHLCV data files and make Windows path compatible in tests/domain (#371)
2 parents 8384a07 + 2fd8b89 commit 1a7c523

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

tests/domain/backtests/test_backtest_save.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ def test_save_without_metrics(self):
8686
self.assertTrue(
8787
os.path.exists(os.path.join(backtest_run_dir, "run.json"))
8888
)
89-
self.assertTrue(
89+
# metrics.json is only created when backtest_metrics is provided
90+
self.assertFalse(
9091
os.path.exists(os.path.join(backtest_run_dir, "metrics.json"))
9192
)
9293

@@ -152,4 +153,3 @@ def test_save_with_precomputed_metrics(self):
152153
self.assertTrue(
153154
os.path.exists(os.path.join(backtest_run_dir, "metrics.json"))
154155
)
155-

tests/domain/models/backtesting/test_backtest.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ def setUp(self):
4444
)
4545
self.ohlcv_csv_path = os.path.join(
4646
self.resource_dir,
47-
"backtest_data/OHLCV_BTC-EUR_BINANCE_2h_2020-12-15-06-00_2021-01-01-00-30.csv"
47+
"test_data",
48+
"ohlcv",
49+
"OHLCV_BTC-EUR_BINANCE_2h_2023-08-07-07-08_2023-12-02-00-00.csv"
4850
)
4951

5052
# Test models
@@ -1473,4 +1475,3 @@ def test_backtest_set_uniqueness_by_metadata_id(self):
14731475
self.assertEqual(len(backtest_set2), 2)
14741476
self.assertIn(backtest4, backtest_set2)
14751477
self.assertIn(backtest5, backtest_set2)
1476-

tests/domain/utils/test_polars.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from investing_algorithm_framework import convert_polars_to_pandas
55

66
class TestConvertPandasToPolars(TestCase):
7-
7+
88
def test_convert_pandas_to_polars(self):
99
polars_df = DataFrame({
1010
"Datetime": ["2021-01-01", "2021-01-02", "2021-01-03"],
@@ -33,7 +33,7 @@ def test_convert_pandas_to_polars(self):
3333
self.assertEqual(set(column_names), {'Close'})
3434

3535
# Check if the index is a datetime object
36-
self.assertEqual(polars_df_converted.index.dtype, "datetime64[ns]")
36+
self.assertEqual(polars_df_converted.index.dtype, "datetime64[us]")
3737
self.assertEqual(
3838
polars_df_converted.index[0], Timestamp('2021-01-01 00:00:00')
3939
)

0 commit comments

Comments
 (0)