Option pricing code: a problem on dimension
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
I would like to generate a code to calculate option pricing by using stock prices which follows geometric brownian motion process.
My code is as follows:
%define given values
t = 1;
n = 100;
s0=100;
mu = 0.1;
sigma = 0.05;
dt = t/n;
%calculate stock price which follows geometric brownian motion process
s=s0*exp((mu-1/2*sigma^2)*dt+sigma*randn(n,1)*sqrt(dt));
x = 125; %exercise price
r = 0.0446; %interest rate
T = 0.0575; %maturity time
%calculate call option value by BSM model.
d1 = (log(s./x) - [r+ ((sigma^2)/2)]* T)/(sigma * sqrt(T));
d2 = d1 - (sigma* sqrt(T));
Nd1 = normcdf(d1);
Nd2 = normcdf (d2);
%call value
C = s .* Nd1 - x * exp(-r * T) .* Nd2 ;
disp(C)
I get many call values, but I need to find only one call value. And All call values are equal to zero. Why? How can I correct this?
One more question is that I am not sure whether I determine maturity time (T) by myself or not. How should I do?
Thanks a lot. But please help me to get just one call value.
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Price and Analyze Financial Instruments finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!