Upload
diem
View
44
Download
0
Embed Size (px)
DESCRIPTION
HW6. 100071021 楊佑濬. Proportion Dividends (1). function [ Cprice , Pprice , Clattice , Plattice ] = bitprice_p ( S, K, r, T, sigma, q, tau, N, mode ) % mode : 1=>American 0=>European % dividend : proportion deltaT = T/N; u = exp ( sigma * sqrt ( deltaT ) ); d = 1/u; - PowerPoint PPT Presentation
Citation preview
HW6100071021 楊佑濬
PROPORTION DIVIDENDS (1)function [ Cprice, Pprice, Clattice, Plattice] = bitprice_p( S, K, r, T, sigma, q, tau, N, mode )
% mode : 1=>American 0=>European
% dividend : proportion
deltaT = T/N;
u = exp( sigma * sqrt(deltaT) );
d = 1/u;
p = ( exp( r * deltaT ) - d ) / ( u - d );
for i = 0 : N
C(i+1) = max( 0, S * (1-q) * u^(N-i) * d^(i) - K );
P(i+1) = max( 0, K - S * (1-q) * u^(N-i) * d^(i) );
end
PROPORTION DIVIDENDS (2) for i = N : -1 : 1
for j = 0 : i-1
C(j+1) = exp(-r*deltaT) * ( C(j+1)*p + C(j+2)*(1-p) );
P(j+1) = exp(-r*deltaT) * ( P(j+1)*p + P(j+2)*(1-p) );
if mode == 1
now_p = S * u^(i-1-j) * d^(j) ;
if i>tau
now_p = now_p * (1-q);
end
C(j+1) = max( C(j+1) , now_p - K );
P(j+1) = max( P(j+1) , K - now_p );
end
end
Clattice(1:i,i) = C(1:i);
Plattice(1:i,i) = P(1:i);
end
EXAMPLE - EUROPEAN
S0=50, K=50, r=0.02, T=1, sigma=0.2, q=0.1, tau=3, N=10, mode=European
>> [c p cla pla] = bitprice_p(50,50,0.02,1,0.2,0.1,3,10,0)
c =
2.0767
p =
6.0867
EXAMPLE - AMERICAN
S0=50, K=50, r=0.02, T=1, sigma=0.2, q=0.1, tau=3, N=10, mode=American
>> [c p cla pla] = bitprice_p(50,50,0.02,1,0.2,0.1,3,10,1)
c =
2.6130
p =
6.2852
COMPARE
European
c =
2.0767
p =
6.0867
American
c =
2.6130
p =
6.2852
DOLLAR DIVIDENDS (1)function [ Cprice, Pprice, Clattice, Plattice] = bitprice_d( S, K, r, T, sigma, D, tau, N, mode )
% mode : 1=>American 0=>European
% dividend : dollar
deltaT = T/N;
u = exp( sigma * sqrt(deltaT) );
d = 1/u;
p = ( exp( r * deltaT ) - d ) / ( u - d );
Sa = S - D * exp( -r * tau * deltaT );
for i = 0 : N
C(i+1) = max( 0, Sa * u^(N-i) * d^(i) - K );
P(i+1) = max( 0, K - Sa * u^(N-i) * d^(i) );
end
DOLLAR DIVIDENDS (2) for i = N : -1 : 1
for j = 0 : i-1
C(j+1) = exp(-r*deltaT) * ( C(j+1)*p + C(j+2)*(1-p) );
P(j+1) = exp(-r*deltaT) * ( P(j+1)*p + P(j+2)*(1-p) );
if mode == 1
now_p = Sa * u^(i-1-j) * d^(j) ;
if i<=tau
now_p = now_p + D * exp( -r * (tau-i+1) * deltaT );
end
C(j+1) = max( C(j+1) , now_p - K );
P(j+1) = max( P(j+1) , K - now_p );
end
end
Clattice(1:i,i) = C(1:i);
Plattice(1:i,i) = P(1:i);
end
EXAMPLE - EUROPEAN
S0=50, K=50, r=0.02, T=1, sigma=0.2, D=5, tau=3, N=10, mode=European
>> [c p cl pl] = bitprice_d(50,50,0.02,1,0.2,5,3,10,0)
c =
2.0904
p =
6.0704
EXAMPLE - AMERICAN
S0=50, K=50, r=0.02, T=1, sigma=0.2, D=5, tau=3, N=10, mode=American
>> [c p cl pl] = bitprice_d(50,50,0.02,1,0.2,5,3,10,1)
c =
2.4588
p =
6.2673
COMPARE
European
c =
2.0904
p =
6.0704
American
c =
2.4588
p =
6.2673