From 9e4e14a7761cf2b68e380ff9e94d3151aa608c18 Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Fri, 20 Nov 2026 17:40:38 +0800
Subject: [PATCH] fix(gateApi): 忽略Gate配置反序列化未知属性
---
src/main/java/com/xcong/excoin/modules/gateApi/GateGridTradeService.java | 19 ++++++++++++-------
1 files changed, 12 insertions(+), 7 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 c320a02..5490fca 100644
--- a/src/main/java/com/xcong/excoin/modules/gateApi/GateGridTradeService.java
+++ b/src/main/java/com/xcong/excoin/modules/gateApi/GateGridTradeService.java
@@ -567,7 +567,7 @@
}
// 异步检查盈亏,避免 REST 调用阻塞 WS 心跳导致 Socket closed
- executor.submitTask(this::checkProfitAndReset);
+ executor.submitMaintenanceTask(this::checkProfitAndReset);
// 持仓主动对账(节流):WS 持仓推送可能因断线盲区/推送延迟而失真,
// 导致本地持仓状态与交易所不一致、价格驱动重入迟迟不触发。
@@ -575,7 +575,7 @@
if ((state == StrategyState.ACTIVE || state == StrategyState.OPENING)
&& System.currentTimeMillis() - lastPositionSyncTime >= POSITION_SYNC_INTERVAL_MS) {
lastPositionSyncTime = System.currentTimeMillis();
- executor.submitTask(this::syncPositionsFromExchange);
+ executor.submitMaintenanceTask(this::syncPositionsFromExchange);
}
if (state == StrategyState.ACTIVE &&
@@ -3455,8 +3455,11 @@
}
// 单位置全量止损:当前方向全部持仓挂一张止损单(入场格下方第2格,价格≤触发价平多)。
- // 取 max 是为了在 REST 时序竞态导致 filledQty 偏小时,至少保住 baseQuantity 的基础仓位
- int slSize = Math.max(filledQty, Integer.parseInt(config.getBaseQuantity()));
+ // 原始仓位减仓模式:止损必须严格等于实际持仓,否则下次止损的“被平数量”会被撑回 baseQuantity,
+ // 导致递减卡死(base-step 后不再继续递减);非减仓模式才用 max(filledQty, baseQuantity) 兜底。
+ int slSize = config.getOriginalPositionReduce() > 0
+ ? filledQty
+ : Math.max(filledQty, Integer.parseInt(config.getBaseQuantity()));
AtomicInteger remainCount = new AtomicInteger(1);
int sgId = gridId - 2;
placeStopLossOrders(sgId, 1, String.valueOf(slSize), FuturesPriceTrigger.RuleEnum.NUMBER_2,
@@ -3479,8 +3482,10 @@
}
// 单位置全量止损:当前方向全部持仓挂一张止损单(入场格上方第2格,价格≥触发价平空)。
- // 取 max 是为了在 REST 时序竞态导致 filledQty 偏小时,至少保住 baseQuantity 的基础仓位
- int slSize = Math.max(filledQty, Integer.parseInt(config.getBaseQuantity()));
+ // 原始仓位减仓模式:止损必须严格等于实际持仓,避免递减卡死;非减仓模式才用 max 兜底。
+ int slSize = config.getOriginalPositionReduce() > 0
+ ? filledQty
+ : Math.max(filledQty, Integer.parseInt(config.getBaseQuantity()));
AtomicInteger remainCount = new AtomicInteger(1);
int sgId = gridId + 2;
placeStopLossOrders(sgId, 1, String.valueOf(slSize), FuturesPriceTrigger.RuleEnum.NUMBER_1,
@@ -3740,7 +3745,7 @@
if (wsClient != null) {
wsClient.setOnAllSubscribedCallback(() -> {
if (state == StrategyState.ACTIVE || state == StrategyState.OPENING) {
- executor.submitTask(this::syncPositionsFromExchange);
+ executor.submitMaintenanceTask(this::syncPositionsFromExchange);
}
});
}
--
Gitblit v1.9.1