Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
SwaptionVolatilityEUR Struct Reference

#include <test/swaptionmarketdata.hpp>

+ Collaboration diagram for SwaptionVolatilityEUR:

Public Member Functions

 SwaptionVolatilityEUR ()
 

Public Attributes

vector< Period > optionTenors
 
vector< Period > swapTenors
 
vector< Real > strikeSpreads
 
Matrix nVols
 
Matrix lnVols
 
Matrix slnVols_1
 
Matrix slnVols_2
 
Matrix shifts_1
 
Matrix shifts_2
 
vector< vector< Handle< Quote > > > nVolSpreads
 
vector< vector< Handle< Quote > > > lnVolSpreads
 
vector< vector< Handle< Quote > > > slnVolSpreads
 

Detailed Description

Definition at line 42 of file swaptionmarketdata.hpp.

Constructor & Destructor Documentation

◆ SwaptionVolatilityEUR()

Definition at line 44 of file swaptionmarketdata.hpp.

45 : optionTenors(4), swapTenors(4), strikeSpreads(5), nVols(optionTenors.size(), swapTenors.size(), 0.0),
47 nVolSpreads(16, vector<Handle<Quote> >(5, Handle<Quote>())),
48 lnVolSpreads(16, vector<Handle<Quote> >(5, Handle<Quote>())),
49 slnVolSpreads(16, vector<Handle<Quote> >(5, Handle<Quote>())) {
50
51 // Populate option tenors
52 optionTenors[0] = Period(1, Years);
53 optionTenors[1] = Period(5, Years);
54 optionTenors[2] = Period(7, Years);
55 optionTenors[3] = Period(10, Years);
56
57 // Populate swap tenors
58 swapTenors[0] = Period(1, Years);
59 swapTenors[1] = Period(5, Years);
60 swapTenors[2] = Period(10, Years);
61 swapTenors[3] = Period(20, Years);
62
63 // Populate the normal volatility matrix
64 nVols[0][0] = 0.003543;
65 nVols[0][1] = 0.005270;
66 nVols[0][2] = 0.006978;
67 nVols[0][3] = 0.007918;
68 nVols[1][0] = 0.007013;
69 nVols[1][1] = 0.007443;
70 nVols[1][2] = 0.007820;
71 nVols[1][3] = 0.007363;
72 nVols[2][0] = 0.007519;
73 nVols[2][1] = 0.007807;
74 nVols[2][2] = 0.007698;
75 nVols[2][3] = 0.007117;
76 nVols[3][0] = 0.007668;
77 nVols[3][1] = 0.007705;
78 nVols[3][2] = 0.007611;
79 nVols[3][3] = 0.006848;
80
81 // Populate the lognormal volatility matrix
82 lnVols[0][0] = 2.187660;
83 lnVols[0][1] = 1.748360;
84 lnVols[0][2] = 0.834972;
85 lnVols[0][3] = 0.663957;
86 lnVols[1][0] = 0.891725;
87 lnVols[1][1] = 0.642449;
88 lnVols[1][2] = 0.585798;
89 lnVols[1][3] = 0.512169;
90 lnVols[2][0] = 0.549946;
91 lnVols[2][1] = 0.552918;
92 lnVols[2][2] = 0.528572;
93 lnVols[2][3] = 0.476202;
94 lnVols[3][0] = 0.531597;
95 lnVols[3][1] = 0.534495;
96 lnVols[3][2] = 0.526216;
97 lnVols[3][3] = 0.462007;
98
99 // Populate the first and second set of shifted lognormal volatilities
100 slnVols_1[0][0] = 0.929848;
101 slnVols_1[0][1] = 0.924660;
102 slnVols_1[0][2] = 0.610868;
103 slnVols_1[0][3] = 0.495445;
104 slnVols_1[1][0] = 0.689737;
105 slnVols_1[1][1] = 0.521342;
106 slnVols_1[1][2] = 0.472902;
107 slnVols_1[1][3] = 0.396814;
108 slnVols_1[2][0] = 0.474667;
109 slnVols_1[2][1] = 0.463982;
110 slnVols_1[2][2] = 0.432899;
111 slnVols_1[2][3] = 0.371330;
112 slnVols_1[3][0] = 0.460333;
113 slnVols_1[3][1] = 0.447973;
114 slnVols_1[3][2] = 0.428017;
115 slnVols_1[3][3] = 0.358081;
116
117 slnVols_2[0][0] = 0.732040;
118 slnVols_2[0][1] = 0.754222;
119 slnVols_2[0][2] = 0.539085;
120 slnVols_2[0][3] = 0.439887;
121 slnVols_2[1][0] = 0.622370;
122 slnVols_2[1][1] = 0.477238;
123 slnVols_2[1][2] = 0.431955;
124 slnVols_2[1][3] = 0.357137;
125 slnVols_2[2][0] = 0.444718;
126 slnVols_2[2][1] = 0.430028;
127 slnVols_2[2][2] = 0.397564;
128 slnVols_2[2][3] = 0.335037;
129 slnVols_2[3][0] = 0.432003;
130 slnVols_2[3][1] = 0.415209;
131 slnVols_2[3][2] = 0.392379;
132 slnVols_2[3][3] = 0.322612;
133
134 // Populate first and second set of shifts
135 shifts_1[0][0] = 0.002000;
136 shifts_1[0][1] = 0.002500;
137 shifts_1[0][2] = 0.003000;
138 shifts_1[0][3] = 0.004000;
139 shifts_1[1][0] = 0.002000;
140 shifts_1[1][1] = 0.002500;
141 shifts_1[1][2] = 0.003000;
142 shifts_1[1][3] = 0.004000;
143 shifts_1[2][0] = 0.002000;
144 shifts_1[2][1] = 0.002500;
145 shifts_1[2][2] = 0.003000;
146 shifts_1[2][3] = 0.004000;
147 shifts_1[3][0] = 0.002000;
148 shifts_1[3][1] = 0.002500;
149 shifts_1[3][2] = 0.003000;
150 shifts_1[3][3] = 0.004000;
151
152 shifts_2[0][0] = 0.003000;
153 shifts_2[0][1] = 0.003750;
154 shifts_2[0][2] = 0.004500;
155 shifts_2[0][3] = 0.006000;
156 shifts_2[1][0] = 0.003000;
157 shifts_2[1][1] = 0.003750;
158 shifts_2[1][2] = 0.004500;
159 shifts_2[1][3] = 0.006000;
160 shifts_2[2][0] = 0.003000;
161 shifts_2[2][1] = 0.003750;
162 shifts_2[2][2] = 0.004500;
163 shifts_2[2][3] = 0.006000;
164 shifts_2[3][0] = 0.003000;
165 shifts_2[3][1] = 0.003750;
166 shifts_2[3][2] = 0.004500;
167 shifts_2[3][3] = 0.006000;
168
169 strikeSpreads[0] = -0.02;
170 strikeSpreads[1] = -0.01;
171 strikeSpreads[2] = 0.00;
172 strikeSpreads[3] = +0.01;
173 strikeSpreads[4] = +0.02;
174 Size atmStrikeIndex = 2;
175
176 // random smile
177 MersenneTwisterUniformRng rng(42);
178 Real nVolSpreadMin = 0.0010;
179 Real nVolSpreadMax = 0.0050;
180 Real lnVolSpreadMin = 0.1;
181 Real lnVolSpreadMax = 0.3;
182 Real slnVolSpreadMin = 0.05;
183 Real slnVolSpreadMax = 0.25;
184 for (Size i = 0; i < optionTenors.size(); ++i) {
185 for (Size j = 0; j < swapTenors.size(); ++j) {
186 for (Size k = 0; k < strikeSpreads.size(); ++k) {
187 Size index = j * optionTenors.size() + i;
188 Real nVolSpread =
189 k == atmStrikeIndex ? 0.0 : nVolSpreadMin + rng.nextReal() * (nVolSpreadMax - nVolSpreadMin);
190 nVolSpreads[index][k] = Handle<Quote>(QuantLib::ext::shared_ptr<SimpleQuote>(new SimpleQuote(nVolSpread)));
191 Real lnVolSpread =
192 k == atmStrikeIndex ? 0.0 : lnVolSpreadMin + rng.nextReal() * (lnVolSpreadMax - lnVolSpreadMin);
193 lnVolSpreads[index][k] =
194 Handle<Quote>(QuantLib::ext::shared_ptr<SimpleQuote>(new SimpleQuote(lnVolSpread)));
195 Real slnVolSpread = k == atmStrikeIndex
196 ? 0.0
197 : slnVolSpreadMin + rng.nextReal() * (slnVolSpreadMax - slnVolSpreadMin);
198 slnVolSpreads[index][k] =
199 Handle<Quote>(QuantLib::ext::shared_ptr<SimpleQuote>(new SimpleQuote(slnVolSpread)));
200 }
201 }
202 }
203 }
vector< vector< Handle< Quote > > > slnVolSpreads
vector< vector< Handle< Quote > > > lnVolSpreads
vector< vector< Handle< Quote > > > nVolSpreads

Member Data Documentation

◆ optionTenors

vector<Period> optionTenors

Definition at line 206 of file swaptionmarketdata.hpp.

◆ swapTenors

vector<Period> swapTenors

Definition at line 207 of file swaptionmarketdata.hpp.

◆ strikeSpreads

vector<Real> strikeSpreads

Definition at line 208 of file swaptionmarketdata.hpp.

◆ nVols

Matrix nVols

Definition at line 209 of file swaptionmarketdata.hpp.

◆ lnVols

Matrix lnVols

Definition at line 210 of file swaptionmarketdata.hpp.

◆ slnVols_1

Matrix slnVols_1

Definition at line 211 of file swaptionmarketdata.hpp.

◆ slnVols_2

Matrix slnVols_2

Definition at line 212 of file swaptionmarketdata.hpp.

◆ shifts_1

Matrix shifts_1

Definition at line 213 of file swaptionmarketdata.hpp.

◆ shifts_2

Matrix shifts_2

Definition at line 214 of file swaptionmarketdata.hpp.

◆ nVolSpreads

vector<vector<Handle<Quote> > > nVolSpreads

Definition at line 216 of file swaptionmarketdata.hpp.

◆ lnVolSpreads

vector<vector<Handle<Quote> > > lnVolSpreads

Definition at line 216 of file swaptionmarketdata.hpp.

◆ slnVolSpreads

vector<vector<Handle<Quote> > > slnVolSpreads

Definition at line 216 of file swaptionmarketdata.hpp.