fix: promote_candidates加p_oversold RR例外——超跌反弹候选跳过RR>=2.0门槛(用专属评估替代),SELECT加sector字段

This commit is contained in:
hmo
2026-08-11 13:04:12 +08:00
parent 79a5facc13
commit 1f77f57713
+6 -2
View File
@@ -35,7 +35,7 @@ def main():
# 读未提拔候选(按评分降序)
rows = conn.execute("""
SELECT c.code, c.name, c.score_final, c.entry_range, c.stop_loss, c.target
SELECT c.code, c.name, c.score_final, c.entry_range, c.stop_loss, c.target, c.sector
FROM candidates c
WHERE (c.promoted IS NULL OR c.promoted = 0)
AND (c.dropped IS NULL OR c.dropped = 0)
@@ -57,6 +57,8 @@ def main():
break
# 已有"在自选"的候选(上次已插但被标记或重复)快速跳过,不计入 new 配额
code = str(r[0])
# 2026-08-11:读取候选 sector(用于 p_oversold RR 例外)
cand_sector = str(r[6] or "").strip() if len(r) > 6 else ""
exists = conn.execute(
"SELECT id FROM holding_strategies WHERE code=? AND status='active'",
(code,)
@@ -127,7 +129,9 @@ def main():
if el > 0 and eh > el and sl > 0 and tp > 0:
_mid = (el + eh) / 2
_rr = (tp - _mid) / (_mid - sl) if (_mid - sl) > 0 else 0
if _rr < 2.0:
# 2026-08-11p_oversold(预测超跌反弹)候选跳过 RR>=2.0 门槛——
# 超跌反弹候选 RR 天然 <2(支撑近/压力远),用专属评估替代(部署计划 §8.3 方案C)
if _rr < 2.0 and cand_sector != "p_oversold":
print(f"{code} {name} RR={_rr:.2f}<2.0,不入自选")
processed += 1
continue