From f0513901316421f781eda5df85d073716b7ecc0d Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Fri, 17 Jul 2026 16:30:33 +0800
Subject: [PATCH] feat(gate): 添加止盈网格跨度配置功能
---
src/main/resources/static/gate-config.html | 35 +++++++++++++++++++----------------
1 files changed, 19 insertions(+), 16 deletions(-)
diff --git a/src/main/resources/static/gate-config.html b/src/main/resources/static/gate-config.html
index f0c146a..8d91360 100644
--- a/src/main/resources/static/gate-config.html
+++ b/src/main/resources/static/gate-config.html
@@ -114,6 +114,7 @@
<div class="form-group"><label>每次下单张数</label><input id="quantity" placeholder="2"></div>
<div class="form-group"><label>最大持仓张数</label><input id="maxPositionSize" placeholder="4"></div>
<div class="form-group"><label>止损阶梯次数</label><input id="stopLossCount" placeholder="0"></div>
+ <div class="form-group"><label>止盈网格跨度</label><input id="takeProfitGridSpan" placeholder="2"></div>
</form>
</div>
@@ -136,7 +137,7 @@
let logLines = [];
const logPanel = document.getElementById('logPanel');
-function $(id) { return document.getElementById(id); }
+function byId(id) { return document.getElementById(id); }
function toast(msg, type) {
const t = document.getElementById('toast');
@@ -189,7 +190,7 @@
} catch(e) {
// 文件不存在 → 用默认值填充,用户可编辑后保存
fillForm({ gridRate:0.005, expectedProfit:0.15, maxLoss:1.5,
- baseQuantity:'2', quantity:'2', maxPositionSize:4, stopLossCount:0 });
+ baseQuantity:'2', quantity:'2', maxPositionSize:4, stopLossCount:0, takeProfitGridSpan:2 });
toast('未找到配置,已加载默认值,编辑后请保存', 'success');
}
currentApiKey = key;
@@ -199,25 +200,27 @@
}
function fillForm(d) {
- $('#gridRate').value = d.gridRate || '';
- $('#expectedProfit').value = d.expectedProfit || '';
- $('#maxLoss').value = d.maxLoss || '';
- $('#baseQuantity').value = d.baseQuantity || '';
- $('#quantity').value = d.quantity || '';
- $('#maxPositionSize').value = d.maxPositionSize ?? '';
- $('#stopLossCount').value = d.stopLossCount ?? '';
+ byId('gridRate').value = d.gridRate || '';
+ byId('expectedProfit').value = d.expectedProfit || '';
+ byId('maxLoss').value = d.maxLoss || '';
+ byId('baseQuantity').value = d.baseQuantity || '';
+ byId('quantity').value = d.quantity || '';
+ byId('maxPositionSize').value = d.maxPositionSize ?? '';
+ byId('stopLossCount').value = d.stopLossCount ?? '';
+ byId('takeProfitGridSpan').value = d.takeProfitGridSpan ?? '';
}
function collectForm() {
return {
apiKey: currentApiKey,
- gridRate: parseFloat($('#gridRate').value) || 0,
- expectedProfit: parseFloat($('#expectedProfit').value) || 0,
- maxLoss: parseFloat($('#maxLoss').value) || 0,
- baseQuantity: $('#baseQuantity').value,
- quantity: $('#quantity').value,
- maxPositionSize: parseInt($('#maxPositionSize').value) || 0,
- stopLossCount: parseInt($('#stopLossCount').value) || 0
+ gridRate: parseFloat(byId('gridRate').value) || 0,
+ expectedProfit: parseFloat(byId('expectedProfit').value) || 0,
+ maxLoss: parseFloat(byId('maxLoss').value) || 0,
+ baseQuantity: byId('baseQuantity').value,
+ quantity: byId('quantity').value,
+ maxPositionSize: parseInt(byId('maxPositionSize').value) || 0,
+ stopLossCount: parseInt(byId('stopLossCount').value) || 0,
+ takeProfitGridSpan: parseInt(byId('takeProfitGridSpan').value) || 2
};
}
--
Gitblit v1.9.1