From c83161d87ea9a4a508492ee9ade1fd6ad09389b3 Mon Sep 17 00:00:00 2001 From: mike Date: Fri, 25 Sep 2026 01:25:01 +0800 Subject: [PATCH] =?UTF-8?q?okx-auto-position:=20signal=5Fqueue=20=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E8=AF=86=E5=88=AB=20(stdout=20=E5=90=AB=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E6=A0=87=E8=AE=B0=E4=B9=9F=20mark=5Ffailed)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 之前 returncode=0 就标 done, 平仓失败伪装成功 (BTC 5小时才发现的次因) 现在 stdout 含 ❌/⏭️/⚠️ 均 mark_failed, retry 机制可识别 --- okx-auto-position/scripts/signal_queue.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/okx-auto-position/scripts/signal_queue.py b/okx-auto-position/scripts/signal_queue.py index 229ca2a..5c9423b 100644 --- a/okx-auto-position/scripts/signal_queue.py +++ b/okx-auto-position/scripts/signal_queue.py @@ -107,12 +107,15 @@ if __name__ == "__main__": ["python3", os.path.expanduser("~/.hermes/skills/trading/okx-auto-position/scripts/process_signal.py"), raw], capture_output=True, text=True, timeout=120 ) - if r.returncode == 0: + # 2026-09-21: 即使 returncode=0, stdout 含 "❌" 也 mark_failed + is_failed = r.returncode != 0 or "❌" in r.stdout or "⏭️" in r.stdout or "⚠️" in r.stdout + if is_failed: + err_msg = (r.stderr or r.stdout)[:200] + mark_failed(row_id, err_msg) + print(f" ❌ 失败 (含错误标记): {err_msg[:80]}") + else: mark_done(row_id, r.stdout[:200]) print(f" ✅ 成功") - else: - mark_failed(row_id, r.stderr[:200]) - print(f" ❌ 失败: {r.stderr[:100]}") except Exception as e: mark_failed(row_id, str(e)) print(f" ❌ 异常: {e}")