From 9787ba2e4ea3d6299faaceb486df74d24be1fe7d Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Fri, 17 Jul 2026 16:31:13 +0800
Subject: [PATCH] feat(gate): 添加止盈网格跨度配置功能
---
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 6b06c95..592992a 100644
--- a/src/main/java/com/xcong/excoin/modules/gateApi/GateGridTradeService.java
+++ b/src/main/java/com/xcong/excoin/modules/gateApi/GateGridTradeService.java
@@ -672,8 +672,9 @@
int shortGridQty = Integer.parseInt(config.getQuantity());
int shortTpCount = posSize > shortBaseQty ? (posSize - shortBaseQty) / shortGridQty : 0;
+ int tpSpan = config.getTakeProfitGridSpan();
for (int i = 0; i < shortTpCount; i++) {
- int tpGridId = shortGridElement.getId() - 2 * (i + 1);
+ int tpGridId = shortGridElement.getId() - tpSpan * (i + 1);
GridElement tpElem = GridElement.findById(tpGridId);
// 用 takeProfitPlaced 做同步标记,避免异步回调未执行时重复挂单
if (tpElem == null || tpElem.getShortTraderParam().isTakeProfitPlaced()) {
@@ -740,8 +741,9 @@
int longGridQty = Integer.parseInt(config.getQuantity());
int longTpCount = posSize > longBaseQty ? (posSize - longBaseQty) / longGridQty : 0;
+ int tpSpan = config.getTakeProfitGridSpan();
for (int i = 0; i < longTpCount; i++) {
- int tpGridId = longGridElement.getId() + 2 * (i + 1);
+ int tpGridId = longGridElement.getId() + tpSpan * (i + 1);
GridElement tpElem = GridElement.findById(tpGridId);
// 用 takeProfitPlaced 做同步标记,避免异步回调未执行时重复挂单
if (tpElem == null || tpElem.getLongTraderParam().isTakeProfitPlaced()) {
--
Gitblit v1.9.1