From a34c957d1a40a1b23e59742bebd4bcebed21bf88 Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Thu, 18 Jun 2026 10:52:44 +0800
Subject: [PATCH] fix(gateApi): 修复网格交易止损单数量计算逻辑
---
src/main/java/com/xcong/excoin/modules/gateApi/GateGridTradeService.java | 10 ++++++----
1 files changed, 6 insertions(+), 4 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 dc78d98..aeb9d38 100644
--- a/src/main/java/com/xcong/excoin/modules/gateApi/GateGridTradeService.java
+++ b/src/main/java/com/xcong/excoin/modules/gateApi/GateGridTradeService.java
@@ -1246,8 +1246,9 @@
furthestSlId = gridId;
interval = 2;
}
- log.info("[Gate] 多仓追挂止损, 当前最远止损gridId:{}, 追加{}张", furthestSlId, filledQty);
- for (int i = 0; i < filledQty; i++) {
+ int stopLossCount = filledQty / Integer.parseInt(config.getQuantity());
+ log.info("[Gate] 多仓追挂止损, 当前最远止损gridId:{}, 成交{}张, 追加{}个止损单", furthestSlId, filledQty, stopLossCount);
+ for (int i = 0; i < stopLossCount; i++) {
int newSlId = furthestSlId - i - interval;
GridElement elem = GridElement.findById(newSlId);
if (elem == null) {
@@ -1282,8 +1283,9 @@
furthestSlId = gridId;
interval = 2;
}
- log.info("[Gate] 空仓追挂止损, 当前最远止损gridId:{}, 追加{}张", furthestSlId, filledQty);
- for (int i = 0; i < filledQty; i++) {
+ int stopLossCount = filledQty / Integer.parseInt(config.getQuantity());
+ log.info("[Gate] 空仓追挂止损, 当前最远止损gridId:{}, 成交{}张, 追加{}个止损单", furthestSlId, filledQty, stopLossCount);
+ for (int i = 0; i < stopLossCount; i++) {
int newSlId = furthestSlId + i + interval;
GridElement elem = GridElement.findById(newSlId);
if (elem == null) {
--
Gitblit v1.9.1