From 5ffc4876593fe638153d607a48e04e9d59effbc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9F=A5=E5=BE=AE?= Date: Tue, 7 Jul 2026 11:27:56 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=AE=A1=E8=AE=A1=E5=BA=A6=E9=87=8F?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E2=80=94=E2=80=94reassess=E5=86=99strategy?= =?UTF-8?q?=5Fevaluations=E9=9D=9Eholding=5Fstrategies?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/verify_reassess_pipeline.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/scripts/verify_reassess_pipeline.py b/scripts/verify_reassess_pipeline.py index b35fed9a..d288c2ab 100644 --- a/scripts/verify_reassess_pipeline.py +++ b/scripts/verify_reassess_pipeline.py @@ -115,14 +115,19 @@ def run(): ok = False alerts.append(f"price_monitor异常: {e}") - # 2. holding_strategies 是否有数据 + # 2. 策略评估活动(reassess_with_context写strategy_evaluations,不是holding_strategies) try: - hs = conn.execute("SELECT COUNT(*) FROM holding_strategies").fetchone()[0] - valid = conn.execute("SELECT COUNT(*) FROM holding_strategies WHERE stop_loss IS NOT NULL").fetchone()[0] - if hs == 0: - ok = False - alerts.append("holding_strategies为0条") - checks.append({"check":"strategies_in_db","status":"ok" if hs > 0 else "warn","detail":f"{hs}条策略(含止损{valid}条)"}) + today_se = conn.execute("SELECT COUNT(*) FROM strategy_evaluations WHERE date(created_at)=date('now')").fetchone()[0] + total_se = conn.execute("SELECT COUNT(*) FROM strategy_evaluations").fetchone()[0] + # 也尝试查holding_strategies(如果存在并有数据) + hs_exists = conn.execute("SELECT COUNT(*) FROM sqlite_master WHERE type='table' AND name='holding_strategies'").fetchone()[0] + hs = 0 + if hs_exists: + hs = conn.execute("SELECT COUNT(*) FROM holding_strategies").fetchone()[0] + detail = f"今日{today_se}次评估, 累计{total_se}条" + if hs > 0: + detail += f", holding_strategies{hs}条" + checks.append({"check":"strategy_activity","status":"ok","detail":detail}) except Exception as e: checks.append({"check":"strategies","status":"fail","detail":str(e)}) ok = False