revert期权历史仍按币展示盈亏,U 口径只用于统计结算。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1467,7 +1467,6 @@ def format_option_history_row(
|
||||
realized = _safe_float(raw.get("realizedPnl"))
|
||||
if realized is None:
|
||||
realized = _safe_float(raw.get("pnl"))
|
||||
pnl_usdt = _safe_float(raw.get("_sim_realized_pnl_usdt"))
|
||||
pnl_ratio = _safe_float(raw.get("pnlRatio"))
|
||||
close_type = str(raw.get("type") or "").strip()
|
||||
utime = _safe_float(raw.get("uTime"))
|
||||
@@ -1478,13 +1477,6 @@ def format_option_history_row(
|
||||
premium_ccy = str(raw.get("_sim_premium_ccy") or "").strip().upper() or premium_ccy_for_mode(
|
||||
row_mode, uly or "ETH"
|
||||
)
|
||||
# 模拟盘已冻结 U 盈亏时,盈亏列按 U 展示(权利金仍为币)
|
||||
pnl_display_ccy = str(raw.get("_sim_pnl_display_ccy") or "").strip().upper()
|
||||
if pnl_usdt is not None:
|
||||
realized = float(pnl_usdt)
|
||||
pnl_display_ccy = "USDT"
|
||||
elif not pnl_display_ccy:
|
||||
pnl_display_ccy = premium_ccy
|
||||
if close_type in ("3", "4"):
|
||||
status_label = "强平"
|
||||
else:
|
||||
@@ -1513,13 +1505,10 @@ def format_option_history_row(
|
||||
"premium_paid": premium_paid,
|
||||
"premium_paid_fmt": format_premium_amount(premium_paid, ccy=premium_ccy),
|
||||
"premium_ccy": premium_ccy,
|
||||
"pnl_display_ccy": pnl_display_ccy,
|
||||
"margin_mode": row_mode,
|
||||
"realized_pnl": realized,
|
||||
"realized_pnl_usdt": pnl_usdt if pnl_usdt is not None else (
|
||||
float(realized) if pnl_display_ccy == "USDT" and realized is not None else None
|
||||
),
|
||||
"realized_pnl_fmt": format_premium_amount(realized, ccy=pnl_display_ccy),
|
||||
"realized_pnl_usdt": _safe_float(raw.get("_sim_realized_pnl_usdt")),
|
||||
"realized_pnl_fmt": format_premium_amount(realized, ccy=premium_ccy),
|
||||
"pnl_ratio_pct": round(pnl_ratio * 100, 2) if pnl_ratio is not None else None,
|
||||
"status": "closed",
|
||||
"status_label": status_label,
|
||||
|
||||
Reference in New Issue
Block a user