0
$\begingroup$

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!

$\endgroup$
4
  • 1
    $\begingroup$ Attenation: volatility scale with the square-root of time, so your first transformation should be volatility/100/$\sqrt{365}$. $\endgroup$
    – Richi W
    Jul 4, 2014 at 6:50
  • $\begingroup$ Thank you Richard!! I fix that. And how about the drift ? Is there SQRT too or just 250 is fine ? $\endgroup$
    – Pam
    Jul 11, 2014 at 11:54
  • 1
    $\begingroup$ There $250$ is fine. $\endgroup$
    – Richi W
    Jul 11, 2014 at 13:28
  • $\begingroup$ Thank you Richard! I never fully understood that. If we say that the annual drift is -50%, would that mean that the expected price decrease after one year is of 50% of the "initial price" (first in the simulation), or what is the correct interpretation of that parameter ? $\endgroup$
    – Pam
    Jul 11, 2014 at 16:22

1 Answer 1

1
$\begingroup$

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).

$\endgroup$
8
  • $\begingroup$ I have hard time converting your notation into my program symbols. The formula generates paths that looks fine, I am just unsure about the drift. Should it be multiplied for the Normal ? Could you make your proposal using my symbols, so I can understand it better and plug it in my program ? My unit of time is the day: fractions are used because this is millisecond tickdata. $\endgroup$
    – Pam
    Jul 3, 2014 at 18:27
  • $\begingroup$ Cf: youtube.com/watch?v=e79OtCamxD0 where the same is used $\endgroup$
    – Pam
    Jul 3, 2014 at 18:34
  • 1
    $\begingroup$ @Pam I added it $\endgroup$
    – emcor
    Jul 3, 2014 at 18:44
  • $\begingroup$ Ok thank you. One doubt before trying it on the pc. Assume It is specified a drift of 40% per year. The number I need to plug in the above formula is Drift% / 100 / 365 or what else ? And by volatility do you mean the daily volatility ? $\endgroup$
    – Pam
    Jul 3, 2014 at 18:48
  • 1
    $\begingroup$ Usually one uses "trading days per year", which is 250. So if drift 40% per year, then 40/100/250 per day (same for volatility) $\endgroup$
    – emcor
    Jul 3, 2014 at 19:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.