skfolio.measures.value_at_risk#

skfolio.measures.value_at_risk(returns, beta=0.95, sample_weight=None)[source]#

Compute the historical value at risk (VaR). The VaR is the maximum loss at a given confidence level (beta).

Parameters:
returnsndarray of shape (n_observations,) or (n_observations, n_assets)

Array of return values.

betafloat, default=0.95

The VaR confidence level (return on the worst (1-beta)% observation).

sample_weightndarray of shape (n_observations,), optional

Sample weights for each observation. If None, equal weights are assumed.

Returns:
valuefloat or ndarray of shape (n_assets,)

Value at Risk. If returns is a 1D-array, the result is a float. If returns is a 2D-array, the result is a ndarray of shape (n_assets,).