From ff1a51a49e02aa347463257eccfab61c8c0cf0bd Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Sun, 20 Sep 2026 15:49:14 +0800
Subject: [PATCH] feat(station): 添加双开止损触发配置功能
---
src/main/resources/static/gate-config.html | 18 ++++++++++++++++--
1 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/src/main/resources/static/gate-config.html b/src/main/resources/static/gate-config.html
index 7c3d40e..319c8f3 100644
--- a/src/main/resources/static/gate-config.html
+++ b/src/main/resources/static/gate-config.html
@@ -133,6 +133,13 @@
<div class="form-group"><label>单边最大仓位量(张)</label><input id="maxPositionPerSide" type="number" placeholder="0(不限制)"></div>
<div class="form-group"><label>加仓启动阈值(次)</label><input id="addPositionStartThreshold" type="number" placeholder="1(前N次止损不加仓)"></div>
<div class="form-group"><label>超额止盈开关</label><select id="placeExcessTakeProfit"><option value="false" selected>关闭</option><option value="true">开启</option></select></div>
+ <!-- ===== 双开止损触发配置 ===== -->
+ <div class="form-group full" style="margin-top:6px;border-top:1px solid var(--border);padding-top:8px">
+ <label style="font-size:13px;font-weight:600;color:var(--text)">双开止损触发</label>
+ </div>
+ <div class="form-group"><label>双开止损触发开关</label><select id="dualStopLossEnabled"><option value="false" selected>关闭</option><option value="true">开启</option></select></div>
+ <div class="form-group"><label>多头止损触发价</label><input id="longStopLossPrice" placeholder="如 2540"></div>
+ <div class="form-group"><label>空头止损触发价</label><input id="shortStopLossPrice" placeholder="如 2650"></div>
</form>
</div>
@@ -209,7 +216,8 @@
// 文件不存在 → 用默认值填充,用户可编辑后保存
fillForm({ gridRate:0.005, expectedProfit:0.15, maxLoss:1.5,
baseQuantity:'2', quantity:'2', maxPositionSize:4, stopLossCount:0, takeProfitGridSpan:2, priceDriveEnabled: true, rounds: 0,
- stopLossCountMode:'dual', addPositionInterval:3, addPositionQuantity:1, maxPositionPerSide:0, addPositionStartThreshold:1, placeExcessTakeProfit: false });
+ stopLossCountMode:'dual', addPositionInterval:3, addPositionQuantity:1, maxPositionPerSide:0, addPositionStartThreshold:1, placeExcessTakeProfit: false,
+ dualStopLossEnabled: false, longStopLossPrice: '', shortStopLossPrice: '' });
toast('未找到配置,已加载默认值,编辑后请保存', 'success');
}
currentApiKey = key;
@@ -235,6 +243,9 @@
byId('maxPositionPerSide').value = d.maxPositionPerSide ?? 0;
byId('addPositionStartThreshold').value = d.addPositionStartThreshold ?? 1;
byId('placeExcessTakeProfit').value = (d.placeExcessTakeProfit === true || d.placeExcessTakeProfit === 'true') ? 'true' : 'false';
+ byId('dualStopLossEnabled').value = (d.dualStopLossEnabled === true || d.dualStopLossEnabled === 'true') ? 'true' : 'false';
+ byId('longStopLossPrice').value = d.longStopLossPrice || '';
+ byId('shortStopLossPrice').value = d.shortStopLossPrice || '';
}
function collectForm() {
@@ -255,7 +266,10 @@
addPositionQuantity: intVal(byId('addPositionQuantity').value, 1),
maxPositionPerSide: intVal(byId('maxPositionPerSide').value, 0),
addPositionStartThreshold: intVal(byId('addPositionStartThreshold').value, 1),
- placeExcessTakeProfit: byId('placeExcessTakeProfit').value === 'true'
+ placeExcessTakeProfit: byId('placeExcessTakeProfit').value === 'true',
+ dualStopLossEnabled: byId('dualStopLossEnabled').value === 'true',
+ longStopLossPrice: byId('longStopLossPrice').value,
+ shortStopLossPrice: byId('shortStopLossPrice').value
};
}
function intVal(str, fallback) {
--
Gitblit v1.9.1