Hi, need some help with my thesis The multimensional binomial method

3 Ansichten (letzte 30 Tage)
Halvard Halvard
Halvard Halvard am 3 Nov. 2011
I have used the code from Implementing derivatives models, clewlow and chris Strickland, pp_ 44. I have problems understanding the for command that he uses in Pseudo-code. The answer is 5.3269
can anyone please help?
% American Call Option by Two-varible Binomial
clc, clear all
%input
K = 1;
T = 1;
S1 = 100;
S2 = 100;
sig1 = 0.2;
sig2 = 0.3;
div1 = 0.03;
div2 = 0.04;
rho = 0.5;
r = 0.06;
N = 3;
%precompute constants
dt = T/N;
nu1 = r - div1 - 0.5*sig1^2 %risk neutral process
nu2 = r - div2 - 0.5*sig2^2 %risk neutral process
dx1 = sig1*sqrt(dt)
dx2 = sig2*sqrt(dt)
disc = exp(-r*dt)
puu = (dx1*dx2 + (dx2*nu1 + dx1*nu2 + rho*sig1*sig2)*dt)/ (4*dx1*dx2)*disc %Risk index up, Oil Up
pud = (dx1*dx2 + (dx2*nu1 - dx1*nu2 - rho*sig1*sig2)*dt)/ (4*dx1*dx2)*disc %Risk index up, oil Down
pdu = (dx1*dx2 + (-dx2*nu1 + dx1*nu2 - rho*sig1*sig2)*dt) / (4*dx1*dx2)*disc %Risk index down, Oil Up
pdd = (dx1*dx2 + (-dx2*nu1 - dx1*nu2 + rho*sig1*sig2)*dt) / (4*dx1*dx2)*disc %Risk index down, Oil Down
edx1 = exp(dx1) %prop. increase if up movement
edx2 = exp(dx2) %prop. increase if up movement
%initialise asset prices at time step N
S1(N+1) = S1*exp(-N*dx1);
S2(N+1) = S2*exp(-N*dx2);
for j = N:1:N
S1(j) = S1(j+1)*edx1
S2(j) = S2(j+1)*edx2
end
%initialise option values at maturity
for j = 1:1:N+1
for k = 1:1:N+1
c(j,k) = max(0.0, S1(j)-S2(k) - K)
end
end
%step back through the tree applying early exercise
for i = N+1:1:0
for j = 1:1:i
for k = 1:1:i
c(j,k) = pdd*c(j-1,k-1) + pud*c(j+1,k-1) + pdu*c(j-1, k+1) + puu*c(j+1,k+1)
c(j,k) = max(c(j,k), S1(j) -S2(k)- K)
end
end
end
American_spread_option = c(0,0)

Antworten (0)

Kategorien

Mehr zu Software Development Tools finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by