CIOAgent / frontend /src /components /MacroCorrelations.jsx
bhuvighosh3
Deployment with restored Stress Specialist data
9fbb3f2
Raw History Blame Contribute Delete
1.74 kB
import React from "react";
export default function MacroCorrelations({ data }) {
if (!data || !data.correlations) return null;
return (
<div className="section">
<h2>Macro Indicator Correlations</h2>
<p className="caption">Portfolio sensitivity to major economic indicators.</p>
<table className="data-table">
<thead>
<tr>
<th>Indicator</th>
<th>Correlation</th>
<th>Rolling (60d)</th>
<th>Interpretation</th>
</tr>
</thead>
<tbody>
{data.correlations.map((c, i) => {
const absCorr = Math.abs(c.correlation);
const color = absCorr > 0.5 ? "var(--warning)" : absCorr > 0.3 ? "var(--info)" : "var(--text-muted)";
return (
<tr key={i}>
<td><strong>{c.indicator}</strong></td>
<td>
<span style={{ color, fontWeight: 600 }}>
{c.correlation > 0 ? "+" : ""}{c.correlation.toFixed(3)}
</span>
<div style={{ background: "var(--surface-2)", borderRadius: 3, height: 4, marginTop: 4 }}>
<div style={{
width: `${absCorr * 100}%`,
height: "100%",
borderRadius: 3,
background: c.correlation > 0 ? "var(--success)" : "var(--error)",
}} />
</div>
</td>
<td>{c.rolling_current != null ? c.rolling_current.toFixed(3) : "—"}</td>
<td className="caption">{c.interpretation}</td>
</tr>
);
})}
</tbody>
</table>
</div>
);
}