okama.AssetList.get_cvar_historic
- AssetList.get_cvar_historic(time_frame=12, level=1)
Calculate historic Conditional Value at Risk (CVAR, expected shortfall) for the assets with a given timeframe.
CVaR is the average loss over a specified time period of unlikely scenarios beyond the confidence level. Loss is a positive number (expressed in cumulative return). If CVaR is negative there are expected gains at this confidence level.
- Parameters:
- time_frameint, default 12
Time period size in months
- levelint, default 1
Confidence level in percents to calculate the VaR. Default value is 1% (1% quantile).
- Returns:
- Series
CVaR values for each asset in form of Series.
See also
risk_monthly
Calculate montly risk for each asset.
risk_annual
Calculate annualized risks.
semideviation_monthly
Calculate semideviation monthly values.
semideviation_annual
Calculate semideviation annualized values.
get_var_historic
Calculate historic Value at Risk (VaR).
drawdowns
Calculate drawdowns.
Examples
>>> x = ok.AssetList(['SPY.US', 'AGG.US']) >>> x.get_cvar_historic(time_frame=60, level=1) SPY.US 0.2574 AGG.US -0.0766 dtype: float64 Name: VaR, dtype: float64