翻倍出场监控中按钮改为取消;中控目标监控列显示倍数如1倍。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1500,6 +1500,13 @@
|
||||
);
|
||||
}
|
||||
|
||||
function formatProfitExitMultLabel(mult) {
|
||||
const n = Number(mult);
|
||||
if (!Number.isFinite(n) || n <= 0) return "1倍";
|
||||
if (Math.abs(n - Math.round(n)) < 1e-9) return String(Math.round(n)) + "倍";
|
||||
return fmt(n, 2) + "倍";
|
||||
}
|
||||
|
||||
function renderProfitExitRow(p) {
|
||||
const inst = p.inst_id || "";
|
||||
if (p.hedge_plan_target) {
|
||||
@@ -1511,10 +1518,9 @@
|
||||
: 1;
|
||||
const state = String(p.profit_exit_state || (enabled ? "active" : "idle"));
|
||||
const req = p.profit_exit_required_recycle;
|
||||
let statusTxt = enabled
|
||||
? ("监控中 · " + fmt(mult, 2) + "倍")
|
||||
: "未开启";
|
||||
if (enabled && state === "closing") statusTxt = "平仓挂单中 · " + fmt(mult, 2) + "倍";
|
||||
const multLabel = formatProfitExitMultLabel(mult);
|
||||
let statusTxt = enabled ? ("监控中 · " + multLabel) : "未开启";
|
||||
if (enabled && state === "closing") statusTxt = "平仓挂单中 · " + multLabel;
|
||||
return (
|
||||
'<div class="opt-target-row opt-profit-exit-pos-row" data-inst="' + inst + '">' +
|
||||
'<span class="opt-target-row-label">翻倍</span>' +
|
||||
@@ -1523,7 +1529,8 @@
|
||||
'<input type="number" class="opt-pos-profit-exit-mult" data-inst="' + inst +
|
||||
'" min="0.1" step="0.1" value="' + mult + '"' + (enabled ? "" : " disabled") + ">" +
|
||||
'<button type="button" class="btn-secondary opt-profit-exit-save-btn" data-inst="' +
|
||||
inst + '">应用</button>' +
|
||||
inst + '" data-mode="' + (enabled ? "cancel" : "apply") + '">' +
|
||||
(enabled ? "取消" : "应用") + "</button>" +
|
||||
'<span class="opt-target-armed">' + statusTxt + "</span>" +
|
||||
'<span class="muted opt-target-row-hint">' +
|
||||
(enabled
|
||||
@@ -1853,7 +1860,10 @@
|
||||
const row = card ? card.querySelector(".opt-profit-exit-pos-row") : null;
|
||||
const enabledEl = row ? row.querySelector(".opt-pos-profit-exit-enabled") : null;
|
||||
const multEl = row ? row.querySelector(".opt-pos-profit-exit-mult") : null;
|
||||
const enabled = !!(enabledEl && enabledEl.checked);
|
||||
const mode = btn && btn.getAttribute("data-mode");
|
||||
let enabled = !!(enabledEl && enabledEl.checked);
|
||||
if (mode === "cancel") enabled = false;
|
||||
if (mode === "apply") enabled = true;
|
||||
let mult = 1;
|
||||
if (enabled) {
|
||||
mult = parseFloat(multEl ? multEl.value : "1");
|
||||
|
||||
Reference in New Issue
Block a user