49
50 QuantLib::ext::shared_ptr<Conventions> conventions = QuantLib::ext::make_shared<Conventions>();
51
52
53 QuantLib::ext::shared_ptr<ore::data::Convention> swapIndexEURConv(
55 QuantLib::ext::shared_ptr<ore::data::Convention> swapIndexEURLongConv(
57 QuantLib::ext::shared_ptr<ore::data::Convention> swapIndexUSDConv(
59 QuantLib::ext::shared_ptr<ore::data::Convention> swapIndexUSDLongConv(
61 QuantLib::ext::shared_ptr<ore::data::Convention> swapIndexGBPConv(
63 QuantLib::ext::shared_ptr<ore::data::Convention> swapIndexGBPLongConv(
65 QuantLib::ext::shared_ptr<ore::data::Convention> swapIndexCHFConv(
67 QuantLib::ext::shared_ptr<ore::data::Convention> swapIndexCHFLongConv(
69 QuantLib::ext::shared_ptr<ore::data::Convention> swapIndexJPYConv(
71 QuantLib::ext::shared_ptr<ore::data::Convention> swapIndexJPYLongConv(
73
74 conventions->add(swapIndexEURConv);
75 conventions->add(swapIndexEURLongConv);
76 conventions->add(swapIndexUSDConv);
77 conventions->add(swapIndexUSDLongConv);
78 conventions->add(swapIndexGBPConv);
79 conventions->add(swapIndexGBPLongConv);
80 conventions->add(swapIndexCHFConv);
81 conventions->add(swapIndexCHFLongConv);
82 conventions->add(swapIndexJPYConv);
83 conventions->add(swapIndexJPYLongConv);
84
86 "EUR-6M-SWAP-CONVENTIONS", "TARGET", "Annual", "MF", "30/360", "EUR-EURIBOR-6M"));
87 QuantLib::ext::shared_ptr<ore::data::Convention> swapUSDConv(
89 QuantLib::ext::shared_ptr<ore::data::Convention> swapGBPConv(
91 QuantLib::ext::shared_ptr<ore::data::Convention> swapGBPLongConv(
93 QuantLib::ext::shared_ptr<ore::data::Convention> swapCHFConv(
95 QuantLib::ext::shared_ptr<ore::data::Convention> swapCHFLongConv(
98 "JPY-LIBOR-6M-SWAP-CONVENTIONS", "JP", "Semiannual", "MF", "A365", "JPY-LIBOR-6M"));
99
100 conventions->add(swapEURConv);
101 conventions->add(swapUSDConv);
102 conventions->add(swapGBPConv);
103 conventions->add(swapGBPLongConv);
104 conventions->add(swapCHFConv);
105 conventions->add(swapCHFLongConv);
106 conventions->add(swapJPYConv);
107
108 InstrumentConventions::instance().setConventions(conventions);
109
110
118
119
120 vector<pair<string, Real>> indexData = {
121 {"EUR-EONIA", 0.01}, {"EUR-EURIBOR-3M", 0.015}, {"EUR-EURIBOR-6M", 0.02}, {"USD-FedFunds", 0.01},
122 {"USD-LIBOR-1M", 0.02}, {"USD-LIBOR-3M", 0.03}, {"USD-LIBOR-6M", 0.05}, {"GBP-SONIA", 0.01},
123 {"GBP-LIBOR-3M", 0.03}, {"GBP-LIBOR-6M", 0.04}, {"CHF-LIBOR-3M", 0.01}, {"CHF-TOIS", 0.02},
124 {"CHF-LIBOR-6M", 0.02}, {"JPY-LIBOR-6M", 0.01}, {"JPY-TONAR", 0.01}, {"JPY-LIBOR-3M", 0.01},
125 {"CAD-CDOR-3M", 0.02}, {"CAD-CORRA", 0.01}, {"SEK-STIBOR-3M", 0.02}};
126
127 for (auto id : indexData) {
130
131
132 for (Date d = asof - 400; d < asof; d++) {
133 if (h->isValidFixingDate(d))
134 h->addFixing(d, 0.01);
135 }
136 }
137
138
149
150
151 std::map<std::string, QuantLib::Handle<QuantLib::Quote>> quotes;
152 quotes["EURUSD"] = Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(1.2));
153 quotes["EURGBP"] = Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(0.8));
154 quotes["EURCHF"] = Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(1.0));
155 quotes["EURCAD"] = Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(1.0));
156 quotes["EURSEK"] = Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(1.0));
157 quotes["EURJPY"] = Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(128.0));
158 fx_ = QuantLib::ext::make_shared<FXTriangulation>(quotes);
159
160
166
168 Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(2147.56));
170 Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(12.75));
171
174
178
181 yieldCurve(YieldCurveType::EquityDividend,
"SP5")));
183 Handle<EquityIndex2>(QuantLib::ext::make_shared<EquityIndex2>(
185 yieldCurve(YieldCurveType::Discount,
"EUR"),
yieldCurve(YieldCurveType::EquityDividend,
"Lufthansa")));
186
192
193
194
195 if (swapVolCube) {
196 vector<Real> shiftStrikes = {-0.02, -0.01, -0.005, -0.0025, 0.0, 0.0025, 0.005, 0.01, 0.02};
197 vector<Period> optionTenors = {2 * Weeks, 1 * Months, 3 * Months, 6 * Months, 1 * Years, 2 * Years,
198 3 * Years, 5 * Years, 10 * Years, 15 * Years, 20 * Years, 30 * Years};
199 vector<Period> swapTenors = {1 * Years, 2 * Years, 3 * Years, 4 * Years, 5 * Years,
200 7 * Years, 10 * Years, 15 * Years, 20 * Years, 30 * Years};
201 DayCounter dc = Actual365Fixed();
202 Calendar cal = TARGET();
203 BusinessDayConvention bdc = Following;
204 vector<vector<Handle<Quote>>> parQuotes(
205 optionTenors.size(),
206 vector<Handle<Quote>>(swapTenors.size(), Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(0.02))));
207
208 vector<vector<Real>> shift(optionTenors.size(), vector<Real>(swapTenors.size(), 0.0));
209 vector<string> ccys = {"USD", "JPY"};
210 QuantLib::ext::shared_ptr<SwaptionVolatilityStructure> atm(new SwaptionVolatilityMatrix(
211 asof_, cal, bdc, optionTenors, swapTenors, parQuotes, dc,
true, QuantLib::Normal, shift));
212
213 Handle<SwaptionVolatilityStructure> hATM(atm);
214 vector<vector<Handle<Quote>>> cubeQuotes(
215 optionTenors.size() * swapTenors.size(),
216 vector<Handle<Quote>>(shiftStrikes.size(), Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(0.02))));
217
218 for (
auto name : ccys) {
221
223 hATM, optionTenors, swapTenors, shiftStrikes, cubeQuotes, *si, *ssi, false, true, false));
224 tmp->enableExtrapolation();
225
226 Handle<SwaptionVolatilityStructure> svp =
227 Handle<SwaptionVolatilityStructure>(QuantLib::ext::make_shared<SwaptionVolCubeWithATM>(tmp));
229 }
230
231 } else {
237 }
238
239
245
246
250
253 Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(0.4));
255 Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(0.4));
256
258
260 Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(0.0));
261
263 Handle<QuantExt::CreditVolCurve>(QuantLib::ext::make_shared<QuantExt::CreditVolCurveWrapper>(
flatRateFxv(0.12)));
264}
Handle< OptionletVolatilityStructure > flatRateCvs(Volatility vol, VolatilityType type=Normal, Real shift=0.0)
Handle< QuantExt::CreditCurve > flatRateDcs(Volatility forward)
Handle< YieldTermStructure > flatRateYts(Real forward)
Handle< BlackVolTermStructure > flatRateFxv(Volatility forward)
Handle< QuantLib::SwaptionVolatilityStructure > flatRateSvs(Volatility forward, VolatilityType type=ShiftedLognormal, Real shift=0.0)
Handle< YieldTermStructure > flatRateDiv(Real dividend)
Container for storing Interest Rate Swap conventions.
static const string defaultConfiguration
Default configuration label.
map< pair< string, string >, Handle< OptionletVolatilityStructure > > capFloorCurves_
string shortSwapIndexBase(const string &key, const string &configuration=Market::defaultConfiguration) const override
string swapIndexBase(const string &key, const string &configuration=Market::defaultConfiguration) const override
map< pair< string, string >, QuantLib::Handle< QuantExt::EquityIndex2 > > equityCurves_
map< pair< string, string >, Handle< BlackVolTermStructure > > fxVols_
QuantLib::ext::shared_ptr< FXTriangulation > fx_
map< tuple< string, YieldCurveType, string >, Handle< YieldTermStructure > > yieldCurves_
map< pair< string, string >, Handle< QuantExt::CreditCurve > > defaultCurves_
map< pair< string, string >, Handle< IborIndex > > iborIndices_
map< pair< string, string >, Handle< QuantExt::CreditVolCurve > > cdsVols_
map< pair< string, string >, Handle< Quote > > equitySpots_
map< pair< string, string >, Handle< QuantLib::SwaptionVolatilityStructure > > swaptionCurves_
map< pair< string, string >, Handle< Quote > > recoveryRates_
Handle< Quote > equitySpot(const string &eqName, const string &configuration=Market::defaultConfiguration) const override
Equity curves.
Handle< SwapIndex > swapIndex(const string &indexName, const string &configuration=Market::defaultConfiguration) const override
map< pair< string, string >, pair< string, string > > swaptionIndexBases_
map< pair< string, string >, Handle< BlackVolTermStructure > > equityVols_
map< pair< string, string >, Handle< Quote > > securitySpreads_
Handle< YieldTermStructure > yieldCurve(const YieldCurveType &type, const string &ccy, const string &configuration=Market::defaultConfiguration) const override
Yield Curves.
void addSwapIndex(const string &swapindex, const string &discountIndex, const string &configuration=Market::defaultConfiguration) const
add a swap index to the market
Container for storing Swap Index conventions.
QuantLib::ext::shared_ptr< IborIndex > parseIborIndex(const string &s, const Handle< YieldTermStructure > &h)
Convert std::string to QuantLib::IborIndex.
Currency parseCurrency(const string &s)
Convert text to QuantLib::Currency.