Download presentation
Presentation is loading. Please wait.
Published byAhmad Whitmill Modified over 9 years ago
1
金融商品設計與評價 hw13 計財系大三 林奕全
2
Outline 1. Asian option in MC/Control variate Call(max(A-X,0)/max(S(T)-A,0) Put(max(A-X,0)/max(A-S(T),0) 2. Lookback option
3
In MC simulation way
4
max(A-X,0) function [ P,CI ] = AsianMCCall1(s0,X,r,T,sigma,NSamples,NRepl ) Payoff=zeros(NRepl,1); for(i=1:NRepl) Path=AssetPaths1(s0,r,sigma,T,NSamples,1); Payoff(i)=max(0,mean(Path(2:(NSamples+1)))-X); end [P,aux,CI]=normfit(exp(-r*T)*Payoff);
5
max(S(T)-A,0) function [ P,CI ] = AsianMCCall2(s0,X,r,T,sigma,NSamples,NRepl ) Payoff=zeros(NRepl,1); for(i=1:NRepl) Path=AssetPaths1(s0,r,sigma,T,NSamples,1); Payoff(i)=max(0,Path(NSamples+1)- mean(Path(2:(NSamples+1)))); end [P,aux,CI]=normfit(exp(-r*T)*Payoff);
6
max(A-X,0) function [ P,CI ] = AsianMCPut1(s0,X,r,T,sigma,NSamples,NRepl ) Payoff=zeros(NRepl,1); for(i=1:NRepl) Path=AssetPaths1(s0,r,sigma,T,NSamples,1); Payoff(i)=max(0,X-mean(Path(2:(NSamples+1)))); end [P,aux,CI]=normfit(exp(-r*T)*Payoff);
7
max(A-S(T),0) function [ P,CI ] = AsianMCPut2(s0,X,r,T,sigma,NSamples,NRepl ) Payoff=zeros(NRepl,1); for(i=1:NRepl) Path=AssetPaths1(s0,r,sigma,T,NSamples,1); Payoff(i)=max(0,mean(Path(2:(NSamples+1)))- Path(NSamples+1)); end [P,aux,CI]=normfit(exp(-r*T)*Payoff);
8
In control variate way
9
max(A-X,0) function [ P,CI ] = AsianMCCV( s0,X,r,T,sigma,NSamples,NRepl1,Npilot ) TryPath=AssetPaths1(s0,r,sigma,T,NSamples,Npilot); Stocksum=sum(TryPath,2); PP=mean(TryPath(:,2:(NSamples+1)),2); TryPayoff=exp(-r*T)*max(PP-X,0); Matcov=cov(Stocksum,TryPayoff); c=-Matcov(1,2)/var(Stocksum); dt=T/NSamples; ExpSum=s0*(1-exp((NSamples+1)*r*dt))/(1-exp(r*dt));
10
ControlVars=zeros(NRepl1,1); for i=1:NRepl1 StockPath=AssetPaths1(s0,r,sigma,T,NSamples,1); Payoff=exp(- r*T)*max(0,mean(StockPath(2:(NSamples+1)))- StockPath(NSamples+1)); ControlVars(i)=Payoff+c*(sum(StockPath)-ExpSum); end [P,aux,CI]=normfit(ControlVars);
11
max(S(T)-A,0) function [ P,CI ] = AsianMCCVCall2( s0,X,r,T,sigma,NSamples,NRepl1,Npilot ) TryPath=AssetPaths1(s0,r,sigma,T,NSamples,Npilot); Stocksum=sum(TryPath,2); PP=mean(TryPath(:,2:(NSamples+1)),2); TryPayoff=exp(-r*T)*max(TryPath(NSamples+1)-PP,0); Matcov=cov(Stocksum,TryPayoff); c=-Matcov(1,2)/var(Stocksum); dt=T/NSamples; ExpSum=s0*(1-exp((NSamples+1)*r*dt))/(1-exp(r*dt)); ControlVars=zeros(NRepl1,1);
12
for i=1:NRepl1 StockPath=AssetPaths1(s0,r,sigma,T,NSamples,1); Payoff=exp(-r*T)*max(0,StockPath(NSamples+1)- mean(StockPath(2:(NSamples+1)))); ControlVars(i)=Payoff+c*(sum(StockPath)-ExpSum); end [P,aux,CI]=normfit(ControlVars);
13
max(X-A,0) function [ P,CI ] = AsianMCCVPut1( s0,X,r,T,sigma,NSamples,NRepl1,Npilot ) TryPath=AssetPaths1(s0,r,sigma,T,NSamples,Npilot); Stocksum=sum(TryPath,2); PP=mean(TryPath(:,2:(NSamples+1)),2); TryPayoff=exp(-r*T)*max(X-PP,0); Matcov=cov(Stocksum,TryPayoff); c=-Matcov(1,2)/var(Stocksum); dt=T/NSamples; ExpSum=s0*(1-exp((NSamples+1)*r*dt))/(1-exp(r*dt)); ControlVars=zeros(NRepl1,1);
14
for i=1:NRepl1 StockPath=AssetPaths1(s0,r,sigma,T,NSamples,1); Payoff=exp(-r*T)*max(0,X- mean(StockPath(2:(NSamples+1)))); ControlVars(i)=Payoff+c*(sum(StockPath)-ExpSum); end [P,aux,CI]=normfit(ControlVars);
15
max(A-S(T),0) function [ P,CI ] = AsianMCCVPut2( s0,r,T,sigma,NSamples,NRepl1,Npilot ) TryPath=AssetPaths1(s0,r,sigma,T,NSamples,Npilot); Stocksum=sum(TryPath,2); PP=mean(TryPath(:,2:(NSamples+1)),2); TryPayoff=exp(-r*T)*max(PP-TryPath(NSamples+1),0); Matcov=cov(Stocksum,TryPayoff); c=-Matcov(1,2)/var(Stocksum); dt=T/NSamples; ExpSum=s0*(1-exp((NSamples+1)*r*dt))/(1-exp(r*dt)); ControlVars=zeros(NRepl1,1);
16
for i=1:NRepl1 StockPath=AssetPaths1(s0,r,sigma,T,NSamples,1); Payoff=exp(- r*T)*max(0,mean(StockPath(2:(NSamples+1)))- StockPath(NSamples+1)); ControlVars(i)=Payoff+c*(sum(StockPath)-ExpSum); end [P,CI]=normfit(ControlVars);
17
PriceCICI(2)-CI(1) max(A-X,0)-MC3.9810[3.9288,4.0333]0.1045 max(A-X,0)-CV3.9515[3.9301,3.9730]0.0429 max(S(T)-A,0)-MC2.9465[2.9055,2.9874]0.0819 max(S(T)-A,0)-CV2.8972[2.8372,2.9573]0.1201 Compare MC/CV in call
18
PriceCICI(2)-CI(1) max(X-A,0)-MC2.7375[2.7027,2.7723]0.0696 max(X-A,0)-CV2.7612[2.7396,2.7827]0.0431 max(A-S(T),0)-MC2.0988[2.0728,2.1249]0.0521 max(A-S(T),0)-CV2.0870[2.0256,2.1485]0.1222 Compare MC/CV in Put
19
LookbackCall1 function [ Payoff ] = LookbackCall1(s0,r,T,sigma,NSamples,NRepl1 ) Payoff=ones(1,NRepl1); for i=1:NRepl1 Path=AssetPaths1(s0,r,sigma,T,NSamples,1); Payoff(i)=max(0,Path(NSamples+1)- min(Path(2:(NSamples+1)))); end Payoff=mean(Payoff);
20
LookbackPut1 function [ Payoff ] = LookbackPut1(s0,r,T,sigma,NSamples,NRepl1 ) Payoff=ones(1,NRepl1); for i=1:NRepl1 Path=AssetPaths1(s0,r,sigma,T,NSamples,1); Payoff(i)=max(0,max(Path(2:(NSamples+1)))- Path(NSamples+1)); end Payoff=mean(Payoff);
21
rand(‘seed’,0) NRepl1=10000; NRepl2=20000; NRepl3=30000; LookbackCall1(s0,r,T,sigma,NSamples,NRepl1 ) LookbackPut1(s0,r,T,sigma,NSamples,NRepl1 )
22
100002000030000 Lookback Call7.25567.14537.2604 Lookback Put5.91795.92865.9510 Compare in Lookback call/put
23
Put : max(0, Smax – St ) function P = AsianHaltonCall1(S0,X,r,T,sigma,NSamples,NRepl) Payoff = zeros(1,NRepl); Path=HaltonPaths(S0,r,sigma,T,NSamples,NRepl); for i=1:NRepl Payoff(i) = max(0, max(Path(i,:))- Path(i,NSamples+1)); end P = mean( exp(-r*T) * Payoff); lookback option in Halton
24
S0=50; X=50; r=0.1; T=5/12; sigma=0.4; NSamples=5; NRepl1=10000; NRepl2=20000; NRepl3=30000;
25
lookbackcalloption10000=AsianHaltonCall1 (S0,X,r,T,sigma,NSamples,NRepl1); lookbackcalloption20000=AsianHaltonCall1 (S0,X,r,T,sigma,NSamples,NRepl2); lookbackcalloption30000=AsianHaltonCall1 (S0,X,r,T,sigma,NSamples,NRepl3);
26
100002000030000 MC7.25567.14537.2604 Halton 8.0861 8.0750 8.0616 Lookback call in MC/Halton
27
lookbackputoption10000=AsianHaltonPut1 (S0,X,r,T,sigma,NSamples,NRepl1); lookbackputoption20000=AsianHaltonPut1 (S0,X,r,T,sigma,NSamples,NRepl2); lookbackputoption30000=AsianHaltonPut1 (S0,X,r,T,sigma,NSamples,NRepl3);
28
100002000030000 MC5.91795.92865.9510 Halton 6.6060 6.6297 6.6195 Lookback Put in MC/Halton
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.