Show option net P/L from bid recycle minus premium.
Rename floating P/L to net P/L, align ROI, and display bid depth as price/liquidity for only the levels needed to close. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -51,11 +51,15 @@ def build_options_hub_snapshot(cfg: dict[str, Any]) -> dict[str, Any]:
|
||||
upl_total = 0.0
|
||||
has_upl = False
|
||||
for p in positions:
|
||||
upl = p.get("upl")
|
||||
if upl is None:
|
||||
# 汇总优先用买盘净盈亏,与持仓卡「净盈亏」一致
|
||||
preview = p.get("close_preview") or {}
|
||||
net = preview.get("estimated_pnl")
|
||||
if net is None:
|
||||
net = p.get("upl")
|
||||
if net is None:
|
||||
continue
|
||||
has_upl = True
|
||||
upl_total += float(upl)
|
||||
upl_total += float(net)
|
||||
bal = cfg["fetch_options_balances"](ex)
|
||||
stats = _compute_options_stats(ex, cfg)
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user