Align hedge UI/fees: drop 未启动, premium coin/U, equity incl perp margin, OKX option fees.

Option net uses Min(0.03%×coin, 7%×premium) with bid/ask fills (no slip); live PnL colors fixed.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-10-14 17:12:10 +08:00
parent be00991568
commit 746655acba
12 changed files with 190 additions and 45 deletions
+39 -6
View File
@@ -726,7 +726,7 @@
el.textContent = "持仓中" + idPart;
el.classList.add("is-holding");
} else {
el.textContent = "未启动";
el.textContent = "";
el.classList.add("is-idle");
}
}
@@ -990,6 +990,10 @@
"<span>标记 <strong>" +
fmt(opt.mark_px, 4) +
"</strong></span>" +
'<span title="权利金(币/U,U按买币参考指数)">权利金 <strong>' +
(opt.premium_coin != null ? fmt(opt.premium_coin, 4) + " 币" : "—") +
(opt.premium_usdt != null ? " / " + fmt(opt.premium_usdt, 2) + " U" : "") +
"</strong></span>" +
'<span class="' +
(liqWarn ? "hp-liq-warn" : "") +
'" title="' +
@@ -1268,8 +1272,16 @@
if (acct.trading_usdc != null && acct.trading_usdc !== "") {
state.tradingUsdc = Number(acct.trading_usdc);
}
// 展示权益(含永续全仓保证金);定仓用可用余额
if (acct.trading_usdt != null && acct.trading_usdt !== "") {
state.tradingUsdt = Number(acct.trading_usdt);
state.tradingUsdtEquity = Number(acct.trading_usdt);
} else if (acct.trading_usdc != null && acct.trading_usdc !== "") {
state.tradingUsdtEquity = Number(acct.trading_usdc);
}
if (acct.trading_usdt_avail != null && acct.trading_usdt_avail !== "") {
state.tradingUsdt = Number(acct.trading_usdt_avail);
} else if (state.tradingUsdtEquity != null) {
state.tradingUsdt = state.tradingUsdtEquity;
} else if (acct.trading_usdc != null && acct.trading_usdc !== "") {
state.tradingUsdt = Number(acct.trading_usdc);
}
@@ -1282,18 +1294,27 @@
if (chain && chain.budget_buffer != null && chain.budget_buffer !== "") {
applyBudgetBuffer(chain.budget_buffer);
}
const equityTxt = fmt(
state.tradingUsdtEquity != null
? state.tradingUsdtEquity
: acct.trading_usdt != null
? acct.trading_usdt
: acct.trading_usdc,
2
);
const line =
label +
" · 交易 USDT " +
fmt(acct.trading_usdt != null ? acct.trading_usdt : acct.trading_usdc, 2) +
equityTxt +
" · 资金 USDT " +
fmt(acct.funding_usdt != null ? acct.funding_usdt : acct.funding_usdc, 2);
fmt(acct.funding_usdt != null ? acct.funding_usdt : acct.funding_usdc, 2) +
" · 永续全仓/期权逐仓";
const el = $("hp-opt-bal-line");
if (el) el.textContent = line;
const fundEl = $("hp-oo-funding-usdc");
const tradeEl = $("hp-oo-trading-usdc");
if (fundEl) fundEl.textContent = fmt(acct.funding_usdt != null ? acct.funding_usdt : acct.funding_usdc, 2);
if (tradeEl) tradeEl.textContent = fmt(acct.trading_usdt != null ? acct.trading_usdt : acct.trading_usdc, 2);
if (tradeEl) tradeEl.textContent = equityTxt;
autoFillOoSheets();
}
@@ -1937,7 +1958,19 @@
const ct = Number(state.selected.ct_mult || 0.01);
const ask = Number(state.selected.ask || 0);
const prem = ask * sheets * ct;
line.textContent = "权利金 ≈ " + fmt(prem, 4) + " 币 · 卖一 " + fmt(ask, 4);
// U 以买币参考价(指数)为准,与开仓买币口径一致
const buyPx = Number(
(state.market && (state.market.index_px || state.market.mark)) || indexPx() || 0
);
const premU = buyPx > 0 ? prem * buyPx : null;
line.textContent =
"权利金 ≈ " +
fmt(prem, 4) +
" 币" +
(premU != null ? " / " + fmt(premU, 2) + " U" : "") +
" · 卖一 " +
fmt(ask, 4) +
(buyPx > 0 ? " · 买币参考 " + fmt(buyPx, 2) : "");
}
function buildStraddleRows(contracts) {
+8
View File
@@ -4246,6 +4246,14 @@ html[data-theme="light"] .opt-be-dist-down {
color: #e8ecf4;
font-weight: 600;
}
.hedge-plan-page-wrap .hp-live-leg-grid strong.hp-pnl-pos,
.hedge-plan-page-wrap .hp-live-combo strong.hp-pnl-pos {
color: #7ee787 !important;
}
.hedge-plan-page-wrap .hp-live-leg-grid strong.hp-pnl-neg,
.hedge-plan-page-wrap .hp-live-combo strong.hp-pnl-neg {
color: #ff8a8a !important;
}
.hedge-plan-page-wrap .hp-live-combo {
display: flex;
justify-content: space-between;