fix(hub): show trend plan leverage, base, ratio, mark and floating PnL
Position and trend plan cards read sizing from trend_pullback_plans; merge agent mark/PnL; compute position_ratio_pct in hub enrich. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -352,6 +352,13 @@ def enrich_trend_plan_for_hub(cfg: dict, raw: dict) -> dict:
|
||||
d["planned_rr"] = float(rr)
|
||||
except (TypeError, ValueError, KeyError):
|
||||
pass
|
||||
try:
|
||||
snap = float(d.get("snapshot_available_usdt") or 0)
|
||||
margin = float(d.get("plan_margin_capital") or 0)
|
||||
if snap > 0 and margin > 0:
|
||||
d["position_ratio_pct"] = round(margin / snap * 100.0, 2)
|
||||
except (TypeError, ValueError):
|
||||
pass
|
||||
return d
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user