Option pricing code: a problem on dimension

1 次查看(过去 30 天)
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 个)

类别

Help CenterFile Exchange 中查找有关 Price and Analyze Financial Instruments 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by