From c594179ba163614c84ce60c66442717552295e05 Mon Sep 17 00:00:00 2001 From: mike Date: Thu, 23 Jul 2026 22:17:06 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=8A=A0=E4=BB=93=E4=BF=A1=E5=8F=B7?= =?UTF-8?q?=E4=B8=8D=E5=86=8D=E8=AF=AF=E5=88=A4=E4=B8=BA=E6=96=B0=E5=BC=80?= =?UTF-8?q?=E4=BB=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【bug】classify_signal 没区分'加仓'和'新开仓', 加仓信号也走 execute_order 自动下单 导致 Jasonleo 加仓信号 (同币种同方向) 每次都开 0.01 张新仓, 实际是加仓 【修复】 1. classify_signal 加 'add' 类型 (匹配 '加仓'/'追仓' 关键词) 2. execute_order 加 elif: signal_type == 'add' 推消息但不自动下单 3. 加仓信号标记 outcome='pushed_add' 【效果】下次 Jasonleo 推 BTC 加仓 → 显示'加仓建议' → 不自动下单 → 你手动决定 --- okx-auto-position/scripts/process_signal.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/okx-auto-position/scripts/process_signal.py b/okx-auto-position/scripts/process_signal.py index 17f586a..bb5efb1 100644 --- a/okx-auto-position/scripts/process_signal.py +++ b/okx-auto-position/scripts/process_signal.py @@ -231,7 +231,11 @@ def classify_signal(fields): if '减仓' in text or (pnl < 0 and '减' in text): return 'reduce' - # 默认为新开仓或加仓(由advisor判断) + # 加仓信号 + if '加仓' in text or '追仓' in text: + return 'add' + + # 默认为新开仓 return 'open' # ─── 格式化 ────────────────────────────────────────────────────────────── @@ -782,6 +786,15 @@ def process_signal(text): trader_entry=float(fields.get('entry', '0').replace(',', '')), trader_pnl=float(fields.get('pnl', '0').replace(',', '')), raw_text=text, outcome='pushed') + elif signal_type == 'add': + # 加仓信号: 推消息但不自动下单 (你已有同向持仓时容易重复) + msg = format_message(fields, rec, signal_type) + _tracker_record(trader=trader, symbol=symbol, side=side, + leverage=int(leverage) if leverage else 10, + trader_size=float(fields.get('size', '0').replace(',', '')), + trader_entry=float(fields.get('entry', '0').replace(',', '')), + trader_pnl=float(fields.get('pnl', '0').replace(',', '')), + raw_text=text, outcome='pushed_add') else: # 需要确认或减仓信号 msg = format_message(fields, rec, signal_type)