-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathrunner.py
More file actions
44 lines (36 loc) · 1.31 KB
/
runner.py
File metadata and controls
44 lines (36 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import argparse
from dummy_engine import IntradayDummyEngine
def main():
parser = argparse.ArgumentParser(
description="Run the dummy backtest engine for specific dates."
)
parser.add_argument(
"--dates",
nargs="+",
help="Dates to run the backtest for (YYYY-MM-DD format). If not provided, runs for a default set of dates.",
)
parser.add_argument(
"--data",
default="/home/pi/data/q1_2025.parquet",
help="Path to the parquet data file.",
)
args = parser.parse_args()
engine = IntradayDummyEngine(args.data)
if args.dates:
dates_to_run = args.dates
else:
# Get first 3 available dates if none provided
print("No dates provided, fetching first 3 dates from database...")
dates_to_run = engine.loader.get_available_dates()
print(f"Running for: {dates_to_run}")
for date_str in dates_to_run:
# Reset engine state for each day if necessary
# Note: IntradayDummyEngine current implementation keeps cache and other state
# For a clean run per day, we might want to re-instantiate or clear state
engine.cache = {}
engine.open_positions = []
engine.logs = []
engine.run_day(date_str)
print("-" * 40)
if __name__ == "__main__":
main()