From 8cadc2c947d541bd2621892b5764d2d3e7697cad Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Fri, 30 Oct 2026 17:49: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 6bc4530..f87a98a 100644
--- a/src/main/java/com/xcong/excoin/modules/gateApi/GateConfig.java
+++ b/src/main/java/com/xcong/excoin/modules/gateApi/GateConfig.java
@@ -142,6 +142,8 @@
     private final boolean tpTriggerOppositeAddEnabled;
     /** 对向加仓挂单数量:止盈成交后在对向挂出的开仓张数,0=不启用。默认 0 */
     private final int tpTriggerOppositeAddQuantity;
+    /** 仓位止盈补仓开关:true=止盈触发时在对侧止损位挂同方向同张数开仓单,false=保持现有逻辑。默认 false */
+    private final boolean tpPositionReplenishEnabled;
     /** 单格止盈张数:基础仓位止盈挂单时每个网格挂的止盈张数,支持小数。默认 0 */
     private final BigDecimal baseTakeProfitPerGrid;
     /** 止盈网格数量:基础仓位止盈挂单的网格数量。默认 0 */
@@ -193,6 +195,7 @@
         this.shortStopLossPrice = builder.shortStopLossPrice;
         this.tpTriggerOppositeAddEnabled = builder.tpTriggerOppositeAddEnabled;
         this.tpTriggerOppositeAddQuantity = builder.tpTriggerOppositeAddQuantity;
+        this.tpPositionReplenishEnabled = builder.tpPositionReplenishEnabled;
         this.baseTakeProfitPerGrid = builder.baseTakeProfitPerGrid;
         this.baseTakeProfitGridCount = builder.baseTakeProfitGridCount;
     }
@@ -314,6 +317,8 @@
     public boolean isTpTriggerOppositeAddEnabled() { return tpTriggerOppositeAddEnabled; }
     /** @return 对向加仓挂单数量:止盈成交后在对向挂出的开仓张数 */
     public int getTpTriggerOppositeAddQuantity() { return tpTriggerOppositeAddQuantity; }
+    /** @return 仓位止盈补仓开关:true=止盈触发时在对侧止损位挂同方向同张数开仓单 */
+    public boolean isTpPositionReplenishEnabled() { return tpPositionReplenishEnabled; }
     /** @return 单格止盈张数:基础仓位止盈挂单时每个网格挂的止盈张数 */
     public BigDecimal getBaseTakeProfitPerGrid() { return baseTakeProfitPerGrid; }
     /** @return 止盈网格数量:基础仓位止盈挂单的网格数量 */
@@ -442,6 +447,8 @@
         private boolean tpTriggerOppositeAddEnabled = false;
         /** 对向加仓挂单数量:止盈成交后在对向挂出的开仓张数,默认 0 */
         private int tpTriggerOppositeAddQuantity = 0;
+        /** 仓位止盈补仓开关:true=止盈触发时在对侧止损位挂同方向同张数开仓单。默认 false */
+        private boolean tpPositionReplenishEnabled = false;
         /** 单格止盈张数:基础仓位止盈挂单时每个网格挂的止盈张数,默认 0 */
         private BigDecimal baseTakeProfitPerGrid = BigDecimal.ZERO;
         /** 止盈网格数量:基础仓位止盈挂单的网格数量,默认 0 */
@@ -521,6 +528,8 @@
         public Builder tpTriggerOppositeAddEnabled(boolean tpTriggerOppositeAddEnabled) { this.tpTriggerOppositeAddEnabled = tpTriggerOppositeAddEnabled; return this; }
         /** 设置对向加仓挂单数量:止盈成交后在对向挂出的开仓张数 */
         public Builder tpTriggerOppositeAddQuantity(int tpTriggerOppositeAddQuantity) { this.tpTriggerOppositeAddQuantity = tpTriggerOppositeAddQuantity; return this; }
+        /** 设置仓位止盈补仓开关:true=启用,false=禁用 */
+        public Builder tpPositionReplenishEnabled(boolean tpPositionReplenishEnabled) { this.tpPositionReplenishEnabled = tpPositionReplenishEnabled; return this; }
         /** 设置单格止盈张数:基础仓位止盈挂单时每个网格挂的止盈张数 */
         public Builder baseTakeProfitPerGrid(BigDecimal baseTakeProfitPerGrid) { this.baseTakeProfitPerGrid = baseTakeProfitPerGrid; return this; }
         /** 设置止盈网格数量:基础仓位止盈挂单的网格数量 */

--
Gitblit v1.9.1