修复比特币期权浮盈把币数量当成 U:看板/中控改为按指数折 USDT。

币本位 BTC/ETH 净盈亏须 × 指数后再标 U;并兜底从合约推断 premium_ccy,避免缺失时漏折算。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-09-30 22:01:41 +08:00
parent 41c85c36a9
commit 8a62cfbb48
4 changed files with 65 additions and 7 deletions
+3 -3
View File
@@ -162,12 +162,12 @@ def _format_options_item(p: dict[str, Any], *, conn=None) -> dict[str, Any]:
inst = str(p.get("inst_id") or p.get("instId") or "-").strip() or "-"
opt_type = str(p.get("opt_type") or p.get("optType") or "").upper()
label = "Call" if opt_type == "C" else "Put" if opt_type == "P" else (opt_type or "OPT")
# 看板期权列:优先买一净盈亏,残档回退交易所 upl
# 看板期权列:统一折成 U(币本位 BTC/ETH 权利金盈亏 × 指数)
pnl = None
try:
from lib.options.options_positions_lib import display_pnl_from_option_row
from lib.options.options_positions_lib import display_pnl_usdt_from_option_row
pnl = display_pnl_from_option_row(p)
pnl = display_pnl_usdt_from_option_row(p)
except Exception:
pnl = None
pos = _safe_float(p.get("pos"))