import React, { useState } from "react"; function num(v) { return isNaN(v) ? "NA" : v.toFixed(2); } export default function BetaAnalysis({ benchmark }) { const betas = benchmark?.betas || {}; const betaEntries = Object.entries(betas); const avgBeta = betaEntries.length > 0 ? betaEntries.reduce((s, [, v]) => s + v, 0) / betaEntries.length : NaN; const getBand = (v) => { if (v < 0.8) return "Defensive (Low beta)"; if (v <= 1.2) return "Market-like"; return "Aggressive (High beta)"; }; return (

Market Sensitivity (Beta vs Benchmarks)

Average Beta (across benchmarks) ?
{num(avgBeta)}

Rule of thumb (industry standard): <0.8 defensive | 0.8–1.2 market-like | >1.2 aggressive. Beta measures sensitivity to benchmark moves.

Show beta details
{betaEntries.map(([b, v]) => ( ))}
Benchmark Beta Industry Standard Band
{b} {num(v)} {getBand(v)}

Raw beta JSON

                                {JSON.stringify({ betas }, null, 2)}
                            
); }