Fix hub options float summary blank when bid book is invalid.

Stop treating total_received=0 as a real bid recycle, fall back to exchange upl for display totals, and keep row/summary aligned.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-08-07 09:47:14 +08:00
parent d41028b766
commit 4bc238b014
12 changed files with 182 additions and 48 deletions
+2 -7
View File
@@ -1307,9 +1307,9 @@ def format_dashboard_account_detail(ac: dict) -> dict[str, Any]:
row["source_label"] = _options_source_label(p)
row["target_monitor_text"] = _options_target_monitor_text(p)
try:
from lib.options.options_positions_lib import net_pnl_from_display_row
from lib.options.options_positions_lib import display_pnl_from_option_row
net = net_pnl_from_display_row(row)
net = display_pnl_from_option_row(row)
except Exception:
net = None
row["net_pnl"] = round(float(net), 4) if net is not None else None
@@ -1324,11 +1324,6 @@ def format_dashboard_account_detail(ac: dict) -> dict[str, Any]:
}
if row.get("net_pnl") is not None:
line["pnl"] = row["net_pnl"]
elif row.get("upl") is not None:
try:
line["pnl"] = round(float(row["upl"]), 4)
except (TypeError, ValueError):
pass
position_lines.append(line)
issues = [str(x) for x in (ac.get("issues") or [])[:3]]
return {