I am trying to determine a step-by-step algorithm for calculating a portfolio's VaR using monte carlo simulations. It seems to me that the literature for this is extraordinarily opaque for something as common as VaR. To simplify things, I want to initially consider only a portfolio of stocks and at a later stage include derivatives.
Here are the steps I have managed to pickup using different sources:
- Estimate the portfolio's current value $P_0$.
- Build the portfolio's covariance matrix using stock historical data.
- Create the Cholesky decomposition of the covariance matrix.
- Generate a vector of n independent standard normal variates
- multiply the matrix resulting from the Cholesky decomposition with the vector of standard normal variates in order to get a vector of correlated variates.
- Calculate the assets' terminal prices using geometric brownian motion. $$ S_i(T) = S_i(0) \exp\left(\left(\mu-\frac{\sigma^2}{2}\right)T + \sigma\sqrt{T}\epsilon_i\right)$$ where $\epsilon_i$ corresponds to the correlated random variate for asset i obtained from the vector of correlated variates.
- reevaluate the portfolio's value at time $T$, $P_T$, using the stock prices generated in the previous step.
- Calculate the portfolio return using $$R_T=\frac{P_T - P_0}{P_0}$$
- Repeat steps 4-8 many times (for example $n=10000$ simulations).
- Sort the returns in ascending order.
I have the following questions:
- How do I extract the VaR from the sorted portfolio returns?
- How do I define the time horizon T?
- I have seen examples where the whole stock path is discretized using a relation of the form: $$ S_{(t+dt)} = S_t + S_t\mu dt + S_t \sigma \sqrt{dt} \epsilon_i $$ Do we need to do that or simply evaluating the stock's terminal price using the formula in point 6 is enough?