Finite Difference method for American put option

12 vues (au cours des 30 derniers jours)
Julia
Julia le 19 Avr 2011
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 commentaire
Walter Roberson
Walter Roberson le 19 Avr 2011
It would probably help to post a link that explains the difference between European and American put options.

Connectez-vous pour commenter.

Réponse acceptée

Greg
Greg le 27 Avr 2011
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 commentaire
Julia
Julia le 28 Avr 2011
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.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Financial Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by