Skip to main content

beta

Function beta 

Source
pub fn beta(asset_returns: &[f64], benchmark_returns: &[f64]) -> Option<f64>
Expand description

Compute the beta of an asset relative to a benchmark.

β = Cov(asset, benchmark) / Var(benchmark)

Both slices must have the same length and at least 2 observations. Returns None on insufficient data or zero benchmark variance.