You are on page 1of 9

金融商品設計與評價

HW2
計財系碩一 108071603 黃偉德
1. Plotlongcall

2. Buy/sell+call/put
X=50;
c=2;
St=40:0.05:60;
% buy call
subplot(2,2,1);
plot (St,max(St-X,0)-c);
title('long call');
xlabel('S');
ylabel('profit');
axis([40 60 -10 10 ])
% buy put
subplot(2,2,2);
plot (St,max(X-St,0)-c);
title('long put');
xlabel('S');
ylabel('profit');
axis([40 60 -10 10 ])
% sell call
subplot(2,2,3);
plot (St,-(max(St-X,0)-c));
title('sell call');
xlabel('S');
ylabel('profit');
axis([40 60 -10 10 ])
% sell put
subplot(2,2,4);
plot (St,-(max(X-St,0)-c));
title('sell put');
xlabel('S');
ylabel('profit');
axis([40 60 -10 10 ])
3. PlotlongcallBS
X=50;
c=2;
r=0.01;
T=0.5;
sigma=0.2;
St=40:0.05:60;
[m,n]=size(St);
for i=1:n;
[call(i),put(i)]=BS(St(i),X,r,T,sigma);
end
plot (St,max(St-X,0),'--black');
hold on;
plot (St,call,'*blue');
title('long call');
xlabel('S');
ylabel('profit');
axis([40 60 0 10 ])
4. PlotlongputBS
X=50;
c=2;
r=0.01;
T=0.5;
sigma=0.2;
St=40:0.05:60;
[m,n]=size(St);
for i=1:n;
[call(i),put(i)]=BS(St(i),X,r,T,sigma);
end
plot (St,max(X-St,0),'--black');
hold on;
plot (St,put,'*blue');
title('long put');
xlabel('S');
ylabel('profit');
axis([40 60 0 10 ])
5. Plot the variation of theta with stock price for a call option
x=50;
r=0.05;
t=0.5;
sig=0.2;
div=0;
s=30:120;

[call_theta,put_theta]=blstheta(s,x,r,t,sig,div);
figure
plot(s,call_theta,'-')
title('theta vs. s')
xlabel('s')
ylabel('theta')
legend('theta')
6. Plot the variation of gamma with stock price for a call option
x=50;
r=0.05;
t=0.5;
sig=0.2;
div=0;
s=30:120;

call_gamma=blsgamma(s,x,r,t,sig);
figure
plot(s,call_gamma,'-')
title('gamma vs. s')
xlabel('s')
ylabel('gamma')
legend('gamma')
7. Plot the variation of vega with stock price for a call option
x=50;
r=0.05;
t=0.5;
sig=0.2;
div=0;
s=30:120;

call_vega=blsvega(s,x,r,t,sig);
figure
plot(s,call_vega,'-')
title('vega vs. s')
xlabel('s')
ylabel('vega')
legend('vega')
8. Plot the patterns for variation of delta with time to maturity for a call
option
S0 = 30:1:70;
X = 50;
r = 0.08;
sigma = 0.4;
for T=2:-0.25:0
plot(S0,blsdelta(S0,X,r,T,sigma));
hold on;
end
axis([30 70 -5 35]);
grid on

You might also like