# Simulating correlated stock paths to calculate VaR

So I wanted to generate a Monte Carlo simulation for two correlated assets to derive then the VaR as a quantile of the generated distributions. My code is the following, where the input parameters are correlation = 1, yearly volatility of both asset 30% and the starting prices are 100 for asset 1 and 80 for asset 2:

SDAsset1 = 0.3
SDAsset2 = 0.3

Corr = 1
Cov = SDAsset1*SDAsset2*Corr

cov_matrix <- matrix(c(SDAsset1^2, Cov, Cov,  SDAsset2^2), nrow = 2)
cov_matrix
mu = c(0,0)
x<- mvrnorm(100000, mu,cov_matrix)

return1 <- x[,1]
return2 <- x[,2]

asset1 <- exp(return1)*100
asset2 <- exp(return2)*80

quantile(asset1, 0.9)
quantile(asset2, 0.9)



My question is now how would I have to change the code and parameters such that I could get the distribution after 1/2 year. My approach would be to take the volatility and divide it by the square root of 2, but I'm not sure where I would have to change the time step.

• Your approach for changing the volatility is correct. However, if the correlation between assets is 1, then asset 1 is just a scaled version of asset 2. – kurtosis Aug 6 '20 at 18:48