From 8c45b83c0bd2967d20f8d0af24f26790bbefadc1 Mon Sep 17 00:00:00 2001 From: xxm Date: Tue, 18 Aug 2026 16:20:07 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=A0=B9=E5=9B=A0-=E2=91=A0promote=20IN?= =?UTF-8?q?SERT=20price=E5=86=99=E6=AD=BB0=E2=86=92=E7=94=A8=E5=AE=9E?= =?UTF-8?q?=E6=97=B6=E4=BB=B7=5Fprice=20=E2=91=A1per=5Fstock=E4=B8=89?= =?UTF-8?q?=E8=A1=A8=E6=97=A0=E4=BB=B7=E5=8A=A0stock=5Fquote=E7=9B=B4?= =?UTF-8?q?=E6=9F=A5(600262=E6=97=A0=E4=BB=B7=E6=A0=BC=E2=86=92=E9=87=8D?= =?UTF-8?q?=E8=AF=84=E8=AE=A1=E7=AE=97=E5=85=A8=E5=B4=A9=E2=86=92=E6=8E=A8?= =?UTF-8?q?=E9=80=8114.87=E4=B9=B0/14.80=E6=AD=A2=E6=8D=9F)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy/profile-scripts/per_stock_reassess.py | 13 +++++++++++++ deploy/profile-scripts/promote_candidates.py | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/deploy/profile-scripts/per_stock_reassess.py b/deploy/profile-scripts/per_stock_reassess.py index 00b81181..e0ffbba7 100644 --- a/deploy/profile-scripts/per_stock_reassess.py +++ b/deploy/profile-scripts/per_stock_reassess.py @@ -306,6 +306,19 @@ def main(): if price > 0: print(f" 实时价: {price} (来自DB)") else: + # 2026-08-18 修复:三表无价时 stock_quote 直查(600262 案例:promote 后未进价格表→price=0→计算全崩) + try: + import subprocess, json as _jj2 + _rq = subprocess.run(["python3", "/home/hmo/.hermes/profiles/position-analyst/scripts/stock_quote.py", code_raw], + capture_output=True, text=True, timeout=10) + _qq = _jj2.loads(_rq.stdout) + _qprice = float(_qq.get("price", 0)) + if _qprice > 0: + price = _qprice + print(f" 实时价: {price} (stock_quote直查)") + except Exception as _qe: + print(f" stock_quote直查失败: {_qe}", file=sys.stderr) + if price <= 0: # fallback to DB portfolio data _pf_data = read_portfolio() for _h in _pf_data.get("holdings", []): diff --git a/deploy/profile-scripts/promote_candidates.py b/deploy/profile-scripts/promote_candidates.py index a704ae57..1deaaaef 100644 --- a/deploy/profile-scripts/promote_candidates.py +++ b/deploy/profile-scripts/promote_candidates.py @@ -248,7 +248,7 @@ def main(): sector_context, quality_check) VALUES (?,?,?,?,?,?,?,?,?,'自选策略','scan', 'active',?,'关注',?,?,?,'', 'pending') - """, (code, name, 0, el, eh, sl, tp, timing_signal, action, _rr, source_strategy, now, now)) + """, (code, name, _price, el, eh, sl, tp, timing_signal, action, _rr, source_strategy, now, now)) newly_added = cur.rowcount > 0 conn.execute("UPDATE candidates SET promoted=1 WHERE code=?", (code,))