chore: sync

This commit is contained in:
知微
2026-07-20 22:05:03 +08:00
parent 8d6082f0c2
commit 90f07b4eba
5 changed files with 187 additions and 146 deletions
+15 -7
View File
@@ -142,7 +142,7 @@ def main():
reassess_scripts.append(code)
print(f"[AUTO_REASSESS] {name}({code}) 价{cur_price:.2f}偏离买入区中心{center:.2f} {drift:+.0f}% → 触发重评")
if reassess_scripts:
# 调用 per_stock_reassess
# 调用 per_stock_reassess(每轮最多5只,防LLM慢导致整批超时;其余下轮继续)
reassess_path = None
for p in ['/home/hmo/MoFin/scripts/per_stock_reassess.py',
'/home/hmo/.hermes/profiles/position-analyst/scripts/per_stock_reassess.py']:
@@ -150,12 +150,20 @@ def main():
reassess_path = p
break
if reassess_path:
for code in reassess_scripts:
r = subprocess.run(['python3', reassess_path, code],
capture_output=True, text=True, timeout=60)
out = r.stdout.strip()[:200] if r.stdout else ""
err = r.stderr.strip()[:200] if r.stderr else ""
print(f"{code}: exited={r.returncode} {out}")
MAX_PER_RUN = 5
batch = reassess_scripts[:MAX_PER_RUN]
if len(reassess_scripts) > MAX_PER_RUN:
print(f"[AUTO_REASSESS] 本轮限{MAX_PER_RUN}只,剩余{len(reassess_scripts)-MAX_PER_RUN}只下轮继续")
for code in batch:
try:
# LLM 重评冷启动 20-100s,60s 必死(37只全灭那次的根因)→ 240s
r = subprocess.run(['python3', reassess_path, code],
capture_output=True, text=True, timeout=240)
out = r.stdout.strip()[:200] if r.stdout else ""
err = r.stderr.strip()[:200] if r.stderr else ""
print(f"{code}: exited={r.returncode} {out}")
except subprocess.TimeoutExpired:
print(f"{code}: 超时240s(LLM仍慢),下轮重试")
except Exception as e:
print(f"[AUTO_REASSESS FAIL] {e}")
# ----- 结束 自选股重评 -----
@@ -90,6 +90,14 @@ STRATEGY_QUALITY_GATES = [
"severity": "HIGH",
"fix": "设置 d['currency']='HKD'"
},
{
"id": "GATE_ZONE_SANITY",
"desc": "买入区中心不得偏离现价超过3倍(防坏行情/LLM幻觉注入异常值,如15只股被统一写成97的教训)",
"check": lambda d: (lambda p, c: p <= 0 or c <= 0 or (p >= c * 0.3 and p <= c * 3.0))(
d.get("price") or 0, ((d.get("entry_low") or 0) + (d.get("entry_high") or 0)) / 2),
"severity": "CRITICAL",
"fix": "买入区与现价偏离超3倍,疑似坏数据。用 technical_analysis 重算支撑阻力或人工修正"
},
# --- 第4条 CRITICAL 红线:9维交叉验证 (2026-07-02 Dad要求) ---
# 策略不能只有价格数字,必须有证据经过了多维分析:
# 横切面: 大盘+行业+个股 | 纵切面: 基本面+消息面+技术面+资金流