feat: 复盘每日cron + 卖飞检测(60日最高价)

- 新增 cron: 策略复盘-每日 (20:00, no_agent, deliver=origin)
- 执行层增加60日K线最高价检查
  - 止盈触发后价格继续涨→标记"卖飞(X%)" + tp_too_close
- 德明利这类情况: 综合层=赚钱, 执行层=卖飞(止盈过近)
- 优化K线拉取性能(只对有TP的票拉, curl --max-time 3)
This commit is contained in:
知微
2026-06-25 20:27:53 +08:00
parent 29ec09530a
commit 127a0ff021
+23 -5
View File
@@ -131,19 +131,37 @@ def evaluate_strategy(s, price):
exec_verdict = "待定"
exec_fail = None
# 取近期最高价(判断是否卖飞,只对有TP的策略拉数据)
recent_high = 0
if tp > 0:
try:
prefix = "sh" if code.startswith(('60','68','51','56','50')) else "sz" if code.startswith(('00','30','15')) else "hk"
url = f"http://ifzq.gtimg.cn/appstock/app/fqkline/get?param={prefix}{code},day,,,60,qfq"
import subprocess as sp
r = sp.run(["curl", "-s", "--max-time", "3", url], capture_output=True, text=True, timeout=5)
if r.returncode == 0 and r.stdout:
data = json.loads(r.stdout)
day_key = 'qfqday' if prefix != 'hk' else 'day'
bars = data.get('data', {}).get(f'{prefix}{code}', {}).get(day_key, [])
if bars:
recent_high = max(float(b[2]) for b in bars if len(b) > 2)
except:
pass
if sl > 0 and price <= sl:
# 止损触发 → 检查是否过紧
if price >= sl * 0.95:
exec_verdict = "存疑(临界触发)"
exec_fail = "stop_too_tight"
else:
exec_verdict = "已触发"
elif tp > 0 and price >= tp:
# 止盈触发 → 检查是否过近
if price <= tp * 1.05:
elif tp > 0 and (price >= tp or recent_high >= tp):
# 止盈触发或曾触发过
max_price = max(price, recent_high)
if max_price <= tp * 1.05:
exec_verdict = "已触发"
else:
exec_verdict = "存疑(突破后继续涨)"
overshoot = (max_price - tp) / tp * 100
exec_verdict = f"卖飞({overshoot:.0f}%)"
exec_fail = "tp_too_close"
elif days > 45 and tp > 0 and price < entry_low:
exec_verdict = "存疑(久未达标)"