Download as pdf or txt
Download as pdf or txt
You are on page 1of 13

HW2

101071035

BLS_put

%PlotBLS_put.m
S0=20:1:80;
X=50;
r=0.08;
sigma=0.4;
for T=3:-0.25:0
[c,p]=blsprice(S0,X,r,T,sigma);
plot(S0,p);
hold on;
end
xlabel('S0');
ylabel('P');
title('PlotBLS-Put');
axis([20 80 -5 35]);
grid on

Delta v.s. S

S=30:120;
X=50;
r=0.05;
T=0.5;
sigma=0.2;
div=0;
[call_delta,put_delta]=blsdelta(S,X,r,T,sigm
a,div);
figure;
plot(S,call_delta,'-');
title('Delta vs. S');
xlabel('S');
ylabel('Delta');
hold on;
plot(S,put_delta,'-r');
legend('Delta of call','Delta of put');


Theta v.s. S
S=30:120;
X=50;
r=0.05;
T=0.5;
sigma=0.2;
div=0;
[call_theta,put_theta]=blstheta(S,X,r,T,sig
ma,div);
figure;
plot(S,call_theta,'-');
title('Theta vs. S');
xlabel('S');
ylabel('Theta');
hold on;
plot(S,put_theta,'-r');
legend('Theta of call ','Theta of put');

Gamma v.s. S

S=30:120;
X=50;
r=0.05;
T=0.5;
sigma=0.2;
div=0;
callput_gamma=blsgamma(S,X,r,T,sigma,di
v);
%Gamma = blsgamma(Price, Strike, Rate,
Time, Volatility, Yield)
figure;
plot(S,callput_gamma,'-');
title('Gamma vs. S');
xlabel('S');
ylabel('Gamma');
legend('Gamma of call&put');

Vega v.s. S

S=30:120;
X=50;
r=0.05;
T=0.5;
sigma=0.2;
div=0;
callput_vega=blsvega(S,X,r,T,sigma,div);
figure;
plot(S,callput_vega,'-');
title('Vega vs. S');
xlabel('S');
ylabel('Vega');
legend('Vega of call&put');

Delta v.s. T

T=10:-0.25:0.01;
X=50;
r=0.05;
sigma=0.2;
div=0;
S=70
[call_delta,put_delta]=blsdelta(S,X,r,T,sigma,div);
plot(T,call_delta,'r');
hold on;
S=50
[call_delta,put_delta]=blsdelta(S,X,r,T,sigma,div);
plot(T,call_delta,'b');
hold on;
S=30
[call_delta,put_delta]=blsdelta(S,X,r,T,sigma,div);
plot(T,call_delta,'g');
hold off;
title('Delta vs. T');
xlabel('Time to expiration');
ylabel('Delta');
hold on;
legend('In the money','At the money','Out of the money');

You might also like