From 823931860fbc3007167920bf17b90bbdaeb3dcce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9F=A5=E5=BE=AE?= Date: Thu, 9 Jul 2026 19:58:36 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=96=B0=E5=85=A5=E8=87=AA=E9=80=89?= =?UTF-8?q?=E7=94=9F=E6=88=90=E5=AE=8C=E6=95=B4=E7=AD=96=E7=95=A5=E6=96=87?= =?UTF-8?q?=E6=9C=AC(=E4=B9=B0=E5=8C=BA/=E6=8D=9F/=E7=9B=88/RR)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/promote_candidates.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/scripts/promote_candidates.py b/scripts/promote_candidates.py index be212ea3..33b8549d 100644 --- a/scripts/promote_candidates.py +++ b/scripts/promote_candidates.py @@ -59,7 +59,16 @@ def main(): # 构建策略 now = datetime.now().strftime("%Y-%m-%d %H:%M:%S") timing_signal = "买入" if score >= 7 else "关注" - action = f"市场扫描发现(评分{score})" + price_est = (el + eh) / 2 if el > 0 and eh > 0 else 0 + reason_text = [] + if el > 0: reason_text.append(f"买{el}~{eh}") + if sl > 0: reason_text.append(f"损{sl}") + if tp > 0: reason_text.append(f"盈{tp}") + if sl > 0 and tp > 0 and price_est > 0: + rr = (tp - price_est) / (price_est - sl) if (price_est - sl) > 0 else 0 + reason_text.append(f"RR{rr:.1f}") + reason_text.append(f"评分{score}") + action = " | ".join(reason_text) if reason_text else f"市场扫描发现(评分{score})" conn.execute(""" INSERT INTO holding_strategies @@ -74,6 +83,18 @@ def main(): conn.execute("UPDATE candidates SET promoted=1 WHERE code=?", (code,)) promoted += 1 print(f" ✅ {code} {name} 评分{score} → 已加入自选({timing_signal})", flush=True) + + # 触发全量重评(生成完整9维策略) + try: + import subprocess as _sp + r = _sp.run(["python3", "/home/hmo/MoFin/scripts/per_stock_reassess.py", code], + capture_output=True, text=True, timeout=60) + if r.returncode == 0: + print(f" 重评完成", flush=True) + else: + print(f" 重评失败: {r.stderr.strip()[:100]}", flush=True) + except Exception as e: + print(f" 重评异常: {e}", flush=True) conn.commit() print(f"\n[PROMOTE] 本次提拔{promoted}只", flush=True)