Show only positioned accounts on the dashboard.

Drop per-exchange fund metrics and render open positions as labeled tables while keeping closed-trade details.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-17 14:13:44 +08:00
parent 33b3e5f54b
commit 0bda44248f
4 changed files with 120 additions and 99 deletions
+9 -1
View File
@@ -974,16 +974,23 @@ def format_account_remark(ac: dict) -> str:
def format_dashboard_account_detail(ac: dict) -> dict[str, Any]:
"""数据看板分户卡片:监控仅数量,持仓逐行(含浮盈亏)."""
"""数据看板分户卡片:监控仅数量,持仓逐行(含浮盈亏与来源)."""
mon = ac.get("monitor_lines") or {}
position_lines: list[dict[str, Any]] = []
for p in _filter_open_positions(ac.get("positions") or []):
sym = p.get("symbol") or "?"
side = p.get("side") or "?"
contracts = p.get("contracts")
if contracts is None:
contracts = p.get("size")
upnl = _position_float_pnl(p)
position_lines.append(
{
"kind": "position",
"source": "永续",
"symbol": sym,
"side": side,
"contracts": contracts,
"text": f"{sym} {side}",
"pnl": round(upnl, 4),
}
@@ -1011,6 +1018,7 @@ def format_dashboard_account_detail(ac: dict) -> dict[str, Any]:
text = f"{text} {be_line}"
line: dict[str, Any] = {
"kind": "options",
"source": "期权",
"text": text,
}
if upl is not None: