1 / 19

金融商品設計與評價 hw7

金融商品設計與評價 hw7. 計財系大三 林奕全. Outline. 1.TriEurPut vs.TriAmcPut 2.Oilbond 3. Index Currency Option Notes. TriEurPut. function [ price,lattice ] = TriEurPut ( s0,X,r,T,sigma,N,lamda ) deltaT =T/N; u=exp( lamda *sigma* sqrt ( deltaT )); d=1/u;

kuniko
Download Presentation

金融商品設計與評價 hw7

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

  2. Outline • 1.TriEurPut vs.TriAmcPut • 2.Oilbond • 3. Index Currency Option Notes

  3. TriEurPut • function [ price,lattice ] = TriEurPut( s0,X,r,T,sigma,N,lamda ) • deltaT=T/N; • u=exp(lamda*sigma*sqrt(deltaT)); • d=1/u; • pu=1/(2*lamda^2)+(r-(sigma^2/2))*sqrt(deltaT)/(2*lamda*sigma); • pm=1-1/(lamda^2); • pd=1-pu-pm; • lattice=zeros(N+1,2*N+1);

  4. for i=N-1:-1:0 • for j=1:2*i+1 • lattice(i+1,j)=exp(-r*deltaT)*(pd*lattice(i+2,j)+pm*lattice(i+2,j+1)+pu*lattice(i+2,j+2)); • end • end • price=lattice(1,1);

  5. TriAmcPut • function [ price,lattice ] = TriAmcPut( s0,X,r,T,sigma,N,lamda ) • deltaT=T/N; • u=exp(lamda*sigma*sqrt(deltaT)); • d=1/u; • pu=1/(2*lamda^2)+(r-(sigma^2/2))*sqrt(deltaT)/(2*lamda*sigma); • pm=1-1/(lamda^2); • pd=1-pu-pm; • lattice=zeros(N+1,2*N+1);

  6. for j=1:2*N+1 • lattice(N+1,j)=max(0,X-s0*(d^(N-j+1))); • end • for i=N-1:-1:0 • for j=1:2*i+1 • lattice(i+1,j)=max(X-s0*(d^(i-j+2)),exp(-r*deltaT)*(pd*lattice(i+2,j)+pm*lattice(i+2,j+1)+pu*lattice(i+2,j+2))); • end • end • price=lattice(1,1);

  7. ComTriAmc/Eur/Bls Put • s0=50; • X=50; • r=0.04879; • sigma=0.2; • T=7/12; • N=20; • lamda=1.41421; • LatticeC1=zeros(1,N); • LatticeC2=zeros(1,N); • BlsC=blsprice(s0,X,r,T,sigma);

  8. for i=(1:N) • [LatticeC1(i),tree1]=TriEurPut(s0,X,r,T,sigma,i,lamda); [LatticeC2(i),tree2]=TriAmcPut(s0,X,r,T,sigma,i,lamda); • end • plot(1:N,ones(1,N)*BlsC,'k'); • hold on; • plot(1:N,LatticeC2,'g'); • plot(1:N,LatticeC1,'b'); • xlabel('partition'); • ylabel('price'); • title('Compare BlsAmcEur option'); • legend('Bls','Amc','Eur');

  9. Oilbond • function [ price,lattice ] = Oilbond( initial,r,T,sigma,N ) • deltaT=T/N; • u=exp(sigma*sqrt(deltaT)); • d=1/u; • p=(exp(r*deltaT)-d)/(u-d); • lattice=zeros(N+1,N+1); • for j=0:N • lattice(N+1,j+1)=initial*(u^j)*(d^(N-j));

  10. if lattice(N+1,j+1)>=40 • lattice(N+1,j+1)=3550; • elseif lattice(N+1,j+1)<40&&lattice(N+1,j+1)>=25 • lattice(N+1,j+1)=(1000+(lattice(N+1,j+1)-25)*170); • else • lattice(N+1,j+1)=1000; • end • end

  11. for i=N-1:-1:0 • for j=0:i • lattice(i+1,j+1)=exp(-r*deltaT)*(p*lattice(i+2,j+2)+(1-p)*lattice(i+2,j+1)); • end • end • price=lattice(1,1);

  12. Compoilbond • Initial=20; • r=0.1; • T=1; • sigma=0.2; • N=80; • OilbondPic=zeros(1,N-45); • for(i=1:N-44) • OilbondPic(i)=Oilbond(i+19,r,T,sigma,N); • end • plot(20:55,OilbondPic);

  13. Currbond • function [ price,lattice ] = Currbond( initial,r,T,sigma,N ) • deltaT=T/N; • u=exp(sigma*sqrt(deltaT)); • d=1/u; • p=(exp(r*deltaT)-d)/(u-d); • lattice=zeros(N+1,N+1); • for j=0:N • lattice(N+1,j+1)=initial*(u^j)*(d^(N-j));

  14. if lattice(N+1,j+1)>=169 • lattice(N+1,j+1)=1000; • elseif lattice(N+1,j+1)<169&&lattice(N+1,j+1)>=84.5 • lattice(N+1,j+1)=1000-(((169/lattice(N+1,j+1)-1)*1000)); • else • lattice(N+1,j+1)=0; • end • end

  15. for i=N-1:-1:0 • for j=0:i • lattice(i+1,j+1)=exp(-r*deltaT)*(p*lattice(i+2,j+2)+(1-p)*lattice(i+2,j+1)); • end • End • price=lattice(1,1);

  16. CompCurrbond • r=0.1; • T=1; • sigma=0.2; • N=80; • CurrbondPic=zeros(1,N+150); • for(i=1:N+150) • CurrbondPic(i)=Currbond(i,r,T,sigma,N); • end • plot(1:230,CurrbondPic); • xlabel('initial'); • ylabel('price'); • title('Currbond price');

More Related