Finite Difference method for American put option
16 ビュー (過去 30 日間)
古いコメントを表示
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
2011 年 4 月 19 日
It would probably help to post a link that explains the difference between European and American put options.
採用された回答
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
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Financial Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!