Finite Difference method for American put option

10 visualizaciones (últimos 30 días)
Julia
Julia el 19 de Abr. de 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 comentario
Walter Roberson
Walter Roberson el 19 de Abr. de 2011
It would probably help to post a link that explains the difference between European and American put options.

Iniciar sesión para comentar.

Respuesta aceptada

Greg
Greg el 27 de Abr. de 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 comentario
Julia
Julia el 28 de Abr. de 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.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Financial Toolbox en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by