From 6cc2de8e5181d83dc5baa014d528da9e93e5c2a6 Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Mon, 22 Jun 2026 22:59:42 +0800
Subject: [PATCH] fix(gateApi): 修复双边持仓跨度计算逻辑

---
 src/main/java/com/xcong/excoin/modules/gateApi/GateGridTradeService.java |    6 +++---
 1 files changed, 3 insertions(+), 3 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 b473114..d0c264a 100644
--- a/src/main/java/com/xcong/excoin/modules/gateApi/GateGridTradeService.java
+++ b/src/main/java/com/xcong/excoin/modules/gateApi/GateGridTradeService.java
@@ -1356,11 +1356,11 @@
         String reason = "";
 
         if (hasLong && hasShort) {
-            // 多空双边持仓:多均价 − 空均价 > span × step
-            BigDecimal gap = longAvgPrice.subtract(shortAvgPrice);
+            // 多空双边持仓:|多均价 − 空均价| > span × step
+            BigDecimal gap = shortAvgPrice.subtract(longAvgPrice);
             if (gap.compareTo(threshold) >= 0) {
                 shouldRestart = true;
-                reason = StrUtil.format("双边跨度 多均价:{} − 空均价:{} = {} > {} (span:{}×step:{})",
+                reason = StrUtil.format("双边跨度 |多均价:{} − 空均价:{}| = {} >= {} (span:{}×step:{})",
                         longAvgPrice, shortAvgPrice, gap, threshold, span, step);
             }
         } else if (hasLong) {

--
Gitblit v1.9.1