From 8bc3716f1b54b8bdf4ee647b28665cc14a27c4d6 Mon Sep 17 00:00:00 2001 From: hmo Date: Fri, 14 Aug 2026 22:41:37 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20regime=5Fperf=E6=94=AF=E6=8C=81market?= =?UTF-8?q?=E8=BF=87=E6=BB=A4=E2=80=94=E2=80=94load=5Fall=5Fstrategies(mar?= =?UTF-8?q?ket),=E6=B8=AF=E8=82=A1=E7=AD=96=E7=95=A5=E6=8C=89=E6=B8=AF?= =?UTF-8?q?=E8=82=A1=E6=B8=A9=E5=8C=BA=E5=BD=92=E5=9B=A0(hk=5Fmr1=E5=85=A5?= =?UTF-8?q?strategy=5Fregime=5Fperf=20market=3Dhk)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy/profile-scripts/regime_perf.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/deploy/profile-scripts/regime_perf.py b/deploy/profile-scripts/regime_perf.py index bbd19eee..ec3b040b 100644 --- a/deploy/profile-scripts/regime_perf.py +++ b/deploy/profile-scripts/regime_perf.py @@ -26,10 +26,13 @@ sys.path.insert(0, "/home/hmo/MoFin") DB = "/home/hmo/MoFin/data/mofin.db" -def load_all_strategies(): +def load_all_strategies(market='a'): + """读取策略版本列表。market='a'(默认,A股,行为不变) / 'hk'(港股策略)""" conn = sqlite3.connect(DB, timeout=30) conn.execute("PRAGMA busy_timeout=30000") - rows = conn.execute("SELECT DISTINCT version FROM strategy_research ORDER BY version").fetchall() + rows = conn.execute( + "SELECT DISTINCT version FROM strategy_research WHERE COALESCE(market,'a')=? ORDER BY version", + (market,)).fetchall() conn.close() return [r[0] for r in rows if r[0]] @@ -106,7 +109,7 @@ def main(): if a.startswith("--market="): market = a.split("=", 1)[1] regime_map = load_regime_map(market) - strategies = load_all_strategies() + strategies = load_all_strategies(market) print(f"市场: {market} | 策略数: {len(strategies)}") conn = sqlite3.connect(DB, timeout=60)