From 407d57775caf5aab64e38ef666dad349f29f4f1d Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Mon, 21 Sep 2026 09:55:29 +0800
Subject: [PATCH] feat(gate): 添加网格交易手动控制功能
---
src/main/java/com/xcong/excoin/modules/gateApi/GateConfigDTO.java | 23 +++++++++++++++++++----
1 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/src/main/java/com/xcong/excoin/modules/gateApi/GateConfigDTO.java b/src/main/java/com/xcong/excoin/modules/gateApi/GateConfigDTO.java
index 97be386..8a7b16c 100644
--- a/src/main/java/com/xcong/excoin/modules/gateApi/GateConfigDTO.java
+++ b/src/main/java/com/xcong/excoin/modules/gateApi/GateConfigDTO.java
@@ -69,8 +69,14 @@
private int maxPositionPerSide;
/** 加仓启动阈值:前N次止损不触发加仓,默认 1 */
private int addPositionStartThreshold;
- /** 超额止盈开关:true=挂单成交后将超出基础仓位的部分挂止盈单,默认 false */
- private boolean placeExcessTakeProfit;
+ /** 止盈挂单模式:off=关闭 / concentrated=集中止盈 / dispersed=分散止盈,默认 off */
+ private String placeExcessTakeProfit;
+ /** 自定义止损开关:true=启用自定义止损触发价,false=使用默认阶梯止损。null=未设置(默认false) */
+ private Boolean customStopLossEnabled;
+ /** 多仓自定义止损触发价(价格跌至该值触发平多),null=未设置 */
+ private BigDecimal longCustomStopLossPrice;
+ /** 空仓自定义止损触发价(价格涨至该值触发平空),null=未设置 */
+ private BigDecimal shortCustomStopLossPrice;
/**
* 从 GateConfig 构建 DTO(不暴露 apiSecret)。
@@ -103,7 +109,10 @@
.addPositionQuantity(config.getAddPositionQuantity())
.maxPositionPerSide(config.getMaxPositionPerSide())
.addPositionStartThreshold(config.getAddPositionStartThreshold())
- .placeExcessTakeProfit(config.isPlaceExcessTakeProfit())
+ .placeExcessTakeProfit(config.getPlaceExcessTakeProfit())
+ .customStopLossEnabled(config.isCustomStopLossEnabled())
+ .longCustomStopLossPrice(config.getLongCustomStopLossPrice())
+ .shortCustomStopLossPrice(config.getShortCustomStopLossPrice())
.build();
}
@@ -131,6 +140,9 @@
m.put("maxPositionPerSide", maxPositionPerSide);
m.put("addPositionStartThreshold", addPositionStartThreshold);
m.put("placeExcessTakeProfit", placeExcessTakeProfit);
+ m.put("customStopLossEnabled", customStopLossEnabled);
+ m.put("longCustomStopLossPrice", longCustomStopLossPrice);
+ m.put("shortCustomStopLossPrice", shortCustomStopLossPrice);
return m;
}
@@ -164,7 +176,10 @@
.addPositionQuantity(1)
.maxPositionPerSide(0)
.addPositionStartThreshold(1)
- .placeExcessTakeProfit(false)
+ .placeExcessTakeProfit("off")
+ .customStopLossEnabled(false)
+ .longCustomStopLossPrice(null)
+ .shortCustomStopLossPrice(null)
.build();
}
}
--
Gitblit v1.9.1