feat: regime_perf支持market过滤——load_all_strategies(market),港股策略按港股温区归因(hk_mr1入strategy_regime_perf market=hk)
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user