1 / 14

HW 11

HW 11. 100071021. Close Form. function [ cdi, cdo , pdi , pdo ] = BOD_cf ( S0,K,r,q,T,sigma,Sb ) ssqT = sigma* sqrt (T); lamda = ( r-q+0.5*sigma^2 ) / sigma^2 ; y = ( log( Sb^2 / (S0*K) ) / ssqT ) + lamda*ssqT; x1 = ( log(S0/Sb) / ssqT ) + lamda * ssqT ;

Télécharger la présentation

HW 11

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. HW11 100071021

  2. Close Form function [ cdi, cdo, pdi, pdo ] = BOD_cf ( S0,K,r,q,T,sigma,Sb ) ssqT = sigma*sqrt(T); lamda = ( r-q+0.5*sigma^2 ) / sigma^2 ; y = ( log( Sb^2 / (S0*K) ) / ssqT ) + lamda*ssqT; x1 = ( log(S0/Sb) / ssqT ) + lamda*ssqT; y1 = ( log(Sb/S0) / ssqT ) + lamda*ssqT; [c , p] = blsprice(S0,K,r,T,sigma,q);

  3. if Sb <= K cdi = S0*exp(-q*T)*( (Sb/S0)^(2*lamda) )*normcdf(y) - K*exp(-r*T)*( (Sb/S0)^(2*lamda-2) )*normcdf(y-ssqT); cdo = c - cdi; pdi = -S0*exp(-q*T)*normcdf(-x1) + K*exp(-r*T)*normcdf(-x1+ssqT) + S0*exp(-q*T)*( (Sb/S0)^(2*lamda) )*( normcdf(y) - normcdf(y1) ) - K*exp(-r*T)*( (Sb/S0)^(2*lamda-2) )*( normcdf(y-ssqT) - normcdf(y1-ssqT) ); pdo = p - pdi; else cdo = S0*exp(-q*T)*normcdf(x1) - K*exp(-r*T)*normcdf(x1-ssqT) - S0*exp(-q*T)*( (Sb/S0)^(2*lamda) )*normcdf(y1) + K*exp(-r*T)*( (Sb/S0)^(2*lamda-2) )*normcdf(y1-ssqT); cdi = c - cdo; pdo = 0; pdi = p; end end

  4. Close Form adjust to discrete function [ cdi, cdo, pdi, pdo ] = BOD_cf_d ( S0,K,r,q,T,sigma,Sb,m ) Sb = Sb*exp(-0.5826*sigma*sqrt(T/m)); ……

  5. Monte Carlo function [ c , p ] = BO_MC ( S0,K,r,T,sigma,Sb,ud,io,NRepl,NStep,rmode ) % rmode : 0(default)=>randn 1=>Halton % ud : 0=>up 1=>down % io : 0=>in 1=>out fori = 1 : NRepl MCS = AssetPaths(S0,r,sigma,T,NStep,1,rmode); crossed_u = any(MCS >= Sb); crossed_d = any(MCS <= Sb); pc(i) = max( 0, MCS(NStep+1) - K ); pp(i) = max( 0, K - MCS(NStep+1) );

  6. if ( (ud==0 && io==0) && crossed_u==0 ) || ( (ud==0 && io==1) && crossed_u==1 ) || ( (ud==1 && io==0) && crossed_d==0 ) || ( (ud==1 && io==1) && crossed_d==1 ) pc(i) = 0; pp(i) = 0; end end [c var ci] = normfit( exp(-r*T)*pc ); [p var ci] = normfit( exp(-r*T)*pp ); end

  7. Demo S0 = 50; K = 50; r = 0.1; T = 2/12; sigma = 0.4; Sb = 40; NRepl = 50000; NStep = 60; [ cdi, cdo, pdi, pdo ] = BOD_cf ( S0,K,r,0,T,sigma,Sb ) CF = ones(1,1000) * pdi; rand('seed',0); randn('seed',0);

  8. figure; for i = 1:600 [a, b, c, d] = BOD_cf_d ( S0,K,r,0,T,sigma,Sb,i ); Descrete(i) = c; end plot(1:600,Descrete,1:600,CF(1:600))

  9. Up and In Call 1~10000 1~600

  10. figure; MC_R = zeros(1,100); for i = 1:100 [a ,MC_R(i)] = BO_MC ( S0,K,r,T,sigma,Sb,1,0,i*100,NStep,0 ); x = i end plot(1:100,MC_R,1:100,CF(1:100)); title('MC with randn');

  11. figure; for i = 1:600 [a, b, c, d] = BOD_cf_d ( S0,K,r,0,T,sigma,Sb,i ); Descrete(i) = c; end plot(1:600,Descrete,1:600,CF(1:600))

More Related