Scaling risk estimates
The VaR(95) number calculated in previous exercises is simply the value at risk for a single day. To estimate the VaR for a longer time horizon, scale the value by the square root of time, similar to scaling volatility:
$$ \text{VaR(95)}_{\text{t days}} = \text{VaR(95)}_{\text{1 day}} * \sqrt{t} $$
StockReturns_perc and var_95 from the previous exercise is available in your workspace. Use this data to estimate the VaR for the USO oil ETF for 1 to 100 days from now. We've also defined a function plot_var_scale() that plots the VaR for 1 to 100 days from now.
Cet exercice fait partie du cours
Introduction to Portfolio Risk Management in Python
Instructions
- Loop from 0 to 100 (not including 100) using the
range()function. - Set the second column of
forecasted_valuesat each index equal to the forecasted VaR, multiplyingvar_95by the square root ofi + 1using thenp.sqrt()function.
Exercice interactif pratique
Essayez cet exercice en complétant cet exemple de code.
# Aggregate forecasted VaR
forecasted_values = np.empty([100, 2])
# Loop through each forecast period
for i in ____:
# Save the time horizon i
forecasted_values[i, 0] = i
# Save the forecasted VaR 95
forecasted_values[i, 1] = ____
# Plot the results
plot_var_scale()