refactor(archive): move unused modules to archive/
Archive legacy framework and utility modules that are no longer referenced by the active core (datasource/ and rotation/): - framework/ -> archive/framework/ - framework_v2/ -> archive/framework_v2/ - strategies/ -> archive/strategies/ - config/ -> archive/config/ - visualization/ -> archive/visualization/ - scripts/ -> archive/scripts/ - tests/ -> archive/tests/ - run_rotation.py, run_us_rotation.py -> archive/single_files/ - compare_*.py, test_api_dates.py -> archive/single_files/
This commit is contained in:
49
archive/single_files/run_rotation_v1.py
Normal file
49
archive/single_files/run_rotation_v1.py
Normal file
@@ -0,0 +1,49 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
ETF轮动策略回测入口
|
||||
|
||||
用法:
|
||||
python run_rotation.py
|
||||
python run_rotation.py --config strategies/rotation/config.yaml
|
||||
python run_rotation.py --save-path results/my_rotation
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import time
|
||||
from datetime import datetime
|
||||
|
||||
from strategies.rotation.strategy import RotationStrategy
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="ETF轮动策略回测")
|
||||
parser.add_argument(
|
||||
"--config",
|
||||
type=str,
|
||||
default="strategies/rotation/config.yaml",
|
||||
help="配置文件路径",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--save-path",
|
||||
type=str,
|
||||
default="results/rotation",
|
||||
help="报告保存路径前缀",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
start_time = time.time()
|
||||
|
||||
# 从配置创建策略
|
||||
strategy = RotationStrategy.from_yaml(args.config)
|
||||
|
||||
# 运行回测
|
||||
result = strategy.run_backtest(save_path=args.save_path)
|
||||
|
||||
elapsed = time.time() - start_time
|
||||
print(f"\n总耗时: {elapsed:.1f}秒")
|
||||
|
||||
return result
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user