fix: stale_push_wlin直接从holding_strategies扫描可操作信号
This commit is contained in:
@@ -476,6 +476,37 @@ def main():
|
||||
deduped.append(item)
|
||||
all_candidates = deduped
|
||||
|
||||
# 补充:从holding_strategies直接扫描可操作的信号(弥补stale_detector遗漏)
|
||||
try:
|
||||
import sqlite3 as _sq3
|
||||
_db = _sq3.connect('/home/hmo/MoFin/data/mofin.db')
|
||||
_actionable = _db.execute(
|
||||
"SELECT hs.code, hs.name, lp.price, lp.change_pct, hs.entry_low, hs.entry_high, "
|
||||
"hs.stop_loss, hs.take_profit, hs.rr_ratio, hs.timing_signal, hs.action, hs.tech_snapshot, hs.sector_context "
|
||||
"FROM holding_strategies hs "
|
||||
"LEFT JOIN live_prices lp ON hs.code = lp.code "
|
||||
"WHERE hs.status='active' AND hs.timing_signal IN ('买入','可买入','可加仓') "
|
||||
"AND hs.rr_ratio > 0 AND hs.stop_loss > 0 AND hs.take_profit > 0"
|
||||
).fetchall()
|
||||
_db.close()
|
||||
for row in _actionable:
|
||||
code = str(row[0])
|
||||
if code in seen_codes:
|
||||
continue
|
||||
price = row[2] or 0
|
||||
el = row[4] or 0
|
||||
eh = row[5] or 0
|
||||
if price <= 0 or el <= 0 or eh <= 0:
|
||||
continue
|
||||
# 价格必须在买入区内或略高于(不超过5%)
|
||||
if price > eh * 1.05:
|
||||
continue
|
||||
name = row[1] or code
|
||||
all_candidates.append((name, code, price, el, eh, "", False))
|
||||
seen_codes.add(code)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# 重建 stocks 列表,用新数据判断(不再用旧 is_stale 标记,因为已全部重评)
|
||||
stocks = []
|
||||
zone_notes = [] # 在操作区间但不可操作→发说明
|
||||
|
||||
Reference in New Issue
Block a user