-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBA_2b_Plots_ImplVola.m
169 lines (127 loc) · 6.61 KB
/
BA_2b_Plots_ImplVola.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
%% % ################# 4) IMPLIED VOLATILITY PLOTS ########################
% ======================================================================================
% ============= (2D) ImplVola - Strike (for same Expiry, on a given day) ===============
% ======================================================================================
%% // on January 17,2008
smile1 = mydatc(strcmp(mydatc.Expiry,'2008-01-18') & strcmp(mydatc.Date,'2008-01-17'),[5 12]); % 1 day to Mat.
smile2 = mydatc(strcmp(mydatc.Expiry,'2008-02-15') & strcmp(mydatc.Date,'2008-01-17'),[5 12]); % 1 month
smile3 = mydatc(strcmp(mydatc.Expiry,'2008-03-20') & strcmp(mydatc.Date,'2008-01-17'),[5 12]); % 2 months
smile4 = mydatc(strcmp(mydatc.Expiry,'2008-06-20') & strcmp(mydatc.Date,'2008-01-17'),[5 12]); % 6 months
smile5 = mydatc(strcmp(mydatc.Expiry,'2008-09-19') & strcmp(mydatc.Date,'2008-01-17'),[5 12]); % 9 months
smile6 = mydatc(strcmp(mydatc.Expiry,'2008-12-19') & strcmp(mydatc.Date,'2008-01-17'),[5 12]); % 12 months
% 2008-01-21 : schwerste Rückgänge seit dem 11.Sep. 2001 an der Börse
daxVals.DAX(257) % Dax Stand am 17. Jan. 2008 (für ATM Vola)
subplot(3,2,1)
implvola_c1 = plot(smile1.Strike, smile1.ImplVola);
line([daxVals.DAX(257) daxVals.DAX(257)],[0 1],'LineStyle',':',... % lower bound ATM
'color','b');
title('Januar 2008')
subplot(3,2,2)
implvola_c2 = plot(smile2.Strike, smile2.ImplVola);
line([daxVals.DAX(257) daxVals.DAX(257)],[0 0.5],'LineStyle',':',... % lower bound ATM
'color','b');
title('Februar 2008')
subplot(3,2,3)
implvola_c3 = plot(smile3.Strike, smile3.ImplVola);
line([daxVals.DAX(257) daxVals.DAX(257)],[0 0.5],'LineStyle',':',... % lower bound ATM
'color','b');
title('März 2008')
subplot(3,2,4)
implvola_c4 = plot(smile4.Strike, smile4.ImplVola);
line([daxVals.DAX(257) daxVals.DAX(257)],[0 0.5],'LineStyle',':',... % lower bound ATM
'color','b');
title('Juni 2008')
subplot(3,2,5)
implvola_c5 = plot(smile5.Strike, smile5.ImplVola);
line([daxVals.DAX(257) daxVals.DAX(257)],[0 0.5],'LineStyle',':',... % lower bound ATM
'color','b');
title('September 2008')
subplot(3,2,6)
implvola_c6 = plot(smile6.Strike, smile6.ImplVola);
line([daxVals.DAX(257) daxVals.DAX(257)],[0 0.5],'LineStyle',':',... % lower bound ATM
'color','b');
title('Dezember 2008')
savefig('figures/ImplVola_01_17_2008.fig');
clearvars smile*
%% // on January 18,2010
smile1 = mydatc(strcmp(mydatc.Expiry,'2010-01-15') & strcmp(mydatc.Date,'2010-01-14'),[5 12]); % 1 day to Mat.
smile2 = mydatc(strcmp(mydatc.Expiry,'2010-02-19') & strcmp(mydatc.Date,'2010-01-14'),[5 12]); % 1 month
smile3 = mydatc(strcmp(mydatc.Expiry,'2010-03-19') & strcmp(mydatc.Date,'2010-01-14'),[5 12]); % 2 months
smile4 = mydatc(strcmp(mydatc.Expiry,'2010-07-16') & strcmp(mydatc.Date,'2010-01-14'),[5 12]); % 6 months
smile5 = mydatc(strcmp(mydatc.Expiry,'2010-09-17') & strcmp(mydatc.Date,'2010-01-14'),[5 12]); % 9 months
smile6 = mydatc(strcmp(mydatc.Expiry,'2010-12-17') & strcmp(mydatc.Date,'2010-01-14'),[5 12]); % 12 months
daxVals.DAX(897) % Dax Stand am 18.01.2010 (für ATM Vola)
subplot(3,2,1)
implvola_c1 = plot(smile1.Strike, smile1.ImplVola);
line([daxVals.DAX(897) daxVals.DAX(897)],[0 1],'LineStyle',':',... % lower bound ATM
'color','b');
title('Januar 2010')
subplot(3,2,2)
implvola_c2 = plot(smile2.Strike, smile2.ImplVola);
line([daxVals.DAX(897) daxVals.DAX(897)],[0 0.5],'LineStyle',':',... % lower bound ATM
'color','b');
title('Februar 2010')
subplot(3,2,3)
implvola_c3 = plot(smile3.Strike, smile3.ImplVola);
line([daxVals.DAX(897) daxVals.DAX(897)],[0 0.5],'LineStyle',':',... % lower bound ATM
'color','b');
title('März 2010')
subplot(3,2,4)
implvola_c4 = plot(smile4.Strike, smile4.ImplVola);
line([daxVals.DAX(897) daxVals.DAX(897)],[0 0.5],'LineStyle',':',... % lower bound ATM
'color','b');
title('Juli 2010')
subplot(3,2,5)
implvola_c5 = plot(smile5.Strike, smile5.ImplVola);
line([daxVals.DAX(897) daxVals.DAX(897)],[0 0.5],'LineStyle',':',... % lower bound ATM
'color','b');
title('September 2010')
subplot(3,2,6)
implvola_c6 = plot(smile6.Strike, smile6.ImplVola);
line([daxVals.DAX(897) daxVals.DAX(897)],[0 0.5],'LineStyle',':',... % lower bound ATM
'color','b');
title('Dezember 2010')
savefig('figures/ImplVola_01_17_2010.fig');
clearvars smile*
% ======================================================================================
% ============= (3D) ImplVola - Strike - Maturity ========================
% ======================================================================================
%% // on January 17,2008
volsrf = mydatc(strcmp(mydatc.Date,'2008-01-17'),[5 9 12 7]); % Maturity, ImplVola
figure('position',[100 100 1200 800])
srfce = VolSurf2(volsrf.Time_to_Maturity, volsrf.Strike, volsrf.ImplVola);
savefig('figures/Vola_surface2_01_17_2008.fig');
scatter3(volsrf.Time_to_Maturity, volsrf.Strike, volsrf.ImplVola);
%% // on January 15,2010
volsrf = mydatc(strcmp(mydatc.Date,'2010-01-15'),[5 9 12 7]); % Maturity, ImplVola
figure('position',[100 100 1200 800])
srfce = VolSurf2(volsrf.Time_to_Maturity, volsrf.Strike, volsrf.ImplVola);
savefig('figures/Vola_surface2_01_15_2010.fig');
%%
scatter3(volsrf.Strike, volsrf.Time_to_Maturity, volsrf.ImplVola,'filled');
title('Implied Volatility Surface');
xlabel('Strike Level');
ylabel('Time to Maturity');
zlabel('Implied Volatility');
set(gca);
% ======================================================================================
% ============= (3D) ImplVola - Maturity - Moneyness =====================
% ======================================================================================
%% // on January 17,2008
volsrf = mydatc(strcmp(mydatc.Date,'2008-01-17'),[9 12]); % Maturity, ImplVola
volsrf = [ volsrf callPrices(strcmp(callPrices.Date,'2008-01-17'),8) ];
figure('position',[100 100 1200 800])
srfce = VolSurf(volsrf.Time_to_Maturity, volsrf.mnyness, volsrf.ImplVola);
savefig('figures/Vola_surface_01_17_2008.fig');
%% // on January 15,2010
volsrf = mydatc(strcmp(mydatc.Date,'2010-01-15'),[9 12]); % Maturity, ImplVola
volsrf = [ volsrf callPrices(strcmp(callPrices.Date,'2010-01-15'),8) ];
figure('position',[100 100 1200 800])
srfce = VolSurf(volsrf.Time_to_Maturity, volsrf.mnyness, volsrf.ImplVola);
savefig('figures/Vola_surface_01_15_2010.fig');
%% // on December 2,2013 '2013-12-02'
volsrf = mydatc(strcmp(mydatc.Date,'2013-12-02'),[9 12]); % Maturity, ImplVola
volsrf = [ volsrf callPrices(strcmp(callPrices.Date,'2013-12-02'),8) ];
figure('position',[100 100 1200 800])
srfce = VolSurf(volsrf.Time_to_Maturity, volsrf.mnyness, volsrf.ImplVola);
savefig('figures/Vola_surface_12_02_2013.fig');