okama.Portfolio.get_var_historic

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

Calculate historic Value at Risk (VaR) for the portfolio.

The VaR calculates the potential loss of an investment with a given time frame and confidence level. Loss is a positive number (expressed in cumulative return). If VaR is negative there are expected gains at this confidence level.

Parameters:
time_frameint, default 12

Time frame for VAR. Default is 12 months.

levelint, default 1

Confidence level in percents. Default value is 1%.

Returns:
Float

Historic Value at Risk (VaR) value for the portfolio.

Examples

>>> x = ok.Portfolio(['SP500TR.INDX', 'SP500BDT.INDX'], last_date='2021-01')
>>> x.get_var_historic(time_frame=12, level=1)
0.24030006476701732