From 20b12242108398ad04903e620c94262d4b228ed0 Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Sat, 09 May 2026 18:16:15 +0800
Subject: [PATCH] refactor(gateApi): 优化期货交易配置和日志记录

---
 src/main/java/com/xcong/excoin/modules/gateApi/GateGridTradeService.java |   17 ++++++++---------
 1 files changed, 8 insertions(+), 9 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 fc47591..d9c2310 100644
--- a/src/main/java/com/xcong/excoin/modules/gateApi/GateGridTradeService.java
+++ b/src/main/java/com/xcong/excoin/modules/gateApi/GateGridTradeService.java
@@ -166,6 +166,14 @@
                 }
             }
 
+            try {
+                futuresApi.updateDualModePositionLeverageCall(
+                        SETTLE, config.getContract(), config.getLeverage(),
+                        null, null).execute();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+
             if (!config.getMarginMode().equals(account.getMarginMode())) {
 
                 UpdateDualCompPositionCrossModeRequest updateDualCompPositionCrossModeRequest = new UpdateDualCompPositionCrossModeRequest();
@@ -178,15 +186,6 @@
                 }
             }
             log.info("[Gate] 持仓模式: {} 余额: {}", config.getPositionMode(), account.getAvailable());
-
-
-            try {
-                futuresApi.updateDualModePositionLeverageCall(
-                        SETTLE, config.getContract(), config.getLeverage(),
-                        config.getMarginMode(), null).execute();
-            } catch (IOException e) {
-                e.printStackTrace();
-            }
             log.info("[Gate] 杠杆: {}x {}", config.getLeverage(), config.getMarginMode());
         } catch (GateApiException e) {
             log.error("[Gate] 初始化失败, label:{}, msg:{}", e.getErrorLabel(), e.getMessage());

--
Gitblit v1.9.1