Tuesday, June 16, 2015

stochastic processes - Getting the next price of a GBM (Geometric Brownian Motion)


I am writing a program that creates realizations of a GBM.


Starting from an initial price, I get the following price with this formula:


NewPrice = PreviousPrice * Exp(Volatility * N10 * Sqrt(DaysElapsed) + Drift * DaysElapsed)


Where:



  • Volatility is the annual percentage volatility / 100 / sqrt(250)

  • Drift the annual percentage Drift / 100 / 250

  • N01 is a standard normal realization

  • DaysElapsed are the days elapsed from previous price (this is a small fraction in my case)


I am not sure that I am doing this right. Is the above line correct ? Please, suggest the right code expression or other possible corrections. Thank you!



Answer




GBM is defined as $$ S_t = S_{t-1}\exp\left( \left(\mu - \frac{\sigma^2}{2} \right)dt + \sigma dW_t\right)$$


So, in your notation, assuming your daily parameters:


$$ S_{new} = S_{previous}\cdot\exp\left( \left({drift} - \frac{{volatility}^2}{2} \right)days + volatility \,\sqrt{days}\,N(0,1)\right)$$


So your formula was incorrect. The youtube you quote is only true for 1-year timesteps (while you have $days$ steps).


No comments:

Post a Comment

technique - How credible is wikipedia?

I understand that this question relates more to wikipedia than it does writing but... If I was going to use wikipedia for a source for a res...