You are on page 1of 3

HW1

 European put

% BlsMP.m
% CompBlsMP.m Compare blsprice and BlsMC1000 and BlsMC200000

S0=50;
X=52;
r=0.1;
T=5/12;
sigma=0.4;
NRepl1=1000;
NRepl2=200000;

[call, put_bls]=blsprice(S0,X,r,T,sigma);
randn('seed',0);
[MC1000, PI1000] = BlsMC_put(S0,X,r,T,sigma,NRepl1);
randn('seed',0);
[MC200000, PI200000] = BlsMC_put(S0,X,r,T,sigma,NRepl2);

put_bls
MC1000
PI1000
MC200000
PI200000

function [Price, CI] = BlsMC_put(S0,X,r,T,sigma,NRepl)

nuT = (r - 0.5*sigma^2)*T;
siT = sigma * sqrt(T);

DiscPayoff = exp(-r*T) * max( 0 , X -


S0*exp(nuT+siT*randn(NRepl,1)) );
[Price, VarPrice, CI] = normfit(DiscPayoff);
end
HW2
 Other European options (我做 Vanilla European put)

% BlsMCAV.m

% CompBlsMCAV_Put.m Compare blsprice and BlsMc200000 and BlsMCAV100000

S0=50;
X=52;

r=0.1;

T=5/12;

sigma=0.4;

NRepl1=100000;

NRepl2=200000;

[call, put_bls]=blsprice(S0,X,r,T,sigma);

randn('seed',0);

[MC200000, PI1] = BlsMC_Put(S0,X,r,T,sigma,NRepl2);

randn('seed',0);

[MCAV100000, PI2] = BlsMCAV_Put(S0,X,r,T,sigma,NRepl1);

put_bls
MC200000

PI1

MCAV100000

PI2

function [Price, CI] = BlsMC_Put(S0,X,r,T,sigma,NRepl)

nuT = (r - 0.5*sigma^2)*T;

siT = sigma * sqrt(T);

DiscPayoff = exp(-r*T) * max( 0 , X - S0*exp(nuT+siT*randn(NRepl,1)) );

[Price, VarPrice, CI] = normfit(DiscPayoff);

end

function [Price, PI] = BlsMCAV_Put(S0,X,r,T,sigma,NRepl);

nuT = (r - 0.5*sigma^2)*T;

siT = sigma * sqrt(T);

Veps = randn(NRepl,1);

Payoff1 = max( 0 , X - S0*exp(nuT+siT*Veps) );

Payoff2 = max( 0 , X - S0*exp(nuT+siT*(-Veps)) );

DiscPayoff = exp(-r*T) * 0.5 * (Payoff1+Payoff2);

[Price, VarPrice, PI] = normfit(DiscPayoff);


end

You might also like