Finite Difference method for American put option

조회 수: 16 (최근 30일)
Julia
Julia 2011년 4월 19일
I have the code for finite difference method for European put option and I need to make adjustments to this code so that it calculates the price of an American option instead of a European one. I did finite difference method in Excel about a year ago but I'm new to Matlab and haven't got a clue. I would really appreciate it if someone could tell me where in the code I should make the adjustments and what these adjustments are.
Here's the code:
function price = EuPutExpl(S0,K,r,T,sigma,Smax,dS,dt)
M = round(Smax/dS);
dS = Smax/M;
N = round(T/dt);
dt = T/N;
matval = zeros(M+1,N+1);
vetS = linspace(0,Smax,M+1);
veti = 0:M;
vetj = 0:N;
matval(:,N+1) = max(K-vetS,0);
matval(1,:) = K*exp(-r*dt*(N-vetj));
matval(M+1,:) = 0;
a = 0.5*dt*(sigma^2*veti - r).*veti;
b = 1 - dt*(sigma^2*veti.^2 + r);
c = 0.5*dt*(sigma^2*veti + r).*veti;
for j=N:-1:1
for i=2:M
matval(i,j) = a(i)*matval(i-1,j+1) + b(i)*matval(i,j+1)+c(i)*matval(i+1,j+1);
end
end
price = interp1(vetS, matval(:,1),S0);
  댓글 수: 1
Walter Roberson
Walter Roberson 2011년 4월 19일
It would probably help to post a link that explains the difference between European and American put options.

댓글을 달려면 로그인하십시오.

채택된 답변

Greg
Greg 2011년 4월 27일
For a beginner, this is quite impressive code!
I suppose for an American Put, you will just need to compute whether the put value that you compute in each loop (i.e. matval(i,j)) is the maximum value in it's row (i.e. for a given strike level). If so, set the current value equal to the maximum of that row. Otherwise, leave as is.
Good luck, and please correct me if I've made any schoolboy errors!
Greg
  댓글 수: 1
Julia
Julia 2011년 4월 28일
I was actually able to figure it out on my own. But thanks anyway.
By the way, I did not write the code above, I took it from the book.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Financial Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by