feat: pool_news采集输出附当前策略快照(版本/重评时间/止损/止盈/信号/操作)——推荐必须引用真实策略

This commit is contained in:
xxm
2026-08-17 10:48:58 +08:00
parent ec6bdcb648
commit 03c5f9e202
+26 -1
View File
@@ -94,9 +94,34 @@ def main():
time.sleep(SLEEP) time.sleep(SLEEP)
conn.commit() conn.commit()
conn.close()
dt = time.time() - t0 dt = time.time() - t0
print(f"[{tag}] 完成: {ok}/{len(codes)} 成功, {empty} 无新闻, {fail} 失败, 新增 {new} 条, 耗时 {dt:.0f}s", flush=True) print(f"[{tag}] 完成: {ok}/{len(codes)} 成功, {empty} 无新闻, {fail} 失败, 新增 {new} 条, 耗时 {dt:.0f}s", flush=True)
# ── 2026-08-17 老莫:推荐必须带所依据的策略 ──
# 打印池子内每只股票的当前策略快照(SSOTholding_strategies 最新记录)
# 知微执行本 job 时据此引用真实策略(版本/重评时间/止损/止盈/买入区/信号/操作),
# 不得凭 strategy_history 旧快照或记忆自由发挥。
print("\n===== 当前策略快照(推荐必须引用以下真实策略) =====", flush=True)
try:
_cols = [d[1] for d in conn.execute("PRAGMA table_info(holding_strategies)").fetchall()]
for _code in codes:
_r = conn.execute(
"SELECT * FROM holding_strategies WHERE code=? AND status='active' ORDER BY rowid DESC LIMIT 1",
(_code,)).fetchone()
if not _r:
continue
_d = dict(zip(_cols, _r))
_sig = _d.get("timing_signal") or "?"
_sl = _d.get("stop_loss"); _tp = _d.get("take_profit")
_el = _d.get("entry_low"); _eh = _d.get("entry_high")
_ver = _d.get("version") or _d.get("decision_type") or "?"
_ra = (_d.get("reassessed_at") or _d.get("updated_at") or "")[:19]
_act = str(_d.get("action") or "")[:120]
print(f"[策略] {_code} {_d.get('name','')} | 版本={_ver} 重评={_ra} | "
f"信号={_sig} 止损={_sl} 止盈={_tp} 买入区={_el}~{_eh} | 操作: {_act}", flush=True)
print("===== 策略快照结束 =====", flush=True)
except Exception as _e:
print(f"[策略快照输出失败] {_e}", file=sys.stderr)
conn.close()
if __name__ == "__main__": if __name__ == "__main__":