From b7a2fa0ea40b15bd5b60d737cb96764884dcaaaa Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Thu, 28 May 2026 11:07:12 +0800
Subject: [PATCH] config(gateApi): 更新任意仓位变化,检查多空两边那些需要同时取消挂单

---
 src/main/java/com/xcong/excoin/modules/gateApi/GridElement.java |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/main/java/com/xcong/excoin/modules/gateApi/GridElement.java b/src/main/java/com/xcong/excoin/modules/gateApi/GridElement.java
index 0b9ef82..010042e 100644
--- a/src/main/java/com/xcong/excoin/modules/gateApi/GridElement.java
+++ b/src/main/java/com/xcong/excoin/modules/gateApi/GridElement.java
@@ -245,10 +245,10 @@
      *
      * @return 已挂多仓条件单的 GridElement 列表
      */
-    public static List<GridElement> findAllLongOrders(BigDecimal currentPrice) {
+    public static List<GridElement> findAllShortOrders(BigDecimal currentPrice) {
         List<GridElement> result = new ArrayList<>();
         for (GridElement e : INDEX.values()) {
-            if (e.isHasShortOrder() && e.getGridPrice().compareTo(currentPrice) < 0) {
+            if (e.isHasShortOrder() && e.getGridPrice().compareTo(currentPrice) < 0 && e.getShortTakeProfitOrderId() == null) {
                 result.add(e);
             }
         }
@@ -261,10 +261,10 @@
      *
      * @return 已挂空仓条件单的 GridElement 列表
      */
-    public static List<GridElement> findAllShortOrders(BigDecimal currentPrice) {
+    public static List<GridElement> findAllLongOrders(BigDecimal currentPrice) {
         List<GridElement> result = new ArrayList<>();
         for (GridElement e : INDEX.values()) {
-            if (e.isHasLongOrder() && e.getGridPrice().compareTo(currentPrice) > 0) {
+            if (e.isHasLongOrder() && e.getGridPrice().compareTo(currentPrice) > 0 && e.getLongTakeProfitOrderId() == null) {
                 result.add(e);
             }
         }

--
Gitblit v1.9.1