okama.Portfolio.get_cvar_historic

Portfolio.get_cvar_historic(time_frame=12, level=1)

Calculate historic Conditional Value at Risk (CVAR, expected shortfall) for the portfolio.

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 (12 months)

Time period size in months

levelint, default 1

Confidence level in percents to calculate the VaR. Default value is 1% (1% quantile).

Returns:
Float

Historic Conditional Value at Risk (CVAR, expected shortfall) value for the portfolio.

Examples

>>> x = ok.Portfolio(['USDEUR.FX', 'BTC-USD.CC'], last_date='2021-01')
>>> x.get_cvar_historic(time_frame=2, level=1)
0.3566909250442616