qis.estimate_vol

qis.estimate_vol(sampled_returns)[source]

Estimate volatility from return samples.

For columns with 20 or more finite observations, uses standard deviation with ddof=1. For smaller finite samples, uses RMS to avoid mean adjustment bias.

Parameters:

sampled_returns (DataFrame | Series | ndarray) – Real numeric return time series supplied as a pandas Series, pandas DataFrame, or NumPy array. Nullable integer and floating pandas dtypes are supported. NumPy arrays must have shape (observations,) or (observations, columns). Each column selects its estimator from its own finite observation count; missing rows do not count toward the threshold

Returns:

Volatility estimate for a one-dimensional input or one estimate per two-dimensional input column. A column is missing when it cannot supply the observations required by its selected estimator

Raises:
  • TypeError – If the input is not a supported container or contains a non-real-numeric dtype

  • ValueError – If a NumPy array is not one- or two-dimensional

Return type:

ndarray | float64