Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Hw1:

% LookbackHaltonPut.m
function [P,CI] =
LookbackHaltonPut(S0,X,r,T,sigma,NSteps,NRepl)
Payoff = zeros(NRepl,1);
Path=HaltonPaths(S0,r,sigma,T,NSteps,NRepl);
Payoff = max(0, max(Path,[],2) - X);
[P,aux,CI] = normfit(exp(-r*T) * Payoff);

S0=50;
X=50;
r=0.1;
T=5/12;
sigma=0.4;
NSteps=5;
NRepl1=1000;
NRepl2=2000;
NRepl3=3000;
NRepl4=10000;
NRepl5=30000;

[Lookback1000,CI1]=LookbackHaltonPut(S0,X,r,T,sigma,NSteps,N
Repl1);
[Lookback2000,CI2]=LookbackHaltonPut(S0,X,r,T,sigma,NSteps,N
Repl2);
[Lookback3000,CI3]=LookbackHaltonPut(S0,X,r,T,sigma,NSteps,N
Repl3);
[Lookback10000,CI4]=LookbackHaltonPut(S0,X,r,T,sigma,NSteps,
NRepl4);
[Lookback30000,CI5]=LookbackHaltonPut(S0,X,r,T,sigma,NSteps,
NRepl5);

Lookback1000
CI1
Lookback2000
CI2
Lookback3000
CI3
Lookback10000
CI4
Lookback30000
CI5

You might also like