Professional Documents
Culture Documents
HW 10
HW 10
HW 10
ASIA OPTION
function
P=AsiaAssetPaths2(S0,mu,sigma,T,NSteps,
NRepl,x,r)
SPaths = zeros(NRepl, 1+NSteps);
SPaths(:,1) = S0;
dt = T/NSteps;
nudt = (mu-0.5*sigma^2)*dt;
sidt = sigma*sqrt(dt);
Result:
AsiaAssetPaths2(50,0.22,0.2,3,100,1000,50
for i=1:NRepl
for j=1:NSteps
SPaths(i,j+1)=SPaths(i,j)*exp(nudt +
sidt*randn);
end
end
Payoff=max((mean(SPaths'))'-x,0)
P = mean( exp(-r*T) * (Payoff));
ans =
15.8813
ASIA OPTION
max{ S (T ) A,0}
function
P=AsiaAssetPaths1(S0,mu,sigma,T,NSteps,
NRepl,r)
Result:
>>
AsiaAssetPaths1(50,0.22,0.2,3,100,10
00,0.02)
ans =
24.9476
>>
lookbackcalloption(50,0.01,3,0.2,100,
10)
Price =
13.9150
VarPrice =
8.7873
CI =
7.6289
20.2010
function P = lookbackcalloption(S0
,r,T,sigma,NSteps,NRepl)
Payoff = zeros(1,NRepl);
SPath=AssetPaths(S0,r,sigma,T,NSt
eps,NRepl);
for i=1:NRepl
Payoff(i) = max(0, SPath(i,NSteps
+1)-min(SPath(i,:)));
end
P = normfit( exp(-r*T) * Payoff)
>>
lookbackputoption(50,0.01,3,0.2,100
)
Price =
12.4331
VarPrice =
9.8314
CI =
5.4001
19.4660
AsianHalton
function SPaths=HaltonPaths(S0,mu,sigma,T,NSteps,NRepl)
dt = T/NSteps;
nudt = (mu-0.5*sigma^2)*dt;
sidt = sigma*sqrt(dt);
NRepl = 2*ceil(NRepl/2); % make sure it's even
% Use Box Muller to generate standard normals
RandMat = zeros(NRepl, NSteps);
seeds = myprimes(2*NSteps);
Base1 = seeds(1:NSteps);
Base2 = seeds((NSteps+1):(2*NSteps));
for i=1:NSteps
H1 = GetHalton(NRepl/2,Base1(i));
H2 = GetHalton(NRepl/2,Base2(i));
VLog = sqrt(-2*log(H1));
Norm1 = VLog .* cos(2*pi*H2);
Norm2 = VLog .* sin(2*pi*H2);
RandMat(:,i) = [Norm1 ; Norm2];
end
AsianHalton
AsianHalton
P=
1.9199e+03
aux =
4.7639e+03
ci =
1.0e+03 *
0.9747
2.8652
P=
1.9199e+03