Shrink instance dashboard header type and show options net PnL.
Header copy is smaller; options column uses bid-recycle net PnL like the options card. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -136,15 +136,14 @@ 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 = _safe_float(p.get("upl"))
|
||||
net = None
|
||||
# 看板期权列固定用净盈亏(买一回收−权利金);残档买一则空.
|
||||
pnl = None
|
||||
try:
|
||||
from lib.options.options_positions_lib import net_pnl_from_display_row
|
||||
|
||||
net = net_pnl_from_display_row(p)
|
||||
pnl = net_pnl_from_display_row(p)
|
||||
except Exception:
|
||||
net = None
|
||||
pnl = net if net is not None else upl
|
||||
pnl = None
|
||||
pos = _safe_float(p.get("pos"))
|
||||
exp_ms = p.get("exp_time_ms")
|
||||
if exp_ms is None:
|
||||
|
||||
Reference in New Issue
Block a user