From 8b5499bab1c398a7d75890801d9e32bf4774e346 Mon Sep 17 00:00:00 2001 From: xxm Date: Tue, 18 Aug 2026 20:31:27 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20per=5Fstock=5Freassess=E4=B9=9F?= =?UTF-8?q?=E8=90=BD=E5=BA=93=E7=AD=96=E7=95=A5=E5=88=A4=E6=96=AD(?= =?UTF-8?q?=E4=BB=8Efull=5Fanalysis=E5=A4=8D=E7=94=A8parse=5Fresponse?= =?UTF-8?q?=E6=8F=90=E5=8F=96=E7=AD=96=E7=95=A5=E5=A4=B1=E6=95=88/?= =?UTF-8?q?=E5=88=87=E6=8D=A2)(=E8=80=81=E8=8E=AB:=E9=87=8D=E8=AF=84?= =?UTF-8?q?=E7=AD=96=E7=95=A5=E5=88=87=E6=8D=A2=E5=86=B3=E7=AD=96=E5=85=A8?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E7=94=9F=E6=95=88)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy/profile-scripts/per_stock_reassess.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/deploy/profile-scripts/per_stock_reassess.py b/deploy/profile-scripts/per_stock_reassess.py index ab658215..0cc74115 100644 --- a/deploy/profile-scripts/per_stock_reassess.py +++ b/deploy/profile-scripts/per_stock_reassess.py @@ -470,6 +470,26 @@ def main(): _rc_conn.close() if _sig: print(f" ✅ LLM信号={_sig} 已对齐") + # 2026-08-18 策略判断落库(复用 batch 的 parse_response 从 full_analysis 提取) + try: + from batch_reassess import parse_response as _pr2 + _p2 = _pr2(_full_analysis_text or "") + _j2 = _p2.get("strategy_judge", "") + _st2 = _p2.get("strategy_switch_to", "") + if _j2 == "策略失效重定": + _rc_conn = __import__('sqlite3').connect('/home/hmo/MoFin/data/mofin.db') + _rc_conn.execute("UPDATE holding_strategies SET strategy_state='invalidated' WHERE code=? AND status='active'", (code,)) + _rc_conn.commit(); _rc_conn.close() + print(f" ✅ 策略判断=策略失效重定,strategy_state→invalidated") + elif _j2 == "更换策略归类" and _st2: + _rc_conn = __import__('sqlite3').connect('/home/hmo/MoFin/data/mofin.db') + _rc_conn.execute("UPDATE holding_strategies SET strategy_attributed=?, strategy_state='switched', strategy_provenance='llm_attributed' WHERE code=? AND status='active'", (_st2, code)) + _rc_conn.commit(); _rc_conn.close() + print(f" ✅ 策略判断=更换策略归类,strategy_attributed={_st2}") + elif _j2: + print(f" ℹ️ 策略判断={_j2}(维持/修改参数,不落库)") + except Exception as _pe: + print(f" ⚠️ 策略判断落库失败: {_pe}") # 冷却期已更新(reassessed_at写入) except Exception as _dbe: print(f" [DB FAIL] holding_strategies 写入失败: {_dbe}", file=sys.stderr)