Files
MoFin/scripts/check_candidates_schema.py
T
hmo 7b26c373d1 fix(reassess): stale_detector timeout 60->240s + batch cap 5/run + GATE_ZONE_SANITY
Three issues from zhiwei's strategy report:

1. '37 reassess all timed out (subprocess 60s)': real cause is per-call LLM
   latency exceeding the 60s per-subprocess limit during the key5-dead/
   gateway-unstable window. NOT 'no concurrency control' as reported (60s
   is per stock, not for the batch). Fixes: per-call timeout 60->240s
   (LLM cold-start is 20-100s), and cap AUTO_REASSESS batch to 5 stocks
   per run with remainder continuing next run (was unbounded serial calls
   that also blew the 120s cron script window).

2. '15 stocks entry-zone center wrongly 97.0': quality gates had no
   zone-sanity-vs-price check, so bad data (bad quote or LLM template
   output) could be written freely. New GATE_ZONE_SANITY (CRITICAL):
   zone center must be within 0.3x-3x of current price. Verified: rejects
   the exact 97-center-vs-5.69-price corruption, passes legit zones.

3. 'reassess overwrites manual SQL fixes': true by design; with
   GATE_ZONE_SANITY at write time, reassess can no longer overwrite good
   values with garbage - invalid writes get rejected + flagged instead.
2026-07-20 22:05:00 +08:00

20 lines
729 B
Python

import sqlite3
conn = sqlite3.connect('/home/hmo/MoFin/data/mofin.db')
conn.row_factory = sqlite3.Row
# candidates 表结构
cols = [r[1] for r in conn.execute("PRAGMA table_info(candidates)")]
print('candidates cols:', cols)
print()
codes = ['000711', '603766', '600617', '688271']
print('=== candidates 对应记录 ===')
for code in codes:
r = conn.execute("SELECT * FROM candidates WHERE code=?", (code,)).fetchone()
if r:
d = dict(r)
keys = [k for k in d.keys() if any(s in k.lower() for s in ['score', 'entry', 'stop', 'take', 'promot', 'created', 'name', 'code'])]
print(f" {code}: " + ' | '.join(f'{k}={d[k]}' for k in keys))
else:
print(f' {code}: 无记录')
conn.close()