Align OO Call/Put position cards with per-leg mark, size, leverage.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-08-07 17:25:03 +08:00
parent e7115e396a
commit 0ac03cc726
4 changed files with 417 additions and 211 deletions
+4 -1
View File
@@ -72,13 +72,16 @@ def enrich_live_unrealized(
logger.warning("live unrealized exchange overlay failed: %s", e)
option_upl = float(base.get("option_upl") or 0.0) # 期权净盈亏(本地)
option2_upl = float(base.get("option2_upl") or 0.0) # 期期 Put 腿
# 盯盘/达标:离场费 ≈ 入场费 → 合计扣 已付×2
est_close = float(fees_paid)
net_pnl = perp_upl + option_upl - fees_paid * 2.0 + funding
# 期期无永续:perp_upl 一般为 0;仍加 option2
net_pnl = perp_upl + option_upl + option2_upl - fees_paid * 2.0 + funding
out = dict(base)
out["perp_upl"] = perp_upl
out["option_upl"] = option_upl
out["option2_upl"] = option2_upl
out["fees_paid"] = fees_paid
out["funding_usdt"] = funding
out["est_close_fees"] = est_close