Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
capfloormarketdata.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2016 Quaternion Risk Management Ltd
3 All rights reserved.
4
5 This file is part of ORE, a free-software/open-source library
6 for transparent pricing and risk analysis - http://opensourcerisk.org
7
8 ORE is free software: you can redistribute it and/or modify it
9 under the terms of the Modified BSD License. You should have received a
10 copy of the license along with this program.
11 The license is also available online at <http://opensourcerisk.org>
12
13 This program is distributed on the basis that it will form a useful
14 contribution to risk analytics and model standardisation, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
17*/
18
19/*! \file test/capfloormarketdata.hpp
20 \brief structs containing capfloor market data that can be used in tests
21*/
22
23#ifndef quantext_test_capfloormarketdata_hpp
24#define quantext_test_capfloormarketdata_hpp
25
26#include <boost/make_shared.hpp>
27#include <ql/indexes/ibor/euribor.hpp>
28#include <ql/math/matrix.hpp>
29#include <ql/time/calendars/target.hpp>
30#include <ql/time/daycounters/thirty360.hpp>
31#include <ql/time/period.hpp>
32
33#include <vector>
34
35using namespace QuantLib;
36using std::vector;
37
38namespace QuantExt {
40 // Constructor
42 : tenors(5), strikes(6), nVols(tenors.size(), strikes.size(), 0.0), slnVols_1(nVols), slnVols_2(nVols),
43 shift_1(0.01), shift_2(0.015), atmTenors(6), nAtmVols(6), slnAtmVols_1(6), slnAtmVols_2(6) {
44
45 // Populate capfloor tenors
46 tenors[0] = Period(1, Years);
47 tenors[1] = Period(5, Years);
48 tenors[2] = Period(7, Years);
49 tenors[3] = Period(10, Years);
50 tenors[4] = Period(20, Years);
51
52 // Populate capfloor strikes
53 strikes[0] = -0.005;
54 strikes[1] = 0.0;
55 strikes[2] = 0.005;
56 strikes[3] = 0.01;
57 strikes[4] = 0.02;
58 strikes[5] = 0.03;
59
60 // Populate the capfloor normal volatility matrix
61 nVols[0][0] = 0.002457;
62 nVols[0][1] = 0.002667;
63 nVols[0][2] = 0.003953;
64 nVols[0][3] = 0.005144;
65 nVols[0][4] = 0.007629;
66 nVols[0][5] = 0.009938;
67 nVols[1][0] = 0.004757;
68 nVols[1][1] = 0.004573;
69 nVols[1][2] = 0.005362;
70 nVols[1][3] = 0.006090;
71 nVols[1][4] = 0.007442;
72 nVols[1][5] = 0.008805;
73 nVols[2][0] = 0.005462;
74 nVols[2][1] = 0.005337;
75 nVols[2][2] = 0.005826;
76 nVols[2][3] = 0.006369;
77 nVols[2][4] = 0.007391;
78 nVols[2][5] = 0.008431;
79 nVols[3][0] = 0.005970;
80 nVols[3][1] = 0.005910;
81 nVols[3][2] = 0.006144;
82 nVols[3][3] = 0.006395;
83 nVols[3][4] = 0.007082;
84 nVols[3][5] = 0.007767;
85 nVols[4][0] = 0.005873;
86 nVols[4][1] = 0.005988;
87 nVols[4][2] = 0.006102;
88 nVols[4][3] = 0.006220;
89 nVols[4][4] = 0.006609;
90 nVols[4][5] = 0.006973;
91
92 // Populate the shifted lognormal volatility matrix, shift = 1%
93 slnVols_1[0][0] = 0.354048;
94 slnVols_1[0][1] = 0.275908;
95 slnVols_1[0][2] = 0.331131;
96 slnVols_1[0][3] = 0.367941;
97 slnVols_1[0][4] = 0.431984;
98 slnVols_1[0][5] = 0.473055;
99 slnVols_1[1][0] = 0.629394;
100 slnVols_1[1][1] = 0.429765;
101 slnVols_1[1][2] = 0.408771;
102 slnVols_1[1][3] = 0.397830;
103 slnVols_1[1][4] = 0.387533;
104 slnVols_1[1][5] = 0.387566;
105 slnVols_1[2][0] = 0.660362;
106 slnVols_1[2][1] = 0.459424;
107 slnVols_1[2][2] = 0.402383;
108 slnVols_1[2][3] = 0.371339;
109 slnVols_1[2][4] = 0.334462;
110 slnVols_1[2][5] = 0.317835;
111 slnVols_1[3][0] = 0.646952;
112 slnVols_1[3][1] = 0.457781;
113 slnVols_1[3][2] = 0.381007;
114 slnVols_1[3][3] = 0.332858;
115 slnVols_1[3][4] = 0.285027;
116 slnVols_1[3][5] = 0.261010;
117 slnVols_1[4][0] = 0.581476;
118 slnVols_1[4][1] = 0.420004;
119 slnVols_1[4][2] = 0.344897;
120 slnVols_1[4][3] = 0.298501;
121 slnVols_1[4][4] = 0.250767;
122 slnVols_1[4][5] = 0.223903;
123
124 // Populate the shifted lognormal volatility matrix, shift = 1.5%
125 slnVols_2[0][0] = 0.204022;
126 slnVols_2[0][1] = 0.181767;
127 slnVols_2[0][2] = 0.232378;
128 slnVols_2[0][3] = 0.268359;
129 slnVols_2[0][4] = 0.329940;
130 slnVols_2[0][5] = 0.371421;
131 slnVols_2[1][0] = 0.368526;
132 slnVols_2[1][1] = 0.290783;
133 slnVols_2[1][2] = 0.294452;
134 slnVols_2[1][3] = 0.297475;
135 slnVols_2[1][4] = 0.302807;
136 slnVols_2[1][5] = 0.310822;
137 slnVols_2[2][0] = 0.395097;
138 slnVols_2[2][1] = 0.317747;
139 slnVols_2[2][2] = 0.297146;
140 slnVols_2[2][3] = 0.285691;
141 slnVols_2[2][4] = 0.270621;
142 slnVols_2[2][5] = 0.264740;
143 slnVols_2[3][0] = 0.396368;
144 slnVols_2[3][1] = 0.324204;
145 slnVols_2[3][2] = 0.288276;
146 slnVols_2[3][3] = 0.262625;
147 slnVols_2[3][4] = 0.236265;
148 slnVols_2[3][5] = 0.222242;
149 slnVols_2[4][0] = 0.357254;
150 slnVols_2[4][1] = 0.301862;
151 slnVols_2[4][2] = 0.265140;
152 slnVols_2[4][3] = 0.238823;
153 slnVols_2[4][4] = 0.209753;
154 slnVols_2[4][5] = 0.191882;
155
156 // ATM volatility curves (Normal, Shifted Lognormal (1%), Shifted Lognormal (1.5%))
157 atmTenors[0] = Period(1, Years);
158 nAtmVols[0] = 0.002610;
159 slnAtmVols_1[0] = 0.279001;
160 slnAtmVols_2[0] = 0.181754;
161 atmTenors[1] = Period(2, Years);
162 nAtmVols[1] = 0.002972;
163 slnAtmVols_1[1] = 0.265115;
164 slnAtmVols_2[1] = 0.183202;
165 atmTenors[2] = Period(5, Years);
166 nAtmVols[2] = 0.005200;
167 slnAtmVols_1[2] = 0.453827;
168 slnAtmVols_2[2] = 0.314258;
169 atmTenors[3] = Period(7, Years);
170 nAtmVols[3] = 0.005800;
171 slnAtmVols_1[3] = 0.418210;
172 slnAtmVols_2[3] = 0.305215;
173 atmTenors[4] = Period(10, Years);
174 nAtmVols[4] = 0.006300;
175 slnAtmVols_1[4] = 0.359696;
176 slnAtmVols_2[4] = 0.277812;
177 atmTenors[5] = Period(20, Years);
178 nAtmVols[5] = 0.006400;
179 slnAtmVols_1[5] = 0.295877;
180 slnAtmVols_2[5] = 0.238554;
181 }
182
183 // Members
184 vector<Period> tenors;
185 vector<Rate> strikes;
186 Matrix nVols;
187 Matrix slnVols_1;
188 Matrix slnVols_2;
191 vector<Period> atmTenors;
192 vector<Volatility> nAtmVols;
193 vector<Volatility> slnAtmVols_1;
194 vector<Volatility> slnAtmVols_2;
195};
196} // namespace QuantExt
197
198#endif