Homework 2 計財 張儷瀞
1. Black-Scholes Model (Code) S0=30:1:70; X=50; r=0.08; sigma=0.4; for T=2:-0.25:0 [c, p]=blsprice(S0, X, r, T, sigma) plot(S0, p); hold on; end axis([ ]); grid on
1. Black-Scholes Model (Demo)
2. Theta for a call option (Code) x=50; r=0.05; t=0.5; sigma=0.2; div=0; s=30:120; [call_theta]=blstheta(s, x, r, t, sigma, div); figure plot(s, call_theta,'-') title('Theta vs. s') xlabel('s') ylabel('Theta') legend('Theta')
2. Theta for a call option (Demo)
3. Gamma for a call option (Code) x=50; r=0.05; t=0.5; sigma=0.2; div=0; s=30:120; [call_gamma]=blsgamma(s, x, r, t, sigma, div); figure plot(s, call_gamma,'-') title('Gamma vs. s') xlabel('s') ylabel('Gamma') legend('Gamma')
3. Gamma for a call option (Demo)
4. Vega for a call option (Code) x=50; r=0.05; t=0.5; sigma=0.2; div=0; s=30:120; [call_vega]=blsvega(s, x, r, t, sigma, div); figure plot(s, call_vega,'-') title('Vega vs. s') xlabel('s') ylabel('Vega') legend('Vega')
4. Vega for a call option (Demo)
5. Delta for a call option (Code) x=50; r=0.05; t=0.1:0.2:50; sigma=0.2; div=0; s=30; for s=30:20:70 [call_delta]=blsdelta(s, x, r, t, sigma, div); plot(t, call_delta, '-') hold on; end title('Delta vs. Time to maturity') xlabel('Time to maturity') ylabel('Delta') legend('3 case in the change of s') text(10.1,0.55,'Out of money') text(10.1,0.83,'At of money') text(10.1,0.99,'In of money') axis([ ]); grid on
5. Delta for a call option (Demo)