From bae908e42a8f96042684eaff203fba0aedcdee6c Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Mon, 01 Jun 2026 10:38:43 +0800
Subject: [PATCH] feat(gateApi): 添加基底开仓和预期收益配置及止损机制

---
 src/main/java/com/xcong/excoin/modules/gateApi/GateConfig.java |   18 ++++++++++++++++++
 1 files changed, 18 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 a583c2f..9b207cc 100644
--- a/src/main/java/com/xcong/excoin/modules/gateApi/GateConfig.java
+++ b/src/main/java/com/xcong/excoin/modules/gateApi/GateConfig.java
@@ -81,6 +81,10 @@
     private final BigDecimal maxLoss;
     /** 下单数量(合约张数) */
     private final String quantity;
+    /** 基底开仓张数(初始化时多空各开的张数,如 "10") */
+    private final String baseQuantity;
+    /** 预期收益(USDT),unrealisedPnl + available > 初始本金 + 此值时重置 */
+    private final BigDecimal expectedProfit;
     /** 是否为生产环境 */
     private final boolean isProduction;
     /** 补仓最大重试次数 */
@@ -115,6 +119,8 @@
         this.overallTp = builder.overallTp;
         this.maxLoss = builder.maxLoss;
         this.quantity = builder.quantity;
+        this.baseQuantity = builder.baseQuantity;
+        this.expectedProfit = builder.expectedProfit;
         this.isProduction = builder.isProduction;
         this.reopenMaxRetries = builder.reopenMaxRetries;
         this.gridQueueSize = builder.gridQueueSize;
@@ -183,6 +189,10 @@
     public BigDecimal getMaxLoss() { return maxLoss; }
     /** @return 每次下单的张数(如 "1" 表示 1 张合约) */
     public String getQuantity() { return quantity; }
+    /** @return 基底开仓张数(初始化时多空各开的张数,如 "10") */
+    public String getBaseQuantity() { return baseQuantity; }
+    /** @return 预期收益(USDT),unrealisedPnl + available > 初始本金 + 此值时重置 */
+    public BigDecimal getExpectedProfit() { return expectedProfit; }
     /** @return 网格价格队列的容量上限(超出时截断尾部) */
     public int getGridQueueSize() { return gridQueueSize; }
 
@@ -271,6 +281,10 @@
         private BigDecimal maxLoss = new BigDecimal("7.5");
         /** 每次下单张数,默认 "1" */
         private String quantity = "1";
+        /** 基底开仓张数,默认 "10"(初始化时多空各开10张) */
+        private String baseQuantity = "10";
+        /** 预期收益(USDT),默认 0.5 */
+        private BigDecimal expectedProfit = new BigDecimal("0.5");
         /** 是否为生产环境,默认 false(测试网) */
         private boolean isProduction = false;
         /** 补仓最大重试次数,默认 3 */
@@ -306,6 +320,10 @@
         public Builder maxLoss(BigDecimal maxLoss) { this.maxLoss = maxLoss; return this; }
         /** 设置每次下单张数 */
         public Builder quantity(String quantity) { this.quantity = quantity; return this; }
+        /** 设置基底开仓张数 */
+        public Builder baseQuantity(String baseQuantity) { this.baseQuantity = baseQuantity; return this; }
+        /** 设置预期收益(USDT) */
+        public Builder expectedProfit(BigDecimal expectedProfit) { this.expectedProfit = expectedProfit; return this; }
         /** 设置环境(true=实盘生产网 / false=模拟盘测试网) */
         public Builder isProduction(boolean isProduction) { this.isProduction = isProduction; return this; }
         /** 设置补仓最大重试次数 */

--
Gitblit v1.9.1