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
+8 -2
View File
@@ -55,7 +55,11 @@ def apply_sim_hooks(app_module: Any) -> None:
def get_available_trading_usdt():
if is_sim_mode(app_module.get_db):
return float(broker().balances_header()["trading_usdt"])
w = broker().balances_header()
# 开仓可用=未占用保证金的 USDT(勿用全仓权益)
if w.get("trading_usdt_free") is not None:
return float(w.get("trading_usdt_free") or 0)
return float(w.get("trading_usdt") or 0)
return _orig_avail()
def get_live_position_contracts(exchange_symbol, direction):
@@ -215,6 +219,7 @@ def _patch_okx_options_lib(app_module: Any) -> None:
te = float(w.get("trading_eth") or 0)
fb = float(w.get("funding_btc") or 0)
tb = float(w.get("trading_btc") or 0)
tu_free = float(w.get("trading_usdt_free") if w.get("trading_usdt_free") is not None else tu)
return {
"scope": "main",
"funding_usdt": fu,
@@ -227,12 +232,13 @@ def _patch_okx_options_lib(app_module: Any) -> None:
"trading_btc": tb,
"funding_usdt_avail": fu,
"funding_usdc_avail": fc,
"trading_usdt_avail": tu,
"trading_usdt_avail": tu_free,
"trading_usdc_avail": tc,
"funding_eth_avail": fe,
"trading_eth_avail": te,
"funding_btc_avail": fb,
"trading_btc_avail": tb,
"perp_margin_usdt": float(w.get("perp_margin_usdt") or 0),
}
except Exception:
pass