From ad4287624aefa37aaa8fdc2b56886e868217f48e Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Mon, 21 Sep 2026 09:57:48 +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