1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to Portfolio Risk Management in Python

Connected

Exercise

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.

Instructions

100 XP
  • Loop from 0 to 100 (not including 100) using the range() function.
  • Set the second column of forecasted_values at each index equal to the forecasted VaR, multiplying var_95 by the square root of i + 1 using the np.sqrt() function.