单独期权增加全仓复利模式:可选上限开关,仅允许一仓

用期权户全部可用×缓冲开仓,默认不设上限;开启上限后按 env 封顶,全仓时禁止已有持仓再开。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-08-12 09:45:36 +08:00
parent a354811a6e
commit 1522117eeb
8 changed files with 240 additions and 19 deletions
+12
View File
@@ -281,14 +281,26 @@
const sheetsEl = document.getElementById("opt-sheets-amount");
const ethEl = document.getElementById("opt-eth-amount");
const hint = document.getElementById("opt-budget-full-hint");
const compoundHint = document.getElementById("opt-compound-full-hint");
const capEl = document.getElementById("opt-budget-full-cap");
const compoundCapLine = document.getElementById("opt-compound-cap-line");
if (sheetsEl) sheetsEl.style.display = mode === "sheets" ? "" : "none";
if (ethEl) ethEl.style.display = mode === "eth_amount" ? "" : "none";
if (hint) hint.style.display = mode === "budget_full" ? "" : "none";
if (compoundHint) compoundHint.style.display = mode === "compound_full" ? "" : "none";
if (capEl && root && root.dataset.tradeBudget) {
const n = Number(root.dataset.tradeBudget);
if (Number.isFinite(n) && n > 0) capEl.textContent = n.toFixed(2);
}
if (compoundCapLine && root) {
const on = String(root.dataset.compoundCapEnabled || "") === "1";
const cap = Number(root.dataset.compoundCapUsdc);
if (on && Number.isFinite(cap) && cap > 0) {
compoundCapLine.textContent = "全仓上限已开启:" + cap.toFixed(2) + "U";
} else {
compoundCapLine.textContent = "全仓上限关闭(env可开)";
}
}
document.querySelectorAll(".opt-size-mode-chip").forEach(function (chip) {
const radio = chip.querySelector('input[name="opt-size-mode"]');
chip.classList.toggle("is-selected", !!(radio && radio.checked));