Tighten 期期 parameter UI: compact controls, less copy.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -300,9 +300,7 @@
|
||||
function syncOoCloseModeUI() {
|
||||
const enabled = !!state.ooCloseModeEnabled;
|
||||
const row = $("hp-oo-close-mode-row");
|
||||
const hint = $("hp-oo-close-mode-hint");
|
||||
if (row) row.classList.toggle("hidden", !enabled);
|
||||
if (hint) hint.classList.toggle("hidden", !enabled);
|
||||
if (!enabled) state.ooCloseMode = "hold_expiry";
|
||||
document.querySelectorAll(".hp-oo-close-mode").forEach(function (b) {
|
||||
const on = b.getAttribute("data-oo-close") === state.ooCloseMode;
|
||||
@@ -314,16 +312,23 @@
|
||||
const line = $("hp-oo-budget-line");
|
||||
if (!line) return;
|
||||
const b = resolveOoBudget();
|
||||
const modeLabel = state.ooSheetsMode === "split_budget" ? "均分预算" : "同张数";
|
||||
const parts = [
|
||||
"预算 min(交易×" + fmt(b.buf, 2) + ", 单笔) ≈ " + fmt(b.budget, 2) + " USDC",
|
||||
"模式:" + modeLabel,
|
||||
];
|
||||
if (b.tradingCap != null) parts.push("交易×缓冲 " + fmt(b.tradingCap, 2));
|
||||
if (b.tradeCap != null) parts.push("单笔上限 " + fmt(b.tradeCap, 2));
|
||||
const sizeLabel = state.ooSheetsMode === "split_budget" ? "均分" : "同张数";
|
||||
const closeLabel = !state.ooCloseModeEnabled
|
||||
? ""
|
||||
: state.ooCloseMode === "hold_expiry"
|
||||
? "到期平"
|
||||
: "全平";
|
||||
const parts = ["可用 " + fmt(b.budget, 2) + "U", sizeLabel];
|
||||
if (closeLabel) parts.push(closeLabel);
|
||||
if (extra && extra.msg) parts.push(extra.msg);
|
||||
else if (b.msg) parts.push(b.msg);
|
||||
line.textContent = parts.join(" · ");
|
||||
line.title =
|
||||
"预算=min(交易×" +
|
||||
fmt(b.buf, 2) +
|
||||
", 单笔)" +
|
||||
(b.tradingCap != null ? " · 交易×缓冲 " + fmt(b.tradingCap, 2) : "") +
|
||||
(b.tradeCap != null ? " · 单笔 " + fmt(b.tradeCap, 2) : "");
|
||||
line.classList.toggle("hp-oo-budget-warn", !!(extra && extra.msg) || !b.ok);
|
||||
}
|
||||
|
||||
@@ -975,6 +980,7 @@
|
||||
state.ooSheetsMode = b.getAttribute("data-oo-size") || "same_sheets";
|
||||
syncOoSizeModeUI();
|
||||
autoFillOoSheets();
|
||||
updateOoBudgetLine(null);
|
||||
});
|
||||
});
|
||||
document.querySelectorAll(".hp-oo-close-mode").forEach(function (b) {
|
||||
@@ -983,6 +989,7 @@
|
||||
state.ooCloseMode = b.getAttribute("data-oo-close") || "close_all";
|
||||
state._ooCloseModeTouched = true;
|
||||
syncOoCloseModeUI();
|
||||
updateOoBudgetLine(null);
|
||||
});
|
||||
});
|
||||
if ($("hp-preview-btn"))
|
||||
|
||||
@@ -3253,17 +3253,42 @@ html[data-theme="light"] .opt-be-dist-down {
|
||||
color: #ff8a8a;
|
||||
}
|
||||
.hedge-plan-page-wrap .hp-oo-legs {
|
||||
margin-top: 8px;
|
||||
margin-top: 10px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
.hedge-plan-page-wrap .hp-oo-size-row {
|
||||
.hedge-plan-page-wrap .hp-oo-controls {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 10px 14px;
|
||||
margin: 10px 0 4px;
|
||||
padding: 10px 12px;
|
||||
border-radius: 8px;
|
||||
background: rgba(255, 255, 255, 0.03);
|
||||
border: 1px solid rgba(255, 255, 255, 0.06);
|
||||
}
|
||||
.hedge-plan-page-wrap .hp-oo-ctrl {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
min-width: 0;
|
||||
}
|
||||
.hedge-plan-page-wrap .hp-oo-ctrl-lab {
|
||||
font-size: 0.72rem;
|
||||
color: var(--muted, #8b949e);
|
||||
letter-spacing: 0.02em;
|
||||
}
|
||||
.hedge-plan-page-wrap .hp-oo-seg {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin: 6px 0 2px;
|
||||
gap: 6px;
|
||||
}
|
||||
.hedge-plan-page-wrap .hp-oo-seg .btn-secondary {
|
||||
flex: 1 1 auto;
|
||||
min-width: 4.5em;
|
||||
justify-content: center;
|
||||
padding: 5px 8px;
|
||||
}
|
||||
.hedge-plan-page-wrap .hp-oo-size-mode.active,
|
||||
.hedge-plan-page-wrap .hp-oo-close-mode.active {
|
||||
@@ -3271,13 +3296,25 @@ html[data-theme="light"] .opt-be-dist-down {
|
||||
color: var(--text, #fff);
|
||||
background: rgba(0, 212, 255, 0.12);
|
||||
}
|
||||
.hedge-plan-page-wrap #hp-oo-close-mode-row.hidden,
|
||||
.hedge-plan-page-wrap #hp-oo-close-mode-hint.hidden {
|
||||
.hedge-plan-page-wrap #hp-oo-close-mode-row.hidden {
|
||||
display: none !important;
|
||||
}
|
||||
.hedge-plan-page-wrap .hp-oo-controls:has(#hp-oo-close-mode-row.hidden) {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
.hedge-plan-page-wrap .hp-oo-meta {
|
||||
margin: 4px 0 0;
|
||||
font-size: 0.75rem;
|
||||
line-height: 1.4;
|
||||
}
|
||||
.hedge-plan-page-wrap #hp-oo-budget-line.hp-oo-budget-warn {
|
||||
color: #ff8a8a;
|
||||
}
|
||||
@media (max-width: 720px) {
|
||||
.hedge-plan-page-wrap .hp-oo-controls {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
.hedge-plan-page-wrap .hp-oo-leg-row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
|
||||
@@ -138,19 +138,23 @@
|
||||
</div>
|
||||
<div id="hp-oo-index" class="muted hp-quote-line"></div>
|
||||
<div id="hp-oo-bal-line" class="muted hp-quote-line"></div>
|
||||
<p class="muted hp-unit-hint">震荡突破:设上下两个目标价(USD);触达任一侧重平盈利腿。张数=<strong>期权张</strong> · 权利金=USDC</p>
|
||||
<div class="form-row hp-oo-size-row">
|
||||
<span class="muted">自动张数</span>
|
||||
<button type="button" class="btn-secondary hp-oo-size-mode active" data-oo-size="same_sheets">同张数</button>
|
||||
<button type="button" class="btn-secondary hp-oo-size-mode" data-oo-size="split_budget">均分预算</button>
|
||||
<div class="hp-oo-controls">
|
||||
<div class="hp-oo-ctrl">
|
||||
<span class="hp-oo-ctrl-lab">张数</span>
|
||||
<div class="hp-oo-seg" role="group" aria-label="自动张数">
|
||||
<button type="button" class="btn-secondary hp-oo-size-mode active" data-oo-size="same_sheets" title="两腿同张数,总权利金≤预算">同张数</button>
|
||||
<button type="button" class="btn-secondary hp-oo-size-mode" data-oo-size="split_budget" title="预算对半拆到两腿">均分</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="hp-oo-ctrl" id="hp-oo-close-mode-row">
|
||||
<span class="hp-oo-ctrl-lab" title="仅控制盈利腿平掉后的另一腿">平仓</span>
|
||||
<div class="hp-oo-seg" role="group" aria-label="平仓模式">
|
||||
<button type="button" class="btn-secondary hp-oo-close-mode active" data-oo-close="close_all" title="盈利腿平后立刻买一清另一腿(无2×,失败重试)">全平</button>
|
||||
<button type="button" class="btn-secondary hp-oo-close-mode" data-oo-close="hold_expiry" title="盈利腿平后另一腿持有至到期">到期平</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row hp-oo-size-row" id="hp-oo-close-mode-row">
|
||||
<span class="muted" title="仅控制盈利腿平掉后的另一腿">平仓模式</span>
|
||||
<button type="button" class="btn-secondary hp-oo-close-mode active" data-oo-close="close_all">全平</button>
|
||||
<button type="button" class="btn-secondary hp-oo-close-mode" data-oo-close="hold_expiry">到期平</button>
|
||||
</div>
|
||||
<p class="muted" id="hp-oo-close-mode-hint">盈利腿平后:全平=立刻买一清另一腿(无2×,失败重试);到期平=另一腿持有至到期</p>
|
||||
<p class="muted" id="hp-oo-budget-line"></p>
|
||||
<p class="muted hp-oo-meta" id="hp-oo-budget-line"></p>
|
||||
<div id="hp-oo-legs" class="hp-oo-legs">
|
||||
<div class="hp-oo-leg-row" data-leg="a">
|
||||
<div class="muted" id="hp-oo-leg-a-info">腿A: 尚未选用</div>
|
||||
@@ -277,4 +281,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="/static/hedge_plan.js?v=16"></script>
|
||||
<script src="/static/hedge_plan.js?v=17"></script>
|
||||
|
||||
Reference in New Issue
Block a user