필터 지우기
필터 지우기

Option pricing code: a problem on dimension

조회 수: 1 (최근 30일)
Zeynep Toprak
Zeynep Toprak 2020년 5월 13일
편집: Zeynep Toprak 2020년 5월 13일
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