From bec5d2437d131d51190ef639b2e4c776d2682391 Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Mon, 21 Sep 2026 09:57:12 +0800
Subject: [PATCH] refactor(gate): 重命名自定义止损相关字段以提高语义清晰度
---
src/main/java/com/xcong/excoin/modules/gateApi/GateGridTradeService.java | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 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 3b1fde1..67fa846 100644
--- a/src/main/java/com/xcong/excoin/modules/gateApi/GateGridTradeService.java
+++ b/src/main/java/com/xcong/excoin/modules/gateApi/GateGridTradeService.java
@@ -150,7 +150,7 @@
/** 最近触发止损的空头网格ID */
private volatile int lastShortStopLossGridId = Integer.MAX_VALUE;
/** 自定义止损模式激活标记:true=尚未发生第一次止损触发,第一次触发后置 false(触发未触发侧重挂默认) */
- private final AtomicBoolean customStopLossModeActive = new AtomicBoolean(false);
+ private final AtomicBoolean dualStopLossModeActive = new AtomicBoolean(false);
private volatile BigDecimal lastKlinePrice;
private volatile BigDecimal markPrice = BigDecimal.ZERO;
@@ -365,7 +365,7 @@
accumulatedShortLossCount = 0;
lastLongStopLossGridId = Integer.MAX_VALUE;
lastShortStopLossGridId = Integer.MAX_VALUE;
- customStopLossModeActive.set(false);
+ dualStopLossModeActive.set(false);
shortPriceQueue.clear();
longPriceQueue.clear();
totalShortPriceQueue.clear();
@@ -978,7 +978,7 @@
// );
// }
- if (config.isCustomStopLossEnabled()) {
+ if (config.isDualStopLossEnabled()) {
placeCustomStopLosses();
} else {
placeDefaultStopLossLadders();
@@ -995,10 +995,10 @@
* 多仓止损:NUMBER_2(价格 ≤ 触发价平多),空仓止损:NUMBER_1(价格 ≥ 触发价平空)。
*/
private void placeCustomStopLosses() {
- customStopLossModeActive.set(true);
+ dualStopLossModeActive.set(true);
String baseQty = config.getBaseQuantity();
- BigDecimal longPrice = config.getLongCustomStopLossPrice();
- BigDecimal shortPrice = config.getShortCustomStopLossPrice();
+ BigDecimal longPrice = config.getLongStopLossPrice();
+ BigDecimal shortPrice = config.getShortStopLossPrice();
if (longPrice != null && longPrice.compareTo(BigDecimal.ZERO) > 0) {
GridElement longElem = findNearestGridElementByPrice(longPrice);
@@ -1654,7 +1654,7 @@
}
// 自定义止损模式:第一次止损触发时,取消未触发侧(空仓)自定义止损单并重挂默认阶梯
- if (config.isCustomStopLossEnabled() && customStopLossModeActive.compareAndSet(true, false)) {
+ if (config.isDualStopLossEnabled() && dualStopLossModeActive.compareAndSet(true, false)) {
cancelAllShortStopLossesOnly();
placeDefaultShortStopLossLadder();
log.info("[Gate] 自定义止损首次触发(多仓), 已取消空仓自定义止损并重挂默认阶梯");
@@ -1713,7 +1713,7 @@
}
// 自定义止损模式:第一次止损触发时,取消未触发侧(多仓)自定义止损单并重挂默认阶梯
- if (config.isCustomStopLossEnabled() && customStopLossModeActive.compareAndSet(true, false)) {
+ if (config.isDualStopLossEnabled() && dualStopLossModeActive.compareAndSet(true, false)) {
cancelAllLongStopLossesOnly();
placeDefaultLongStopLossLadder();
log.info("[Gate] 自定义止损首次触发(空仓), 已取消多仓自定义止损并重挂默认阶梯");
--
Gitblit v1.9.1