-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_high_low_analysis_v2.py
More file actions
126 lines (106 loc) · 4.32 KB
/
run_high_low_analysis_v2.py
File metadata and controls
126 lines (106 loc) · 4.32 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
新高新低分析器 V2 - 快速启动脚本
这是一个简化的启动脚本,提供常用的功能选项,方便用户快速使用。
"""
import os
import sys
from datetime import datetime
def print_menu():
"""显示菜单"""
print("\n" + "="*60)
print(" 新高新低股票分析器 V2.0 - 快速启动")
print("="*60)
print("1. 首次使用(重建数据库,加载90天数据)")
print("2. 日常更新(增量更新到最新)")
print("3. 强制更新最近30天数据")
print("4. 查看系统状态")
print("5. 清理老旧数据")
print("6. 自定义参数运行")
print("0. 退出")
print("="*60)
def run_command(cmd):
"""运行命令"""
print(f"\n正在执行: {cmd}")
print("-" * 50)
result = os.system(cmd)
print("-" * 50)
if result == 0:
print("✅ 执行成功")
else:
print("❌ 执行失败,请查看错误信息")
return result
def main():
"""主函数"""
# 检查主程序文件是否存在
if not os.path.exists('analyze_high_low_v2.py'):
print("❌ 错误:找不到 analyze_high_low_v2.py 文件")
print("请确保在正确的目录下运行此脚本")
return
while True:
print_menu()
try:
choice = input("\n请选择操作 (0-6): ").strip()
if choice == "0":
print("👋 再见!")
break
elif choice == "1":
print("📥 首次使用 - 重建数据库并加载90天数据")
print("⚠️ 注意:这将删除现有数据,重新开始")
confirm = input("确认继续?(y/N): ").strip().lower()
if confirm == 'y':
cmd = "python analyze_high_low_v2.py --rebuild --days 90 --verbose"
run_command(cmd)
else:
print("操作已取消")
elif choice == "2":
print("🔄 日常更新 - 增量更新到最新")
cmd = "python analyze_high_low_v2.py --verbose"
run_command(cmd)
elif choice == "3":
print("⚡ 强制更新最近30天数据")
cmd = "python analyze_high_low_v2.py --force --days 30 --verbose"
run_command(cmd)
elif choice == "4":
print("📊 查看系统状态")
cmd = "python analyze_high_low_v2.py --status"
run_command(cmd)
elif choice == "5":
print("🧹 清理老旧数据")
days = input("保留多少天的数据?(默认90天): ").strip()
if not days:
days = "90"
try:
days_int = int(days)
cmd = f"python analyze_high_low_v2.py --cleanup --keep {days_int}"
run_command(cmd)
except ValueError:
print("❌ 输入的天数无效")
elif choice == "6":
print("🛠️ 自定义参数运行")
print("常用参数示例:")
print(" --days 15 # 分析15天")
print(" --force # 强制更新")
print(" --no-plot # 不生成图表")
print(" --show-plot # 显示图表")
print(" --verbose # 详细输出")
params = input("\n请输入参数 (不包含程序名): ").strip()
if params:
cmd = f"python analyze_high_low_v2.py {params}"
run_command(cmd)
else:
print("未输入参数,取消操作")
else:
print("❌ 无效选择,请输入 0-6")
# 等待用户按键继续
if choice != "0":
input("\n按回车键继续...")
except KeyboardInterrupt:
print("\n\n👋 用户中断,再见!")
break
except Exception as e:
print(f"❌ 发生错误: {e}")
input("按回车键继续...")
if __name__ == "__main__":
main()