function: 計財系碩一 108071603 黃偉德 1. Lookbackcallmc
function: 計財系碩一 108071603 黃偉德 1. Lookbackcallmc
function: 計財系碩一 108071603 黃偉德 1. Lookbackcallmc
HW11
計財系碩一 108071603 黃偉德
1. Lookbackcallmc
function
[Price,CI]=lookbackcallmc(S0,r,T,sigma,NSamples,NRepl
1 )
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
[Price,VarPrice,CI]=normfit(exp(-r*T).*Payoff);
2. Lookbackputmc
function
[Price,CI]=lookbackputmc(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
[Price,VarPrice,CI]=normfit(exp(-r*T).*Payoff);
3. Lookbackcallcv
function [Price,CI]=lookbackcallcv(S0,r,T,sigma,NSteps,NRepl,NPilot)
% Generate asset paths
Payoff=zeros(NPilot,1);
StockVals=zeros(NPilot,1);
for i=1:NPilot
Path=AssetPaths1(S0,r,sigma,T,NSteps,1);
StockVals(i,1)=Path(1,end);
Payoff(i,1)=max(0,Path(1,NSteps+1)-min(Path(1,2:(NSteps+1))));
end
OptionVals=exp(-r*T).*Payoff;
MatCov=cov(StockVals,OptionVals);
VarY=S0^2*exp(2*r*T)*(exp(T*sigma^2)-1);
c=-MatCov(1,2)/VarY;
ExpY=S0*exp(r*T);
for i=1:NRepl
Path1=AssetPaths1(S0,r,sigma,T,NSteps,1);
NewStockVals(i,1)=Path1(1,end);
Payoff1(i,1)=max(0,Path1(1,NSteps+1)-min(Path1(1,2:(NSteps+1))));
end
NewOptionVals=exp(-r*T).*Payoff1;
ControlVars=NewOptionVals+c*(NewStockVals-ExpY);
[Price,VarPrice,CI]=normfit(ControlVars);
4. Lookbackputcv
function [Price,CI]=lookbackputcv(S0,r,T,sigma,NSteps,NRepl,NPilot)
% Generate asset paths
Payoff=zeros(NPilot,1);
StockVals=zeros(NPilot,1);
for i=1:NPilot
Path=AssetPaths1(S0,r,sigma,T,NSteps,1);
StockVals(i,1)=Path(1,end);
Payoff(i,1)=max(0,max(Path(1,:))-Path(1,NSteps+1));
end
OptionVals=exp(-r*T).*Payoff;
MatCov=cov(StockVals,OptionVals);
VarY=S0^2*exp(2*r*T)*(exp(T*sigma^2)-1);
c=-MatCov(1,2)/VarY;
ExpY=S0*exp(r*T);
for i=1:NRepl
Path1=AssetPaths1(S0,r,sigma,T,NSteps,1);
NewStockVals(i,1)=Path1(1,end);
Payoff1(i,1)=max(0,max(Path1(1,:))-Path1(1,NSteps+1));
end
NewOptionVals=exp(-r*T).*Payoff1;
ControlVars=NewOptionVals+c*(NewStockVals-ExpY);
[Price,VarPrice,CI]=normfit(ControlVars);
5. Lookbackcallhalton
function
[Price,CI]=lookbackcallhalton(S0,r,T,sigma,NSamples,N
Repl)
Payoff=zeros(1,NRepl);
Path=HaltonPaths(S0,r,sigma,T,NSamples,NRepl);
for i=1:NRepl
Payoff(i)=max(0,Path(i,NSamples+1)-
min(Path(i,:)));
end
[Price,VarPrice,CI]=normfit(exp(-r*T)*Payoff);
6. Lookbackputhalton
function
[Price,CI]=lookbackputhalton(S0,r,T,sigma,NSamples,NR
epl)
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
[Price,VarPrice,CI]=normfit(exp(-r*T)*Payoff);
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: