Introduction to Portfolio Risk Management in Python
Dakota Wixom
Quantitative Analyst | QuantCourse.com
Empirical historical values are those that have actually occurred.
How do you simulate the probability of a value that has never occurred historically before?
Sample from a probability distribution
Assuming you have an object StockReturns
which is a time series of stock returns.
To calculate parametric VaR(95):
mu = np.mean(StockReturns)
std = np.std(StockReturns)
confidence_level = 0.05
VaR = norm.ppf(confidence_level, mu, std)
VaR
-0.0235
Assuming you have a one-day estimate of VaR(95) var_95
.
To estimate 5-day VaR(95):
forecast_days = 5
forecast_var95_5day = var_95*np.sqrt(forecast_days)
forecast_var95_5day
-0.0525
Introduction to Portfolio Risk Management in Python