From f0513901316421f781eda5df85d073716b7ecc0d Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Fri, 17 Jul 2026 16:30:33 +0800
Subject: [PATCH] feat(gate): 添加止盈网格跨度配置功能
---
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 3152b8c..f7e1d46 100644
--- a/src/main/java/com/xcong/excoin/modules/gateApi/GateConfig.java
+++ b/src/main/java/com/xcong/excoin/modules/gateApi/GateConfig.java
@@ -105,6 +105,8 @@
private final int restartGridSpan;
/** 止损阶梯次数:止损触发次数≤该值时挂单量=止损次数,超过后恢复默认逻辑。0=禁用,默认 0 */
private final int stopLossCount;
+ /** 止盈网格跨度:相邻止盈单跨越的网格数量,默认 2(即隔一格挂一个止盈单) */
+ private final int takeProfitGridSpan;
/** 网格绝对步长(shortBaseEntryPrice × gridRate),运行时由队列生成逻辑设置 */
private BigDecimal step;
/** 网格元素列表,由队列初始化时同步填充,包含完整的多空仓挂单状态 */
@@ -137,6 +139,7 @@
this.maxPositionSize = builder.maxPositionSize;
this.restartGridSpan = builder.restartGridSpan;
this.stopLossCount = builder.stopLossCount;
+ this.takeProfitGridSpan = builder.takeProfitGridSpan;
}
// ==================== REST/WS 地址 ====================
@@ -226,6 +229,8 @@
public int getRestartGridSpan() { return restartGridSpan; }
/** @return 止损阶梯次数:止损触发次数≤该值时挂单量=止损次数,超过后恢复默认逻辑。0=禁用 */
public int getStopLossCount() { return stopLossCount; }
+ /** @return 止盈网格跨度:相邻止盈单跨越的网格数量,默认 2 */
+ public int getTakeProfitGridSpan() { return takeProfitGridSpan; }
// ==================== 运行时参数 ====================
@@ -320,6 +325,8 @@
private int restartGridSpan = 0;
/** 止损阶梯次数:止损触发次数≤该值时挂单量=止损次数,超过后恢复默认逻辑。0=禁用,默认 0 */
private int stopLossCount = 0;
+ /** 止盈网格跨度:相邻止盈单跨越的网格数量,默认 2 */
+ private int takeProfitGridSpan = 2;
/** 设置 API Key */
public Builder apiKey(String apiKey) { this.apiKey = apiKey; return this; }
@@ -365,6 +372,8 @@
public Builder restartGridSpan(int restartGridSpan) { this.restartGridSpan = restartGridSpan; return this; }
/** 设置止损阶梯次数:止损触发次数≤该值时挂单量=止损次数,超过后恢复默认逻辑。0=禁用 */
public Builder stopLossCount(int stopLossCount) { this.stopLossCount = stopLossCount; return this; }
+ /** 设置止盈网格跨度:相邻止盈单跨越的网格数量,默认 2 */
+ public Builder takeProfitGridSpan(int takeProfitGridSpan) { this.takeProfitGridSpan = takeProfitGridSpan; return this; }
public GateConfig build() {
return new GateConfig(this);
--
Gitblit v1.9.1