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
+32 -9
View File
@@ -1431,30 +1431,53 @@ def _fetch_perp_market(cfg: dict[str, Any], base: str) -> tuple[dict[str, Any],
def _options_account_snapshot(cfg: dict[str, Any]) -> dict[str, Any]:
"""期权账户资金快照(与期权页同源: exchange_options)."""
"""期权账户资金快照(与期权页同源: exchange_options).
trading_usdt=展示权益(含永续全仓占用);trading_usdt_avail=可开仓余额.
"""
out: dict[str, Any] = {
"label": cfg.get("options_account_label") or "期权账户",
"trading_usdc": None,
"funding_usdc": None,
"trading_usdt": None,
"funding_usdt": None,
"trading_usdt_avail": None,
"perp_margin_usdt": None,
"margin_note": "永续全仓 · 期权逐仓",
}
ex = cfg.get("exchange_options")
hdr = cfg.get("options_header_balances")
if ex is None or not callable(hdr):
if ex is None:
return out
try:
trading_usdc, funding_usdc, funding_usdt, trading_usdt = hdr(ex, force=False)
from lib.exchange.okx_options_lib import options_header_balance_pack
pack = options_header_balance_pack(ex, force=False) or {}
out.update(
{
"trading_usdc": trading_usdc,
"funding_usdc": funding_usdc,
"trading_usdt": trading_usdt,
"funding_usdt": funding_usdt,
"trading_usdc": pack.get("trading_usdc"),
"funding_usdc": pack.get("funding_usdc"),
"trading_usdt": pack.get("trading_usdt"),
"funding_usdt": pack.get("funding_usdt"),
"trading_usdt_avail": pack.get("trading_usdt_avail", pack.get("trading_usdt")),
"perp_margin_usdt": pack.get("perp_margin_usdt"),
}
)
except Exception:
pass
hdr = cfg.get("options_header_balances")
if callable(hdr):
try:
trading_usdc, funding_usdc, funding_usdt, trading_usdt = hdr(ex, force=False)
out.update(
{
"trading_usdc": trading_usdc,
"funding_usdc": funding_usdc,
"trading_usdt": trading_usdt,
"funding_usdt": funding_usdt,
"trading_usdt_avail": trading_usdt,
}
)
except Exception:
pass
return out