import React from "react"; export default function Rebalancing({ data }) { if (!data) return null; return (

Rebalancing Engine

Status {data.needs_rebalancing ? "Rebalancing Needed" : "On Target"}
Max Drift {(data.max_drift * 100).toFixed(2)}%
Threshold {(data.drift_threshold * 100).toFixed(0)}%
Portfolio Value ${data.portfolio_value.toLocaleString(undefined, { maximumFractionDigits: 0 })}

Position Drift

{data.positions.map((p, i) => ( ))}
TickerTargetCurrentDrift
{p.ticker} {(p.target_weight * 100).toFixed(1)}% {(p.current_weight * 100).toFixed(1)}% data.drift_threshold ? "var(--warning)" : "var(--text-muted)" }}> {p.drift > 0 ? "+" : ""}{(p.drift * 100).toFixed(2)}%

Recommended Trades

{data.trades.length === 0 ? (

No trades needed — portfolio is within drift threshold.

) : ( {data.trades.map((t, i) => ( ))}
TickerActionSharesValue
{t.ticker} {t.action} {t.shares} ${t.value.toLocaleString()}
)}
); }