March 27th, 2007, 1:04 am
Thank you very much for your helpI have finished the simulation in C++, but I don't know whether the result from my simulation is correct.My one case: I tried 10 underlying assets, 1 observation time, initial prices of all assets is 100, volatility of all assets is 0.3, correlation among assets is 0, the free-risk interest is 0.05, strike price is 100, time to maturity is 1. The result is 4.39775The vector on uncorrelated standard normal random numbers is generated by Sobol sequence. Is it Ok?Now I want to caculate the relative standard deviation, thus I can improve my program. Could you tell me how to do it?QuoteOriginally posted by: outrunYou need lots of stuff in C++This is how you simulate a single asset starting at S_0 an moving to a random value at S_t. You can repeat this multiple times to simulate a path in time of that asset.S_t = S_0*exp( (r-0.5*v*v)*t + v*sqr(t)*N );withN a standard normal distributed random variable (see box muller method for generating normal distributed random values)v annualized volatilityt timestepr interest rate, (continuous compounded)If you want to simulate multiple assets, you exactly the same thing for each asset, but you have to make sure that "N" values are correlated. E.g. for two assets:S1_t = S1_0*exp( (r-0.5*v*v)*t + v1*sqr(t)*N1 );S2_t = S2_0*exp( (r-0.5*v*v)*t + v2*sqr(t)*N2 );...The correlated standard normal random numbers N1,N2,.. can be generated using the following steps:1) do a Choleski decomposition of the correlation matrix, this will give you a lower (or upper) triangular matrix2) multiply this lower triangular matrix with a vector on UNcorrelated standard normal random numbers to get a vector of correlated random numbers