feat: 自选进出职责归位——promote撤容量闸(不设上限不淘汰,合格即提拔;原60硬顶+RR置换与auto_exit脱节且被多入口绕过失效),出清唯一权威=auto_exit(盘前12维信号驱动),auto_exit输出加池子规模趋势(老莫监察退出机制是否奏效)
This commit is contained in:
@@ -239,29 +239,11 @@ def main():
|
||||
reason_text.append(f"评分{score}")
|
||||
action = " | ".join(reason_text) if reason_text else f"市场扫描发现(评分{score})"
|
||||
|
||||
# 容量闸:自选上限60只
|
||||
MAX_WATCH = 60
|
||||
# 2026-08-25 老莫:撤容量闸——不设上限、不淘汰(原60硬顶+RR置换与重评驱动的
|
||||
# auto_exit 退出机制重复且脱节,单点闸被多入口绕过已失效)。进管进、出管出:
|
||||
# 出清唯一权威 = watchlist_auto_exit(盘前,12维信号驱动)。本脚本只负责合格即提拔。
|
||||
wl_count = conn.execute(
|
||||
"SELECT COUNT(*) FROM holding_strategies WHERE status='active' AND decision_type='自选策略'").fetchone()[0]
|
||||
if wl_count >= MAX_WATCH:
|
||||
weakest = conn.execute("""
|
||||
SELECT code, name, COALESCE(rr_ratio,0) as rr FROM holding_strategies
|
||||
WHERE status='active' AND decision_type='自选策略'
|
||||
AND code != ?
|
||||
ORDER BY COALESCE(rr_ratio,0) ASC, updated_at ASC LIMIT 1""", (code,)).fetchone()
|
||||
if weakest and (weakest[2] or 0) < 1.0:
|
||||
conn.execute(
|
||||
"INSERT INTO watchlist_log (code, name, event, reason, old_signal, new_signal, price) "
|
||||
"VALUES (?,?,?,?,?,?,?)",
|
||||
(weakest[0], weakest[1] or "", "exit", f"容量{MAX_WATCH}淘汰为新标的{code}腾位", "", "已删除", 0))
|
||||
conn.execute(
|
||||
"DELETE FROM holding_strategies WHERE code=? AND status='active' AND decision_type='自选策略'",
|
||||
(weakest[0],))
|
||||
print(f" 🔴 容量淘汰: {weakest[0]} {weakest[1]} (RR={weakest[2]})", flush=True)
|
||||
else:
|
||||
print(f" ⏭ 自选已满{MAX_WATCH}且现有标的均RR>=2.0,{code}暂缓提拔", flush=True)
|
||||
processed += 1
|
||||
continue
|
||||
|
||||
cur = conn.execute("""
|
||||
INSERT OR IGNORE INTO holding_strategies
|
||||
|
||||
@@ -117,8 +117,11 @@ def main(dry_run=False):
|
||||
|
||||
if not dry_run:
|
||||
conn.commit()
|
||||
|
||||
print(f"\n结果: {len(exited)}只退出, {len(kept)}只保留")
|
||||
|
||||
# 2026-08-25 老莫监察要求:输出池子规模趋势(观察退出机制是否奏效的核心指标)
|
||||
_pool_now = conn.execute(
|
||||
"SELECT COUNT(*) FROM holding_strategies WHERE status='active' AND decision_type='自选策略'").fetchone()[0]
|
||||
print(f"\n结果: {len(exited)}只退出, {len(kept)}只保留 | 池子规模: {_pool_now + len(exited)}→{_pool_now}")
|
||||
|
||||
# 生成退出摘要日志
|
||||
if exited:
|
||||
|
||||
Reference in New Issue
Block a user