From bc7a6c6dd8ca36213b0fa9bc120cf4be22deda24 Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Sat, 11 Jul 2026 14:46:27 +0800
Subject: [PATCH] 止盈触发撤销止损单

---
 src/main/java/com/xcong/excoin/modules/gateApi/GateGridTradeService.java |   28 ++++++++++++++--------------
 1 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/src/main/java/com/xcong/excoin/modules/gateApi/GateGridTradeService.java b/src/main/java/com/xcong/excoin/modules/gateApi/GateGridTradeService.java
index b19b33f..de3376f 100644
--- a/src/main/java/com/xcong/excoin/modules/gateApi/GateGridTradeService.java
+++ b/src/main/java/com/xcong/excoin/modules/gateApi/GateGridTradeService.java
@@ -397,18 +397,18 @@
 
         checkProfitAndReset();
 
-//        if (state == StrategyState.ACTIVE &&
-//                longActive == false &&
-//                    longPositionSize.compareTo(BigDecimal.ZERO) == 0){
-//            processShortGrid(closePrice);
-//        }
-//
-//
-//        if (state == StrategyState.ACTIVE &&
-//                shortActive == false &&
-//                        shortPositionSize.compareTo(BigDecimal.ZERO) == 0){
-//            processLongGrid(closePrice);
-//        }
+        if (state == StrategyState.ACTIVE &&
+                longActive == false &&
+                    longPositionSize.compareTo(BigDecimal.ZERO) == 0){
+            processShortGrid(closePrice);
+        }
+
+
+        if (state == StrategyState.ACTIVE &&
+                shortActive == false &&
+                        shortPositionSize.compareTo(BigDecimal.ZERO) == 0){
+            processLongGrid(closePrice);
+        }
     }
 
     /** Gate 永续合约 taker 费率 0.05% */
@@ -599,7 +599,7 @@
         if (longTpElem != null && StrUtil.isNotEmpty(tradeId) && !tradeId.equals("0")) {
             longTakeProfitTraderIdParam(longTpElem, null, false);
             log.info("[Gate] 多仓止盈触发 gridId:{}, orderId:{}", longTpElem.getId(), orderId);
-//            cancelFarthestLongStopLoss();
+            cancelFarthestLongStopLoss();
 //            checkLastTakeProfitAndRestart();
             return;
         }
@@ -608,7 +608,7 @@
         if (shortTpElem != null && StrUtil.isNotEmpty(tradeId) && !tradeId.equals("0")) {
             shortTakeProfitTraderIdParam(shortTpElem, null, false);
             log.info("[Gate] 空仓止盈触发 gridId:{}, orderId:{}", shortTpElem.getId(), orderId);
-//            cancelFarthestShortStopLoss();
+            cancelFarthestShortStopLoss();
 //            checkLastTakeProfitAndRestart();
             return;
         }

--
Gitblit v1.9.1