I am trying to model the stock's price process. Let's assume volatility and risk-free rate is given. I've come up with the code below to try and model the price process with the geometrical Brownian motion. This should take into account risk-free rate and dividend yield q.

$$S_t = S_0 \exp\left(\left[r-q-\frac 12\sigma^2\right]t + \sigma W_t\right)$$

% initial price, time, risk-free rate, dividend yield pct, volatility
% p = simPrice(66, 365, 0.0088, 0.0236, 0.2);

function [path] = simPrice(initialPrice, days, r, q, sigma)

    path = zeros(1, days+1);
    path(1) = initialPrice;
    for t=1:length(path)-1
        path(t+1) = nextSt(path(t), (1/days), r, q, sigma);


function [ expected ] = nextSt(initial, t, r, q, sigma)

    n = randn();
    expected = initial * exp( (r - q -(0.5 * (sigma^2)))*t + sigma*sqrt(t)*n);

However, as I am quite new to this, I'd like some reassurance that this is indeed correct. I feel like the price process is a bit jumpy? I am particularly worried that I am doing something wrong in the nextSt(..) function. This could be either in the formula inside the function itself (am I implementing the $W_t$ part of the formula correctly?) or the parameters I pass to it. For example, I am not sure if I am doing the time parameters right here.

enter image description here

Note that I am using annualised volatility, dividend yield and risk-free rate. The next St is always computed over one day. So shouldn't I have to convert those parameters to daily values by dividing by $sqrt(252)$?

This is the result when I do so:

enter image description here

The results on the first graph seem more plausible, but the parameters I used there make no sense?

  • 1
    $\begingroup$ There is no jump in your simulation. Black Scholes model has no jump term. However, it is fine. $\endgroup$ – user16651 Dec 25 '16 at 6:33
  • $\begingroup$ @BehrouzMaleki But I don't get how I can compute the next day St, with an annualised volatility, dividend and risk-free rate. If I convert those parameters to daily parameters by dividing by $sqrt(252)$ the paths have virtually no variance anymore $\endgroup$ – drx Dec 25 '16 at 14:53
  • $\begingroup$ Sorry I didn't understand what you said. $\endgroup$ – user16651 Dec 25 '16 at 14:56
  • $\begingroup$ @BehrouzMaleki I updated my question below the first graph. So I am always computing next day's price of the stock. But the parameters I use for the brownian motion function are annualised. So I give a sigma that is 0.2 over a year. But I am working with periods of a day. This does not make sense right? $\endgroup$ – drx Dec 25 '16 at 15:00
  • 2
    $\begingroup$ Note , you should calibrate the model. You can't use arbitrary parameters and say the result is meaningless. $\endgroup$ – user16651 Dec 25 '16 at 15:07

Time dimension of volatility and risk-free rate should match the time unit of your step (dt) in BM. If t represents year then sigma and r should be annualized, if t is in days then you should apply the square-root rule.


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.