diff --git a/deploy/profile-scripts/promote_candidates.py b/deploy/profile-scripts/promote_candidates.py index 99c7ce91..47f67f57 100644 --- a/deploy/profile-scripts/promote_candidates.py +++ b/deploy/profile-scripts/promote_candidates.py @@ -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,))