fix期权下单默认按可用余额打满;持仓上限/缓冲/门控秒数默认值调整。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-10-09 00:46:54 +08:00
parent 549253440a
commit ed4c650e4b
9 changed files with 38 additions and 35 deletions
+9 -8
View File
@@ -19,7 +19,7 @@
budgetBuffer: (function () {
const raw = root.dataset.budgetBuffer;
const n = raw != null && raw !== "" ? Number(raw) : NaN;
return !Number.isNaN(n) && n > 0 ? n : 0.95;
return !Number.isNaN(n) && n > 0 ? n : 1;
})(),
chain: panelCache.chain || null,
selectedInst: null,
@@ -318,9 +318,10 @@
const el = document.querySelector('input[name="opt-size-mode"]:checked:not(:disabled)');
if (el) return el.value;
const any = document.querySelector('input[name="opt-size-mode"]:checked');
if (any && any.value === "compound_full" && !compoundFullEnabled()) return "sheets";
if (any && any.value === "compound_full" && !compoundFullEnabled()) return "budget_full";
if (any && any.value === "budget_full" && compoundFullEnabled()) return "compound_full";
return "sheets";
// 默认按可用余额打满(复利开时等价全仓复利)
return compoundFullEnabled() ? "compound_full" : "budget_full";
}
function applyCompoundModeUi(compoundOn) {
@@ -372,13 +373,13 @@
compoundRadio.checked = false;
compoundRadio.disabled = true;
}
// currentSizeMode 会把残留 compound 映射成 sheets,须实际勾选,避免无选中无法开仓
// 无有效选中时默认「按可用余额打满」
const checkedOk = document.querySelector('input[name="opt-size-mode"]:checked:not(:disabled)');
if (!checkedOk) {
const sheetsRadio = document.querySelector('input[name="opt-size-mode"][value="sheets"]');
if (sheetsRadio) {
sheetsRadio.disabled = false;
sheetsRadio.checked = true;
const fullRadio = document.querySelector('input[name="opt-size-mode"][value="budget_full"]');
if (fullRadio) {
fullRadio.disabled = false;
fullRadio.checked = true;
}
}
}