From aaa9b2d954e3dc3c1588ecbb749b46b413c5fc5b Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Sat, 06 Jun 2026 11:40:02 +0800
Subject: [PATCH] refactor(gateApi): 优化网格交易服务中的变量作用域
---
src/main/java/com/xcong/excoin/modules/gateApi/GateGridTradeService.java | 6 ++++--
1 files changed, 4 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 352f61d..09c4731 100644
--- a/src/main/java/com/xcong/excoin/modules/gateApi/GateGridTradeService.java
+++ b/src/main/java/com/xcong/excoin/modules/gateApi/GateGridTradeService.java
@@ -1559,20 +1559,22 @@
}
BigDecimal tpPrice = nextGrid.getGridPrice();
+ final long finalPosSize = actualPosSize;
+ final int finalNextGridId = nextGridId;
if (isLong) {
executor.placeTakeProfit(tpPrice,
FuturesPriceTrigger.RuleEnum.NUMBER_1,
ORDER_TYPE_CLOSE_LONG,
negate(config.getQuantity()),
profitId -> log.info("[Gate] 多仓超限止盈已挂(持仓:{})>, gridId:{}, tpPrice:{}, id:{}",
- actualPosSize, nextGridId, tpPrice, profitId));
+ finalPosSize, finalNextGridId, tpPrice, profitId));
} else {
executor.placeTakeProfit(tpPrice,
FuturesPriceTrigger.RuleEnum.NUMBER_2,
ORDER_TYPE_CLOSE_SHORT,
config.getQuantity(),
profitId -> log.info("[Gate] 空仓超限止盈已挂(持仓:{})>, gridId:{}, tpPrice:{}, id:{}",
- actualPosSize, nextGridId, tpPrice, profitId));
+ finalPosSize, finalNextGridId, tpPrice, profitId));
}
} catch (Exception e) {
log.warn("[Gate] 通过API查询持仓超限检查失败", e);
--
Gitblit v1.9.1