fix: divergence_detector恢复hkHSI恒指(读stock_daily,修复科创50vs恒指背离信号静默)

This commit is contained in:
xxm
2026-08-26 21:42:12 +08:00
parent a819033175
commit 37d2768409
@@ -49,7 +49,8 @@ STREAK_DAYS = 3 # 连涨/连跌3天 → 信号
def fetch_indices():
"""获取所有指数数据(读 DB stock_daily 收盘价,2026-08-26 分层铁律:消费层不直连新浪API)"""
import sqlite3
# 指数代码 → 中文名(stock_daily 已有 sh000001/sz399001/sz399006/sh000688
# 指数代码 → 中文名(stock_daily 已有 sh000001/sz399001/sz399006/sh000688/hkHSI
# sh000016/sh000300/hkHSCEI 无数据则跳过——2026-08-26 补充:hkHSI 在 stock_daily 有数据,需保留恒指背离监测)
index_map = {
"sh000001": "上证指数",
"sz399001": "深证成指",
@@ -57,6 +58,7 @@ def fetch_indices():
"sh000688": "科创50",
"sh000016": "上证50",
"sh000300": "沪深300",
"hkHSI": "恒生指数",
}
indices = {}
try:
@@ -85,7 +87,7 @@ def fetch_indices():
except Exception as e:
print(f"[DIVERGE] 采集失败: {e}", file=sys.stderr)
return {}
# 港股指数 hkHSI/hkHSCEI 不在 stock_daily,读不到则不返回(中性值,由调用方跳过低检测)
# 港股指数 hkHSCEI 不在 stock_daily,读不到则不返回(中性值,由调用方跳过低检测)
return indices
def load_history():