From 01da1f754426a1285fc20b9cf1b80672b16d8814 Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Fri, 08 May 2026 15:04:28 +0800
Subject: [PATCH] refactor(gateApi): 重构网格交易服务添加补仓重试机制

---
 src/main/java/com/xcong/excoin/modules/gateApi/wsHandler/handler/PositionClosesChannelHandler.java |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/src/main/java/com/xcong/excoin/modules/gateApi/wsHandler/handler/PositionClosesChannelHandler.java b/src/main/java/com/xcong/excoin/modules/gateApi/wsHandler/handler/PositionClosesChannelHandler.java
index 78f6c14..78950bb 100644
--- a/src/main/java/com/xcong/excoin/modules/gateApi/wsHandler/handler/PositionClosesChannelHandler.java
+++ b/src/main/java/com/xcong/excoin/modules/gateApi/wsHandler/handler/PositionClosesChannelHandler.java
@@ -36,21 +36,27 @@
 
     @Override
     public boolean handleMessage(JSONObject response) {
-        if (!CHANNEL_NAME.equals(response.getString("channel"))) return false;
+        if (!CHANNEL_NAME.equals(response.getString("channel"))) {
+            return false;
+        }
         try {
             JSONArray resultArray = response.getJSONArray("result");
-            if (resultArray == null || resultArray.isEmpty()) return true;
+            if (resultArray == null || resultArray.isEmpty()) {
+                return true;
+            }
             for (int i = 0; i < resultArray.size(); i++) {
                 JSONObject item = resultArray.getJSONObject(i);
-                if (!getContract().equals(item.getString("contract"))) continue;
+                if (!getContract().equals(item.getString("contract"))) {
+                    continue;
+                }
                 BigDecimal pnl = new BigDecimal(item.getString("pnl"));
                 String side = item.getString("side");
-                log.info("[{}] side:{}, pnl:{}", CHANNEL_NAME, side, pnl);
+                log.info("[{}] 平仓更新, 方向:{}, 盈亏:{}", CHANNEL_NAME, side, pnl);
                 if (getGridTradeService() != null) {
                     getGridTradeService().onPositionClose(getContract(), side, pnl);
                 }
             }
-        } catch (Exception e) { log.error("[{}] handle fail", CHANNEL_NAME, e); }
+        } catch (Exception e) { log.error("[{}] 处理数据失败", CHANNEL_NAME, e); }
         return true;
     }
 }

--
Gitblit v1.9.1