refactor: 移除v_combo波段出场硬编码(连续2日破MA10)——k线形态由LLM提示词判断(老莫原则), swing持仓统一走zones→LLM重评→timing_signal维持才发
This commit is contained in:
@@ -525,35 +525,11 @@ def run_once(round_label=""):
|
||||
if code not in state:
|
||||
state[code] = {}
|
||||
|
||||
# ── v_combo波段出场检测(exit_mode=swing的持仓,2026-07-29落地)──
|
||||
if d.get("exit_mode", "swing") == "swing" and (d.get("shares") or 0) > 0:
|
||||
try:
|
||||
import sqlite3 as _sq
|
||||
_c2 = _sq.connect("/home/hmo/MoFin/data/mofin.db")
|
||||
_ma = _c2.execute("SELECT close, high, ma10 FROM stock_daily WHERE code=? ORDER BY date DESC LIMIT 4", (code,)).fetchall()
|
||||
_c2.close()
|
||||
if len(_ma) >= 3:
|
||||
_closes = [r[0] for r in _ma]
|
||||
_highs = [r[1] for r in _ma]
|
||||
_ma10s = [r[2] for r in _ma if r[2]]
|
||||
if _ma10s:
|
||||
_ma10 = _ma10s[0]
|
||||
# 连续2日收破MA10 → 波段出场
|
||||
below = sum(1 for c in _closes[:2] if c < _ma10)
|
||||
if below >= 2 and price < _ma10 and _can_push(code, "swing_out"):
|
||||
outputs.append(f"📉 {name}({code}) {price} 连续破MA10({_ma10:.2f}) → 波段先出(可减仓)")
|
||||
record_event(code, name, "swing_out", price, str(_ma10))
|
||||
_push_action("波段出场", f"📉 {name}({code}) {price} 连续2日破MA10({_ma10:.2f}) → 波段先出,建议减仓;收回MA10且创新高再进")
|
||||
# 收回MA10且突破前一日高点 → 波段再进
|
||||
elif price > _ma10 and len(_highs) >= 2 and _highs[0] > _highs[1] and _can_push(code, "swing_re"):
|
||||
outputs.append(f"📈 {name}({code}) {price} 收回MA10({_ma10:.2f})且突破前高 → 波段再进")
|
||||
record_event(code, name, "swing_re", price, str(_ma10))
|
||||
_push_action("波段再进", f"📈 {name}({code}) {price} 收回MA10({_ma10:.2f})且突破前一日高点 → 波段再进,可接回")
|
||||
except Exception as _e:
|
||||
try:
|
||||
record_alert(level="warning", source="price_monitor", title="波段检测异常", detail=str(_e)[:200], code=code)
|
||||
except Exception:
|
||||
pass
|
||||
# ── v_combo波段出场(2026-08-13 已移除硬编码)──
|
||||
# 老莫原则:k线形态判断在LLM提示词上体现(batch_reassess 提示词已含波段出场形态),
|
||||
# 不在代码里硬编码"连续2日收破MA10"特定规则。
|
||||
# swing持仓的 stop_loss/entry_zone/take_profit_zone 已由通用 zones 循环触发 LLM 重评,
|
||||
# timing_signal 含"卖出/止盈"才发推荐 → 统一"进区→重评→维持才发"。
|
||||
|
||||
# 时间预算检查:如果超时,跳过重评只做状态记录
|
||||
_budget_low = (time.time() - start) > TIME_BUDGET
|
||||
|
||||
Reference in New Issue
Block a user