From 1e33be19e4796b2aa758f8c2091f43c595bd7519 Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Wed, 22 Jul 2026 16:17:42 +0800
Subject: [PATCH] feat(gate): 添加策略运行轮数限制功能

---
 src/main/resources/static/gate-config.html |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/main/resources/static/gate-config.html b/src/main/resources/static/gate-config.html
index cbb6b2d..1b41299 100644
--- a/src/main/resources/static/gate-config.html
+++ b/src/main/resources/static/gate-config.html
@@ -116,6 +116,7 @@
             <div class="form-group"><label>止损阶梯次数</label><input id="stopLossCount" placeholder="0"></div>
             <div class="form-group"><label>止盈网格跨度</label><input id="takeProfitGridSpan" placeholder="2"></div>
             <div class="form-group"><label>价格驱动开关</label><select id="priceDriveEnabled"><option value="true" selected>开启</option><option value="false">关闭</option></select></div>
+            <div class="form-group"><label>运行轮数(0=不限)</label><input id="rounds" type="number" placeholder="0"></div>
         </form>
     </div>
 
@@ -191,7 +192,7 @@
     } catch(e) {
         // 文件不存在 → 用默认值填充,用户可编辑后保存
         fillForm({ gridRate:0.005, expectedProfit:0.15, maxLoss:1.5,
-            baseQuantity:'2', quantity:'2', maxPositionSize:4, stopLossCount:0, takeProfitGridSpan:2, priceDriveEnabled: true });
+            baseQuantity:'2', quantity:'2', maxPositionSize:4, stopLossCount:0, takeProfitGridSpan:2, priceDriveEnabled: true, rounds: 0 });
         toast('未找到配置,已加载默认值,编辑后请保存', 'success');
     }
     currentApiKey = key;
@@ -210,6 +211,7 @@
     byId('stopLossCount').value = d.stopLossCount ?? '';
     byId('takeProfitGridSpan').value = d.takeProfitGridSpan ?? '';
     byId('priceDriveEnabled').value = (d.priceDriveEnabled === true || d.priceDriveEnabled === 'true') ? 'true' : 'false';
+    byId('rounds').value = d.rounds ?? 0;
 }
 
 function collectForm() {
@@ -223,7 +225,8 @@
         maxPositionSize: parseInt(byId('maxPositionSize').value) || 0,
         stopLossCount: parseInt(byId('stopLossCount').value) || 0,
         takeProfitGridSpan: parseInt(byId('takeProfitGridSpan').value) || 2,
-        priceDriveEnabled: byId('priceDriveEnabled').value === 'true'
+        priceDriveEnabled: byId('priceDriveEnabled').value === 'true',
+        rounds: parseInt(byId('rounds').value) || 0
     };
 }
 

--
Gitblit v1.9.1