import sqlite3 conn = sqlite3.connect('/home/hmo/MoFin/data/mofin.db') conn.row_factory = sqlite3.Row print('=== 中心 85~110 的活跃自选/持仓 ===') rows = conn.execute( "SELECT code, name, entry_low, entry_high, decision_type, strategy_type, created_at, updated_at " "FROM holding_strategies WHERE status='active' AND entry_low > 0").fetchall() found = 0 for r in rows: c = (r['entry_low'] + r['entry_high']) / 2 if 85 <= c <= 110: print(f" {r['code']} {r['name']}: 区{r['entry_low']}~{r['entry_high']} 中心{c:.2f} | {r['decision_type']}/{r['strategy_type']} | created={r['created_at']} updated={r['updated_at']}") found += 1 print(f'共 {found} 只') print() # holding_strategies 表结构 + 默认值 print('=== holding_strategies schema ===') sql = conn.execute("SELECT sql FROM sqlite_master WHERE name='holding_strategies'").fetchone()[0] for line in sql.split('\n'): if '97' in line or 'DEFAULT' in line.upper(): print(' ', line.strip()) conn.close()