Unify hub dashboard positions into one card with exchange links.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-20 12:27:19 +08:00
parent d2028ed0ee
commit ee3c1bcdca
4 changed files with 130 additions and 96 deletions
+10
View File
@@ -1100,6 +1100,11 @@ def format_dashboard_account_detail(ac: dict) -> dict[str, Any]:
contracts = p.get("size")
upnl = _position_float_pnl(p)
source = resolve_position_monitor_source(p, hub_mon)
entry = _safe_float(p.get("entry_price"))
mark = _safe_float(p.get("mark_price"))
notional = _safe_float(p.get("notional_usdt"))
if notional is None:
notional = _safe_float(p.get("notional"))
position_lines.append(
{
"kind": "position",
@@ -1107,6 +1112,11 @@ def format_dashboard_account_detail(ac: dict) -> dict[str, Any]:
"symbol": sym,
"side": side,
"contracts": contracts,
"entry_price": entry,
"entry_price_fmt": p.get("entry_price_fmt"),
"mark_price": mark,
"mark_price_fmt": p.get("mark_price_fmt"),
"notional_usdt": notional,
"text": f"{sym} {side}",
"pnl": round(upnl, 4),
}