From 69033878fd7a40ba429113463b69e08e0f081b01 Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Thu, 25 Jun 2026 23:36:04 +0800
Subject: [PATCH] fix(gateApi): 解决交易所持仓查询延迟导致的持仓数量错误问题
---
src/main/java/com/xcong/excoin/modules/gateApi/GateConfig.java | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/src/main/java/com/xcong/excoin/modules/gateApi/GateConfig.java b/src/main/java/com/xcong/excoin/modules/gateApi/GateConfig.java
index 4a641e7..81e2209 100644
--- a/src/main/java/com/xcong/excoin/modules/gateApi/GateConfig.java
+++ b/src/main/java/com/xcong/excoin/modules/gateApi/GateConfig.java
@@ -101,6 +101,8 @@
private final PnLPriceMode unrealizedPnlPriceMode;
/** 最大持仓张数(单方向),0=不限制 */
private final int maxPositionSize;
+ /** 策略重启跨度阈值:多空两边止盈触发数量均达到此值后触发重启,0=禁用 */
+ private final int restartGridSpan;
/** 网格绝对步长(shortBaseEntryPrice × gridRate),运行时由队列生成逻辑设置 */
private BigDecimal step;
/** 网格元素列表,由队列初始化时同步填充,包含完整的多空仓挂单状态 */
@@ -131,6 +133,7 @@
this.priceScale = builder.priceScale;
this.unrealizedPnlPriceMode = builder.unrealizedPnlPriceMode;
this.maxPositionSize = builder.maxPositionSize;
+ this.restartGridSpan = builder.restartGridSpan;
}
// ==================== REST/WS 地址 ====================
@@ -216,6 +219,8 @@
public PnLPriceMode getUnrealizedPnlPriceMode() { return unrealizedPnlPriceMode; }
/** @return 最大持仓张数(单方向),0=不限制 */
public int getMaxPositionSize() { return maxPositionSize; }
+ /** @return 策略重启跨度阈值:多空两边止盈触发数均达到此值后触发重启,0=禁用 */
+ public int getRestartGridSpan() { return restartGridSpan; }
// ==================== 运行时参数 ====================
@@ -306,6 +311,8 @@
private PnLPriceMode unrealizedPnlPriceMode = PnLPriceMode.LAST_PRICE;
/** 最大持仓张数(单方向),默认 0=不限制 */
private int maxPositionSize = 0;
+ /** 策略重启跨度阈值:多空两边止盈触发数量均达到此值后触发重启,默认 0=禁用 */
+ private int restartGridSpan = 0;
/** 设置 API Key */
public Builder apiKey(String apiKey) { this.apiKey = apiKey; return this; }
@@ -347,6 +354,8 @@
public Builder unrealizedPnlPriceMode(PnLPriceMode mode) { this.unrealizedPnlPriceMode = mode; return this; }
/** 设置最大持仓张数(单方向),0=不限制 */
public Builder maxPositionSize(int maxPositionSize) { this.maxPositionSize = maxPositionSize; return this; }
+ /** 设置策略重启跨度阈值:多空两边止盈触发数均达到此值后触发重启,0=禁用 */
+ public Builder restartGridSpan(int restartGridSpan) { this.restartGridSpan = restartGridSpan; return this; }
public GateConfig build() {
return new GateConfig(this);
--
Gitblit v1.9.1