fix: promote提拔rr_ratio用候选_rr(原硬编码0致新提拔被当weakest秒淘汰)+容量淘汰排除新提拔
This commit is contained in:
@@ -160,7 +160,8 @@ def main():
|
||||
weakest = conn.execute("""
|
||||
SELECT code, name, COALESCE(rr_ratio,0) as rr FROM holding_strategies
|
||||
WHERE status='active' AND decision_type='自选策略'
|
||||
ORDER BY COALESCE(rr_ratio,0) ASC, updated_at ASC LIMIT 1""").fetchone()
|
||||
AND code != ?
|
||||
ORDER BY COALESCE(rr_ratio,0) ASC, updated_at ASC LIMIT 1""", (code,)).fetchone()
|
||||
if weakest and (weakest[2] or 0) < 2.0:
|
||||
conn.execute(
|
||||
"INSERT INTO watchlist_log (code, name, event, reason, old_signal, new_signal, price) "
|
||||
@@ -182,8 +183,8 @@ def main():
|
||||
rr_ratio, stock_category, created_at, updated_at,
|
||||
sector_context, quality_check)
|
||||
VALUES (?,?,?,?,?,?,?,?,?,'自选策略','scan',
|
||||
'active',0,'关注',?,?,'', 'pending')
|
||||
""", (code, name, 0, el, eh, sl, tp, timing_signal, action, now, now))
|
||||
'active',?,'关注',?,?,'', 'pending')
|
||||
""", (code, name, 0, el, eh, sl, tp, timing_signal, action, _rr, now, now))
|
||||
newly_added = cur.rowcount > 0
|
||||
|
||||
conn.execute("UPDATE candidates SET promoted=1 WHERE code=?", (code,))
|
||||
|
||||
Reference in New Issue
Block a user