fix(prompt): 修复数据断裂——行业强度进LLM+移除死数据

- collect_data(): 从sector_snapshots读取行业涨跌/排名
- build_prompt(): 注入行业强度数据(行业涨跌%+排名)
- 移除current_regime_strategies死数据(旧策略名不匹配strategy_defs)
- 港股缺资金流(数据采集层限制,非代码问题)
This commit is contained in:
xxm
2026-08-20 16:00:33 +08:00
parent 228fefd328
commit 8c7b9a28d9
+17 -1
View File
@@ -178,6 +178,22 @@ def collect_data(code):
_db2.close()
except Exception:
pass
# 行业强度(sector_snapshots: market_watch.py 写入的板块涨跌排名)
try:
_db3 = sqlite3.connect(DB, timeout=30)
_sector = data.get("sector_context", "")
if _sector:
_ss = _db3.execute(
"SELECT change_pct, rank_in_market FROM sector_snapshots "
"WHERE sector_name LIKE ? ORDER BY date DESC LIMIT 1",
(f"%{_sector}%",)).fetchone()
if _ss:
data["sector_change_pct"] = _ss[0] if _ss[0] is not None else None
data["sector_rank"] = _ss[1] if _ss[1] is not None else None
_db3.close()
except Exception:
pass
# 情势体检:温区 + 高风险消息 + 执行红线
_sit = {"regime_a": "unknown", "regime_7d_ago": "unknown", "high_risk": "", "breach_stop": "", "reach_tp": "", "out_zone": "", "over_hold": ""}
@@ -632,7 +648,7 @@ accumulation(主力建仓) / b_td1_v3(超跌原池优选) / v_mr(弱市深超跌
大盘:{data.get('macro','震荡')}{_macro_label}
最新价:{data.get('price',0)} 涨跌:{data.get('change_pct','0')}%{_price_label}
PE={data.get('pe','?')}(最新财报) 市值={data.get('mcap','?')}亿
行业:{data.get('sector_context','?')}(近一个交易日)
行业:{data.get('sector_context','?')}(近一个交易日){_sector_extra}
技术面:{data.get('tech_snapshot','')[:300]}MA=5/10/20/60日 支撑阻力=近20日 量价=当日+近5日趋势)
{_tech_str}
{_tech_str}