fix(hub): live market PnL and Gate drag SL place

Parse Gate unrealised_pnl in agent; refresh hub market floating PnL from board and trends; clamp Gate TP/SL triggers before place.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-04 20:02:23 +08:00
parent 24270944e7
commit e6361a7fcc
7 changed files with 197 additions and 17 deletions
+5
View File
@@ -1377,6 +1377,10 @@
});
});
const upnl = resolveTrendFloatingPnl(pos, trendPlan);
const planMargin =
trendPlan && trendPlan.plan_margin_capital != null
? num(trendPlan.plan_margin_capital)
: null;
return {
exchange_id: exchangeId || null,
symbol: (pos.symbol || "").trim(),
@@ -1389,6 +1393,7 @@
contracts: num(pos.contracts),
unrealized_pnl: upnl != null ? Number(upnl) : null,
notional_usdt: num(pos.notional_usdt),
plan_margin: planMargin,
orders: orders,
};
}