feat: 历史数据获取脚本 + 离线模式支持
- 新增 fetch_history.py 获取板块历史K线数据 - 支持从数据库读取数据(离线模式) - 历史数据分析功能已可用
This commit is contained in:
@@ -844,8 +844,18 @@ def run_daily_report(to_email: str = "wlq@tphai.com", verbose: bool = False) ->
|
||||
if verbose:
|
||||
print(f" 已保存到数据库")
|
||||
else:
|
||||
print(f"❌ 获取 {board_type} 数据失败")
|
||||
boards_data[board_type] = []
|
||||
# 如果实时获取失败,尝试从数据库读取最新数据
|
||||
if verbose:
|
||||
print(f"⚠️ 实时获取失败,从数据库读取最新数据...")
|
||||
|
||||
available_dates = get_available_dates()
|
||||
if available_dates:
|
||||
latest_date = available_dates[0]
|
||||
history_data = get_history_data(board_type, 1)
|
||||
if latest_date in history_data:
|
||||
boards_data[board_type] = history_data[latest_date]
|
||||
if verbose:
|
||||
print(f"✅ 从数据库读取 {latest_date} 的 {len(history_data[latest_date])} 条数据")
|
||||
|
||||
# 生成并发送报告
|
||||
if boards_data.get('industry') or boards_data.get('concept'):
|
||||
|
||||
Reference in New Issue
Block a user