From 4cdead14455660727e45a9a99d519fb4b1db48e3 Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Wed, 17 Jun 2026 10:26:59 +0800
Subject: [PATCH] fix(gateApi): 修复网格交易追加止损单ID计算逻辑

---
 src/main/java/com/xcong/excoin/modules/gateApi/GateGridTradeService.java |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 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 a921ba2..e5fca3e 100644
--- a/src/main/java/com/xcong/excoin/modules/gateApi/GateGridTradeService.java
+++ b/src/main/java/com/xcong/excoin/modules/gateApi/GateGridTradeService.java
@@ -1229,12 +1229,15 @@
                 furthestSlId = e.getId();
             }
         }
+
+        int interval  = 1;
         if (furthestSlId == 0) {
             furthestSlId = gridId;
+            interval = 2;
         }
         log.info("[Gate] 多仓追挂止损, 当前最远止损gridId:{}, 追加{}张", furthestSlId, filledQty);
         for (int i = 0; i < filledQty; i++) {
-            int newSlId = furthestSlId - i - 2;
+            int newSlId = furthestSlId - i - interval;
             GridElement elem = GridElement.findById(newSlId);
             if (elem == null) {
                 continue;
@@ -1262,12 +1265,15 @@
                 furthestSlId = e.getId();
             }
         }
+
+        int interval  = 1;
         if (furthestSlId == 0) {
             furthestSlId = gridId;
+            interval = 2;
         }
         log.info("[Gate] 空仓追挂止损, 当前最远止损gridId:{}, 追加{}张", furthestSlId, filledQty);
         for (int i = 0; i < filledQty; i++) {
-            int newSlId = furthestSlId + i + 2;
+            int newSlId = furthestSlId + i + interval;
             GridElement elem = GridElement.findById(newSlId);
             if (elem == null) {
                 continue;

--
Gitblit v1.9.1