From 127a0ff02137adef61dd8d3819b76be9b97c4d6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9F=A5=E5=BE=AE?= Date: Thu, 25 Jun 2026 20:27:53 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A4=8D=E7=9B=98=E6=AF=8F=E6=97=A5cro?= =?UTF-8?q?n=20+=20=E5=8D=96=E9=A3=9E=E6=A3=80=E6=B5=8B(60=E6=97=A5?= =?UTF-8?q?=E6=9C=80=E9=AB=98=E4=BB=B7)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 cron: 策略复盘-每日 (20:00, no_agent, deliver=origin) - 执行层增加60日K线最高价检查 - 止盈触发后价格继续涨→标记"卖飞(X%)" + tp_too_close - 德明利这类情况: 综合层=赚钱, 执行层=卖飞(止盈过近) - 优化K线拉取性能(只对有TP的票拉, curl --max-time 3) --- scripts/strategy_review.py | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/scripts/strategy_review.py b/scripts/strategy_review.py index a959512..b19b56f 100644 --- a/scripts/strategy_review.py +++ b/scripts/strategy_review.py @@ -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 = "存疑(久未达标)"