Function calculate_beta

Source
pub fn calculate_beta(
    df: &DataFrame,
    price_column: &str,
    market_column: &str,
    window: usize,
) -> PolarsResult<Series>
Expand description

Calculates Beta - regression coefficient between two series

§Arguments

  • df - DataFrame containing the price data
  • price_column - Column name for the price series (default “close”)
  • market_column - Column name for the market/benchmark series
  • window - Window size for the calculation (typically 5)

§Returns

Returns a PolarsResult containing the Beta Series