3
$\begingroup$

I am playing around with writing a daily stock price prediction algo in Python using a Monte Carlo/GBM methodology. I know there are many other questions on here about this topic (here, and here), but I'm super confused on the inputs and choice of time delta to give sensible results. It seems that unless you have a time delta (dt) increment that is suitably tiny, the results are garbage, and vary wildly with the choice of dt. Obviously I can see that dt is involved in the exponential component, so any change to it will have a big effect. My question is how does one choose a dt?

I'm basically using the great example here, which uses numpy (apologies to the non-python people).

I want to model daily price movements, and look at the results after a certain number of steps (n). I see a lot of examples use a dt of 1/252 (number of trading days in a year, then look at the n-th index of the each sims array to see the values.

Why do we need to have dt as 1/252 to model daily movements? Can we use 1/50 say? Does dt have to be 'suitably tiny'?

As an example, let's use FB. It is trading at 118.72. I want to know the probability of it being above 125 after 60 trading days. I will run 10,000 paths. FB standard deviation is 0.12.

Using a dt of 1/252, and looking at the 60th value of each result, gives me 1912 paths with a value above 125, so a 19% chance.

Using a dt of 1/50 gives me 3294 paths, a 33% chance.

Very confused.

Apologies if this is a stupid question to all the quants on here - I'm primarily a coder.

$\endgroup$
  • $\begingroup$ What is the standard deviation of the price 60 days hence in the two simulations (At 60*dt in the first case and 12*dt in the second)? Are they comparable? They should both be approx $0.12*\sqrt{60/252}$ since you have an 0.12 annual standard deviation. $\endgroup$ – noob2 Jun 9 '16 at 16:53
  • $\begingroup$ Your problem is that you're mixing units... when you say FB standard variation is 0.12 you must be careful. Is it the standard variation of facebook share prices or facebook (log-)returns? Similarly, on what time horizon is it measured, daily, monthly, annually returns... ? When people use $\delta t=1/252$ it's because they also use annualised rates/volatilities and volatility in BS is the STDEV of log-returns. $\endgroup$ – Quantuple Jun 9 '16 at 17:01
  • 1
    $\begingroup$ Also note that under such a model, you don't really need MC simulations to forecast the future prices since you assume they follow a lognormal distribution, you can get the probabilities in "analytically". $\endgroup$ – Quantuple Jun 9 '16 at 17:01
  • 2
    $\begingroup$ If you assume that daily (log-)returns are iid with a constant variance $\sigma^2_d$, the variance of a $N$-days (log-)return, which is the sum of $N$ independent daily gaussian (log-)returns, is $\sigma^2 = N \sigma^2_d$ (additivity of variance). Thus, when you are using annualised quantities, and assuming there are $N=252$ trading days in a year which is a mere convention (approximately 5 trading days a weak during 52 weeks) then you must pick $\Delta t = 1/N $ to simulate daily returns for the variance to remain consistent $\endgroup$ – Quantuple Jun 9 '16 at 17:44
  • 1
    $\begingroup$ This is because reciprocally $\sigma^2_d = 1/N \sigma^2$, if $\sigma^2$ denotes the variance of $N$-days log-returns. Remember that all this works because returns are assumed to be independently and identically distributed. $\endgroup$ – Quantuple Jun 9 '16 at 17:47
3
$\begingroup$

Typically when running a Monte Carlo simulation we might simulate an SDE similar to $$ \dfrac{dS}{S} = \mu\:dt + \sigma \: dW(t) $$ by some appropriate method (e.g. Euler-Maruyama, Milstein, etc). We notice by dimensional analysis that if $t$ is in units of $\textrm{years}$ then $\mu \sim \textrm{years}^{-1}$ and $\sigma \sim \textrm{years}^{-1/2}$.

Typically we chose $dt = 1/252$ because there are around 252 trading days in a year, and when analysts crunch the daily values, they "pretend" that there are 252 days in a year for convenience. Hence if you want to simulate on a "daily" (252 days in a year) time scale then we would have the scaling $\mu \to \dfrac{\mu}{252}$ and $\sigma \to \dfrac{\sigma}{\sqrt{252\:}}$.

Provided we are using a Monte Carlo method then we can use whatever timescale we like if we're only interested in the final value. (Compare this to finite difference schemes where our choice of increments always has effects on convergence).

Caveat:

We are using the Monte Carlo approach to simulate what the final value would be, and sometimes this is path dependent (suppose $\sigma \to \sigma(S)$, which is called a local volatility model). Then the distribution of final values we compute is only an approximation to the actual distribution of solutions to the SDE. Hence if we use a smaller $\Delta t$ then our approximate distribution converges to the true distribution (cf strong and weak convergence), and generally for the Euler-Maruyama scheme the convergence is $O(\Delta t)$, which means smaller time scales give better results.

If this is the case then there are methods for choosing an appropriate $\Delta t$, but this depends on what Monte Carlo scheme we use, Classical MC, Quasi MC, Multilevel MC, etc.

I hope this helps.

$\endgroup$
  • $\begingroup$ Yes, very helpful. Lots to think about. So if my FB example standard deviation (0.12) was calculated over 50 days, I'd have to scale it to 0.12 * sqrt(50/252)? $\endgroup$ – professorDante Jun 9 '16 at 17:56
  • $\begingroup$ You just divide by sqrt (50) to obtain the daily volatility and indeed multiply back by sqrt (252) if you want the annual volatility. $\endgroup$ – Quantuple Jun 9 '16 at 18:00
  • 1
    $\begingroup$ So it really depends on if you want to use $\Delta t =1$ (day) + daily volatility or $\Delta t =1/252$ (year) + annual volatility to simulate your daily returns. But it's exactly the same $\endgroup$ – Quantuple Jun 9 '16 at 18:01

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.