You are on page 1of 2

Binomial tree method for options pricing

1 Binomail
ia
Before giving the algorithm, we first recall for the formula to calculate the coefficients in the discrete
binomial model:
1 2)
p 1 er t d
r t
x = (e + e(r+ t
), d=x x2 1, u= , p= . (1.1)
2 d u d
and the formula to calculate the initial price of the option
m+1
Vjm = e r t
(pVj+1 + (1 p)Vjm ), j = 0, ..., m and m = 0, ..., M. (1.2)

The following algorithm is to compute European put/call option price by using binomial tree:

Input: r, , S = S0 , T, K, choice of European put or call, M


calulate : t := T /M, u, d, p from (1.1)
S00 := S0
SjM = S00 uj dM j , j = 0, 1, ..., M
VjM = max{K SjM , 0} or max{SjM K, 0}
Vjm for j = 0, ..., m and m = 0, ..., M
Output : V00

We will write a Matlab code for the above algorithm with parameters: K = 10, S = 5, r = 0.06,

1
= 0.3 and T = 1:

clear
T = 1;

K
E = 10; S = 5; r = 0.06; sigma = 0.3; M = 64;

dt = T/M;
x = 0.5 ⇤ (exp( r ⇤ dt) + exp((r + sigma ⇤ sigma) ⇤ dt));
u = x + sqrt(x ⇤ x 1); d = 1/u; p = (exp(r ⇤ dt) d)/(u d);

W = zeros(M + 1, 1);
W(1) = S;

for i = 1 : M 12 3 EM
W4743500 Wmata
for n = i :
I 1:1
v43 n'Sco
W(n + 1) = u ⇤ W(n); W 2 ago
end w2 adsia I
W(1) = d ⇤ W(1); 5101 wit ds
wind's
end
Wind's
Vmm
for n = 1 : M + 1 W Mtl
W(n) = max(E W(n), 0); WCM VM
end

for i = M : 1:1
for n = 1 : i W1 Vom

W(n) = exp( r ⇤ dt) ⇤ (p ⇤ W(n + 1) + (1 p) ⇤ W(n));


end
end

disp(‘Option value is0 ), disp(W(1)) Wit prithvi


V
w
way
2

wlmtvm.tl

You might also like