From ca21152eec5d609adc0312ca8b67c4f6ac98e838 Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Sat, 10 Oct 2026 10:18:47 +0800
Subject: [PATCH] ``` fix(gateApi): 修复止损追单时持仓计算时序竞态问题

---
 src/main/java/com/xcong/excoin/modules/gateApi/GateCommandConsumer.java |   36 ++++++++++++++++++++++++++++++++++++
 1 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/xcong/excoin/modules/gateApi/GateCommandConsumer.java b/src/main/java/com/xcong/excoin/modules/gateApi/GateCommandConsumer.java
index 89907d8..3145681 100644
--- a/src/main/java/com/xcong/excoin/modules/gateApi/GateCommandConsumer.java
+++ b/src/main/java/com/xcong/excoin/modules/gateApi/GateCommandConsumer.java
@@ -73,6 +73,42 @@
                     log.info("[Gate] 远程参数已持久化");
                     break;
 
+                case "CANCEL_LONG_TP_SL":
+                    strategy.cancelLongTakeProfitAndStopLoss();
+                    message = "已取消多仓止盈止损";
+                    log.info("[Gate] 远程取消多仓止盈止损");
+                    break;
+
+                case "CANCEL_SHORT_TP_SL":
+                    strategy.cancelShortTakeProfitAndStopLoss();
+                    message = "已取消空仓止盈止损";
+                    log.info("[Gate] 远程取消空仓止盈止损");
+                    break;
+
+                case "REBUILD_LONG_TP_SL":
+                    strategy.rebuildLongTakeProfitAndStopLoss();
+                    message = "已生成多仓止盈止损";
+                    log.info("[Gate] 远程生成多仓止盈止损");
+                    break;
+
+                case "REBUILD_SHORT_TP_SL":
+                    strategy.rebuildShortTakeProfitAndStopLoss();
+                    message = "已生成空仓止盈止损";
+                    log.info("[Gate] 远程生成空仓止盈止损");
+                    break;
+
+                case "CLOSE_LONG":
+                    strategy.closeLongPosition();
+                    message = "已提交多单平仓";
+                    log.info("[Gate] 远程多单平仓");
+                    break;
+
+                case "CLOSE_SHORT":
+                    strategy.closeShortPosition();
+                    message = "已提交空单平仓";
+                    log.info("[Gate] 远程空单平仓");
+                    break;
+
                 default:
                     success = false;
                     message = "未知指令类型: " + cmd.getCommandType();

--
Gitblit v1.9.1