Presentation is loading. Please wait.

Presentation is loading. Please wait.

金融商品設計與評價 hw11 計財系大三 林奕全. Outline  1. Down-and-in put  2.closed-form for other barrier option ( 以 Up-and-in/out call 為例 ) - 解析解 -MC (Up-and-in/out call)

Similar presentations


Presentation on theme: "金融商品設計與評價 hw11 計財系大三 林奕全. Outline  1. Down-and-in put  2.closed-form for other barrier option ( 以 Up-and-in/out call 為例 ) - 解析解 -MC (Up-and-in/out call)"— Presentation transcript:

1 金融商品設計與評價 hw11 計財系大三 林奕全

2 Outline  1. Down-and-in put  2.closed-form for other barrier option ( 以 Up-and-in/out call 為例 ) - 解析解 -MC (Up-and-in/out call) -MC(BlsEurCall)

3 AssetPaths1  function SPaths = AssetPaths1( s0,r,sigma,T,NSteps,NRepl )  SPaths=zeros(NRepl,1+NSteps);  SPaths(:,1)=s0;  dt=T/NSteps;  nudt=(r-0.5*sigma^2)*dt;  sidt=sigma*sqrt(dt);  for i=1:NRepl  for j=1:NSteps  SPaths(i,j+1)= SPaths(i,j)*exp(nudt+sidt*randn);  end

4 DOPutMC(Down-and-in put)  function [P,CI,NCrossed ] =DOPutMC( s0,X,r,T,sigma,sb,NSteps,NRepl)  Payoff=zeros(NRepl,1);  NCrossed=0;  for i=1:NRepl  Path=AssetPaths1(s0,r,sigma,T,NSteps,1);  crossed=any(Path<=sb);

5  if crossed==0  Payoff(i)=0;  NCrossed=NCrossed+1;  else  Payoff(i)=max(0,X-Path(NSteps+1));  end  [P,aux,CI]=normfit(exp(-r*T)*Payoff)

6  s0=50;  X=50;  r=0.1;  T=2/12;  sigma=0.4;  sb=40;  NSteps=60;  NRepl=50000;  randn('seed',0);  [D0PutMC,CI,NCrossed]=DOPutMC(s0,X,r,T,sigma,sb,NSteps,NRe pl);  D0PutMC  CI  NCrossed

7 BlsMcEurPut  function[Price,CI]=BlsMcEurPut(s0,X,r,T,sigma,NRepl)  nuT=(r-0.5*sigma^2)*T;  siT=sigma*sqrt(T);  DiscPayoff=exp(-r*T)*max(X- s0*exp(nuT+siT*randn(NRepl,1)),0);  [Price,Varprice,CI]=normfit(DiscPayoff);

8  s0=50;  X=50;  r=0.1;  T=2/12;  sigma=0.4;  NRepl1=50000;  randn('seed',0);  [MC50000,CI50000]=BlsMcEurPut(s0,X,r,T,sigma,NRepl)

9 PriceCINCrossed Down-and-out Put (MC) [1.3303,1.3808]7392 Down-and-in Put (MC) [1.4574,1.5251]42608 Total MCEurput2.8296[2.7941,2.8652] blsprice2.8304

10 UICall formula

11 UICall  function [UICallprice, UOCallprice]=UICall (s0,X,r,T,sigma,sb )  lamda=(r/(sigma^2))+1/2;  y1=(log(sb/s0)+lamda*(sigma^2)*T)/(sigma*sqrt(T));  x1=(log(s0/sb)+lamda*(sigma^2)*T)/(sigma*sqrt(T));  y=(log(sb^2/(s0*X))+lamda*(sigma^2)*T)/(sigma*sqrt(T));

12  UICallprice=max(0,s0*normcdf(x1)-X*exp(- r*T)*normcdf(x1-sigma*sqrt(T))- s0*((sb/s0)^(2*lamda))*(normcdf(-y)-normcdf(- y1))+X*exp(-r*T)*((sb/s0)^(2*lamda-2))*(normcdf(- y+sigma*sqrt(T))-normcdf(-y1+sigma*sqrt(T))));  UOCallprice=blsprice(s0,X,r,T,sigma)-UICallprice;  end

13  s0=50;  X=50;  r=0.1;  T=2/12;  sigma=0.4;  sb=70;  NStep=60;  NRepl=50000;  sb1=sb*exp(0.5826*0.4*sqrt(1/12/30));  [UICallprice, UOCallprice]=UICall (s0,X,r,T,sigma,sb1 )

14  UICallprice =   UOCallprice = 

15 UICallMC  function [P,CI,NCrossed ] =UICallMC( s0,X,r,T,sigma,sb,NSteps,NRepl)  Payoff=zeros(NRepl,1);  NCrossed=0;  for i=1:NRepl  Path=AssetPaths1(s0,r,sigma,T,NSteps,1);  crossed=any(Path>=sb);  if crossed==0  Payoff(i)=0;  NCrossed=NCrossed+1;  else  Payoff(i)=max(0,Path(NSteps+1)-X);  end  [P,aux,CI]=normfit(exp(-r*T)*Payoff)

16  s0=50;  X=50;  r=0.1;  T=2/12;  sigma=0.4;  sb=70;  NRepl=50000;  NSteps=60;  randn('seed',0);  [P,CI,NCrossed ] =UICallMC( s0,X,r,T,sigma,sb,NSteps,NRepl)

17 UOCallMC  function [P,CI,NCrossed ] =UOCallMC( s0,X,r,T,sigma,sb,NSteps,NRepl)  Payoff=zeros(NRepl,1);  NCrossed=0;  for i=1:NRepl  Path=AssetPaths1(s0,r,sigma,T,NSteps,1);  crossed=any(Path>=sb);  if crossed==0  Payoff(i)=max(0,Path(NSteps+1)-X);  else  Payoff(i)=0;  NCrossed=NCrossed+1;  end  [P,aux,CI]=normfit(exp(-r*T)*Payoff)

18  s0=50;  X=50;  r=0.1;  T=2/12;  sigma=0.4;  sb=70;  NRepl=50000;  NSteps=60;  randn('seed',0);  [P,CI,NCrossed ] =UOCallMC( s0,X,r,T,sigma,sb,NSteps,NRepl)

19 BlsMcEurCall(  function[Price,CI]=BlsMcEurCall(s0,X,r,T,sigma,NRepl)  nuT=(r-0.5*sigma^2)*T;  siT=sigma*sqrt(T);  DiscPayoff=exp(- r*T)*max(s0*exp(nuT+siT*randn(NRepl,1))-X,0);  [Price,Varprice,CI]=normfit(DiscPayoff);

20 PriceCINCrossed Up-and-in Call (MC) [ ]48318 Closed form Up-and-out Call (MC) [2.8976,2.9742]1694 Closed form Total MCEurCall3.6781[3.6295,3.7267] blsprice3.6568


Download ppt "金融商品設計與評價 hw11 計財系大三 林奕全. Outline  1. Down-and-in put  2.closed-form for other barrier option ( 以 Up-and-in/out call 為例 ) - 解析解 -MC (Up-and-in/out call)"

Similar presentations


Ads by Google