-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
40 lines (30 loc) · 1.22 KB
/
main.py
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
from datetime import datetime
from src.engine.backtest_runner import BacktestRunner, BacktestConfig
from src.strategy.strategy_factory import StrategyFactory
from src.utils.config import Config
from src.utils.cli_parser import create_cli_parser, get_backtest_config
from src.utils.logger import setup_logger
logger = setup_logger(__name__)
def main():
# Parse command line arguments
parser = create_cli_parser()
args = parser.parse_args()
# Load configuration
config = Config("config.yaml")
# Display available strategies
available_strategies = StrategyFactory.get_available_strategies()
logger.info("Available strategies:")
for name, info in available_strategies.items():
logger.info(f"- {info['name']}: {info['description']}")
# Get merged configuration
backtest_params = get_backtest_config(args, config)
# Initialize backtest runner
runner = BacktestRunner(
host=config.futu_config["host"], port=config.futu_config["port"]
)
# Create and run backtest
backtest_config = BacktestConfig(**backtest_params)
report_path = runner.run(backtest_config)
logger.info(f"Backtest report generated at: {report_path}")
if __name__ == "__main__":
main()