19#include <boost/make_shared.hpp>
20#include <boost/test/unit_test.hpp>
22#include <ql/currencies/america.hpp>
23#include <ql/indexes/inflation/euhicp.hpp>
24#include <ql/indexes/inflation/ukrpi.hpp>
25#include <ql/termstructures/inflation/inflationhelpers.hpp>
26#include <ql/termstructures/inflation/interpolatedyoyinflationcurve.hpp>
27#include <ql/termstructures/inflation/interpolatedzeroinflationcurve.hpp>
28#include <ql/termstructures/inflation/piecewiseyoyinflationcurve.hpp>
29#include <ql/termstructures/inflation/piecewisezeroinflationcurve.hpp>
30#include <ql/termstructures/iterativebootstrap.hpp>
31#include <ql/termstructures/volatility/inflation/yoyinflationoptionletvolatilitystructure.hpp>
32#include <ql/termstructures/volatility/equityfx/blackconstantvol.hpp>
33#include <ql/termstructures/volatility/equityfx/blackvariancecurve.hpp>
34#include <ql/termstructures/volatility/optionlet/constantoptionletvol.hpp>
35#include <ql/termstructures/volatility/swaption/swaptionconstantvol.hpp>
36#include <ql/termstructures/volatility/swaption/swaptionvolcube.hpp>
37#include <ql/termstructures/volatility/swaption/swaptionvolmatrix.hpp>
38#include <ql/time/calendars/nullcalendar.hpp>
39#include <ql/time/calendars/target.hpp>
40#include <ql/time/calendars/unitedstates.hpp>
41#include <ql/time/daycounters/actualactual.hpp>
65vector<QuantLib::ext::shared_ptr<RateHelper>>
66parRateCurveHelpers(
const string& ccy,
const vector<string>& parInst,
const vector<Period>& parTenor,
67 const vector<Handle<Quote>>& parVal,
68 const Handle<YieldTermStructure> exDiscount = Handle<YieldTermStructure>(),
70 const Handle<Quote>& fxSpot = Handle<Quote>(),
72 const Handle<YieldTermStructure>& fgnDiscount = Handle<YieldTermStructure>(),
76 BOOST_ASSERT(parInst.size() == parTenor.size());
77 BOOST_ASSERT(parInst.size() == parVal.size());
78 QuantLib::ext::shared_ptr<Conventions> conventions = InstrumentConventions::instance().conventions();
79 vector<QuantLib::ext::shared_ptr<RateHelper>> instruments;
80 for (Size i = 0; i < parInst.size(); ++i) {
81 Handle<Quote> parRateQuote = parVal[i];
82 Period tenor = parTenor[i];
83 QuantLib::ext::shared_ptr<RateHelper> rateHelper;
84 if (parInst[i] ==
"DEP") {
85 QuantLib::ext::shared_ptr<Convention> conv = conventions->get(ccy +
"-DEP-CONVENTIONS");
86 QuantLib::ext::shared_ptr<DepositConvention> depConv = QuantLib::ext::dynamic_pointer_cast<DepositConvention>(conv);
88 o << depConv->index() <<
"-" << io::short_period(tenor);
89 string indexName = o.str();
90 QuantLib::ext::shared_ptr<IborIndex> index =
parseIborIndex(indexName);
91 rateHelper = QuantLib::ext::make_shared<DepositRateHelper>(parRateQuote, index);
92 }
else if (parInst[i] ==
"FRA") {
93 QuantLib::ext::shared_ptr<Convention> conv = conventions->get(ccy +
"-FRA-CONVENTIONS");
94 QuantLib::ext::shared_ptr<FraConvention> fraConv = QuantLib::ext::dynamic_pointer_cast<FraConvention>(conv);
95 BOOST_ASSERT(fraConv);
96 BOOST_ASSERT(tenor > fraConv->index()->tenor());
97 Period startTenor = tenor - fraConv->index()->tenor();
98 rateHelper = QuantLib::ext::make_shared<FraRateHelper>(parRateQuote, startTenor, fraConv->index());
99 }
else if (parInst[i] ==
"IRS") {
100 QuantLib::ext::shared_ptr<Convention> conv = conventions->get(ccy +
"-6M-SWAP-CONVENTIONS");
101 QuantLib::ext::shared_ptr<IRSwapConvention> swapConv = QuantLib::ext::dynamic_pointer_cast<IRSwapConvention>(conv);
102 BOOST_ASSERT(swapConv);
103 rateHelper = QuantLib::ext::make_shared<SwapRateHelper>(
104 parRateQuote, tenor, swapConv->fixedCalendar(), swapConv->fixedFrequency(), swapConv->fixedConvention(),
105 swapConv->fixedDayCounter(), swapConv->index(), Handle<Quote>(), 0 * Days, exDiscount);
106 }
else if (parInst[i] ==
"OIS") {
107 QuantLib::ext::shared_ptr<Convention> conv = conventions->get(ccy +
"-OIS-CONVENTIONS");
108 QuantLib::ext::shared_ptr<OisConvention> oisConv = QuantLib::ext::dynamic_pointer_cast<OisConvention>(conv);
109 BOOST_ASSERT(oisConv);
110 rateHelper = QuantLib::ext::make_shared<QuantExt::OISRateHelper>(
111 oisConv->spotLag(), tenor, parRateQuote, oisConv->index(), oisConv->fixedDayCounter(),
112 oisConv->fixedCalendar(), oisConv->paymentLag(), oisConv->eom(), oisConv->fixedFrequency(),
113 oisConv->fixedConvention(), oisConv->fixedPaymentConvention(), oisConv->rule(), exDiscount,
true);
114 }
else if (parInst[i] ==
"FXF") {
115 QuantLib::ext::shared_ptr<Convention> conv = conventions->get(ccy +
"-FX-CONVENTIONS");
116 QuantLib::ext::shared_ptr<FXConvention> fxConv = QuantLib::ext::dynamic_pointer_cast<FXConvention>(conv);
117 BOOST_ASSERT(fxConv);
118 QuantLib::ext::dynamic_pointer_cast<SimpleQuote>(*parRateQuote)
120 bool isFxBaseCurrencyCollateralCurrency =
false;
124 Date today = Settings::instance().evaluationDate();
125 Date spotDate = fxConv->advanceCalendar().advance(today, fxConv->spotDays() * Days);
126 Date endDate = fxConv->advanceCalendar().advance(spotDate, tenor);
127 rateHelper = QuantLib::ext::make_shared<FxSwapRateHelper>(parRateQuote, fxSpot, (endDate - today) * Days, 0,
128 NullCalendar(), Unadjusted,
false,
129 isFxBaseCurrencyCollateralCurrency, fgnDiscount);
130 }
else if (parInst[i] ==
"XBS") {
131 QuantLib::ext::shared_ptr<Convention> conv = conventions->get(ccy +
"-XCCY-BASIS-CONVENTIONS");
132 QuantLib::ext::shared_ptr<CrossCcyBasisSwapConvention> basisConv =
133 QuantLib::ext::dynamic_pointer_cast<CrossCcyBasisSwapConvention>(conv);
134 BOOST_ASSERT(market);
135 QuantLib::ext::shared_ptr<IborIndex> flatIndex =
137 QuantLib::ext::shared_ptr<IborIndex> spreadIndex =
139 BOOST_ASSERT(basisConv);
140 BOOST_ASSERT(flatIndex);
141 BOOST_ASSERT(*flatIndex->forwardingTermStructure());
142 BOOST_ASSERT(spreadIndex);
143 BOOST_ASSERT(*spreadIndex->forwardingTermStructure());
144 BOOST_ASSERT(*fgnDiscount);
145 QuantLib::ext::dynamic_pointer_cast<SimpleQuote>(*parRateQuote)
147 bool flatIsDomestic =
true;
148 rateHelper = QuantLib::ext::make_shared<CrossCcyBasisSwapHelper>(
149 parRateQuote, fxSpot, basisConv->settlementDays(), basisConv->settlementCalendar(), tenor,
150 basisConv->rollConvention(), flatIndex, spreadIndex, fgnDiscount, exDiscount, basisConv->eom(),
153 BOOST_ERROR(
"Unrecognised par rate instrument in curve construction - " << i);
155 instruments.push_back(rateHelper);
160vector<QuantLib::ext::shared_ptr<DefaultProbabilityHelper>>
161parRateCurveHelpers(
const string& name,
const vector<Period>& parTenor,
const vector<Handle<Quote>>& parVal,
162 const Handle<YieldTermStructure> exDiscount = Handle<YieldTermStructure>(),
165 BOOST_ASSERT(parTenor.size() == parVal.size());
166 QuantLib::ext::shared_ptr<Conventions> conventions = InstrumentConventions::instance().conventions();
167 vector<QuantLib::ext::shared_ptr<DefaultProbabilityHelper>> instruments;
168 Date today = Settings::instance().evaluationDate();
169 for (Size i = 0; i < parTenor.size(); ++i) {
170 Handle<Quote> parRateQuote = parVal[i];
171 Period tenor = parTenor[i];
172 QuantLib::ext::shared_ptr<QuantExt::CdsHelper> rateHelper;
173 QuantLib::ext::shared_ptr<Convention> conv = conventions->get(
"CDS-STANDARD-CONVENTIONS");
174 QuantLib::ext::shared_ptr<CdsConvention> cdsConv = QuantLib::ext::dynamic_pointer_cast<CdsConvention>(conv);
175 BOOST_ASSERT(cdsConv);
176 BOOST_ASSERT(market);
179 BOOST_ASSERT(*exDiscount);
180 rateHelper = QuantLib::ext::make_shared<QuantExt::SpreadCdsHelper>(
181 parRateQuote, tenor, cdsConv->settlementDays(), cdsConv->calendar(), cdsConv->frequency(),
182 cdsConv->paymentConvention(), cdsConv->rule(), cdsConv->dayCounter(), recoveryRate, exDiscount,
183 true, QuantExt::CreditDefaultSwap::ProtectionPaymentTime::atDefault, today + cdsConv->settlementDays());
184 instruments.push_back(rateHelper);
189Handle<YieldTermStructure> parRateCurve(
const Date&
asof,
const vector<QuantLib::ext::shared_ptr<RateHelper>>& rateHelpers) {
190 Handle<YieldTermStructure> yieldTs(QuantLib::ext::make_shared<PiecewiseYieldCurve<QuantLib::Discount, QuantLib::LogLinear>>(
191 asof, rateHelpers, ActualActual(ActualActual::ISDA),
192 PiecewiseYieldCurve<QuantLib::Discount, QuantLib::LogLinear>::bootstrap_type(1.0e-12)));
193 yieldTs->enableExtrapolation();
197Handle<DefaultProbabilityTermStructure>
198parRateCurve(
const Date&
asof,
const vector<QuantLib::ext::shared_ptr<QuantExt::DefaultProbabilityHelper>>& rateHelpers) {
199 Handle<DefaultProbabilityTermStructure> dps(
200 QuantLib::ext::make_shared<QuantLib::PiecewiseDefaultCurve<QuantLib::SurvivalProbability, QuantLib::Linear>>(
201 asof, rateHelpers, Actual360()));
202 dps->enableExtrapolation();
225 vector<pair<string, Real>> indexData = {
226 {
"EUR-EONIA", 0.01}, {
"EUR-EURIBOR-3M", 0.015}, {
"EUR-EURIBOR-6M", 0.02},
227 {
"USD-FedFunds", 0.01}, {
"USD-LIBOR-1M", 0.02}, {
"USD-LIBOR-3M", 0.03}, {
"USD-LIBOR-6M", 0.05},
228 {
"GBP-SONIA", 0.01}, {
"GBP-LIBOR-3M", 0.03}, {
"GBP-LIBOR-6M", 0.04},
229 {
"CHF-LIBOR-3M", 0.01}, {
"CHF-TOIS", 0.02}, {
"CHF-LIBOR-6M", 0.02},
230 {
"JPY-LIBOR-6M", 0.01}, {
"JPY-TONAR", 0.01}, {
"JPY-LIBOR-3M", 0.01},
231 {
"CAD-CDOR-3M", 0.02}, {
"CAD-CORRA", 0.01},
232 {
"SEK-STIBOR-3M", 0.02}};
234 for (
auto id : indexData) {
239 for (Date d =
asof - 400; d <
asof; d++) {
240 if (h->isValidFixingDate(d))
241 h->addFixing(d, 0.01);
258 std::map<std::string, Handle<Quote>> quotes;
259 quotes[
"EURUSD"] = Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(1.2));
260 quotes[
"EURGBP"] = Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(0.8));
261 quotes[
"EURCHF"] = Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(1.0));
262 quotes[
"EURCAD"] = Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(1.0));
263 quotes[
"EURSEK"] = Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(1.0));
264 quotes[
"EURJPY"] = Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(128.0));
265 fx_ = QuantLib::ext::make_shared<FXTriangulation>(quotes);
276 Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(2147.56));
278 Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(12.75));
289 yieldCurve(YieldCurveType::EquityDividend,
"SP5")));
291 Handle<EquityIndex2>(QuantLib::ext::make_shared<EquityIndex2>(
293 yieldCurve(YieldCurveType::Discount,
"EUR"),
yieldCurve(YieldCurveType::EquityDividend,
"Lufthansa")));
304 vector<Real> shiftStrikes = {-0.02, -0.01, -0.005, -0.0025, 0.0, 0.0025, 0.005, 0.01, 0.02};
305 vector<Period> optionTenors = {2 * Weeks, 1 * Months, 3 * Months, 6 * Months, 1 * Years, 2 * Years,
306 3 * Years, 5 * Years, 10 * Years, 15 * Years, 20 * Years, 30 * Years};
307 vector<Period> swapTenors = {1 * Years, 2 * Years, 3 * Years, 4 * Years, 5 * Years,
308 7 * Years, 10 * Years, 15 * Years, 20 * Years, 30 * Years};
309 DayCounter dc = Actual365Fixed();
310 Calendar cal = TARGET();
311 BusinessDayConvention bdc = Following;
312 vector<vector<Handle<Quote>>> parQuotes(
314 vector<Handle<Quote>>(swapTenors.size(), Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(0.02))));
316 vector<vector<Real>> shift(optionTenors.size(), vector<Real>(swapTenors.size(), 0.0));
317 vector<string> ccys = {
"USD",
"JPY"};
318 QuantLib::ext::shared_ptr<SwaptionVolatilityStructure> atm(
new SwaptionVolatilityMatrix(
319 asof_, cal, bdc, optionTenors, swapTenors, parQuotes, dc,
true, QuantLib::Normal, shift));
321 Handle<SwaptionVolatilityStructure> hATM(atm);
322 vector<vector<Handle<Quote>>> cubeQuotes(
323 optionTenors.size() * swapTenors.size(),
324 vector<Handle<Quote>>(shiftStrikes.size(), Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(0.02))));
326 for (
auto name : ccys) {
331 hATM, optionTenors, swapTenors, shiftStrikes, cubeQuotes, *si, *ssi,
false,
true,
false));
332 tmp->enableExtrapolation();
334 Handle<SwaptionVolatilityStructure> svp =
335 Handle<SwaptionVolatilityStructure>(QuantLib::ext::make_shared<SwaptionVolCubeWithATM>(tmp));
362 Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(0.4));
364 Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(0.0));
366 Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(0.4));
372 Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(0.0));
374 Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(0.0));
377 Handle<QuantExt::CreditVolCurve>(QuantLib::ext::make_shared<QuantExt::CreditVolCurveWrapper>(
flatRateFxv(0.12)));
388 auto zeroIndex = Handle<ZeroInflationIndex>(QuantLib::ext::make_shared<UKRPI>(
true,
flatZeroInflationCurve(0.02, 0.01)));
391 QuantLib::ext::make_shared<QuantExt::YoYInflationIndexWrapper>(*zeroIndex,
false,
flatYoYInflationCurve(0.02, 0.01)));
398 Date cpiFixingEnd(1,
asof_.month(),
asof_.year());
399 Date cpiFixingStart = cpiFixingEnd - Period(14, Months);
400 Schedule fixingDatesUKRPI = MakeSchedule().from(cpiFixingStart).to(cpiFixingEnd).withTenor(1 * Months);
401 Real fixingRatesUKRPI[] = {258.5, 258.9, 258.6, 259.8, 259.6, 259.5, 259.8, 260.6,
402 258.8, 260.0, 261.1, 261.4, 262.1, 264.3, 265.2};
406 QuantLib::ext::shared_ptr<YoYInflationIndex> yi = QuantLib::ext::make_shared<QuantExt::YoYInflationIndexWrapper>(ii,
false);
408 RelinkableHandle<ZeroInflationTermStructure> hcpi;
409 ii = QuantLib::ext::shared_ptr<UKRPI>(
new UKRPI(hcpi));
410 for (Size i = 0; i < fixingDatesUKRPI.size(); i++) {
412 ii->addFixing(fixingDatesUKRPI[i], fixingRatesUKRPI[i],
true);
416 Schedule fixingDatesEUHICPXT = MakeSchedule().from(cpiFixingStart).to(cpiFixingEnd).withTenor(1 * Months);
417 Real fixingRatesEUHICPXT[] = {258.5, 258.9, 258.6, 259.8, 259.6, 259.5, 259.8, 260.6,
418 258.8, 260.0, 261.1, 261.4, 262.1, 264.3, 265.2};
422 QuantLib::ext::shared_ptr<YoYInflationIndex> euyi = QuantLib::ext::make_shared<QuantExt::YoYInflationIndexWrapper>(euii,
false);
424 RelinkableHandle<ZeroInflationTermStructure> euhcpi;
425 euii = QuantLib::ext::shared_ptr<EUHICPXT>(
new EUHICPXT(euhcpi));
426 for (Size i = 0; i < fixingDatesEUHICPXT.size(); i++) {
427 euii->addFixing(fixingDatesEUHICPXT[i], fixingRatesEUHICPXT[i],
true);
430 vector<Date> datesZCII = {
asof_,
445 vector<Rate> ratesZCII = {2.825, 2.9425, 2.975, 2.983, 3.0, 3.01, 3.008,
446 3.009, 3.013, 3.0445, 3.044, 3.09, 3.109, 3.108};
464 Actual365Fixed ccDayCounter;
465 vector<Period> commTenors = {0 * Days, 365 * Days, 730 * Days, 1825 * Days};
468 vector<Real> prices = {1155.593, 1160.9, 1168.1, 1210};
470 commTenors, prices, ccDayCounter, USDCurrency()));
471 ptsGold->enableExtrapolation();
473 QuantLib::ext::make_shared<CommoditySpotIndex>(
"COMDTY_GOLD_USD", NullCalendar(), ptsGold));
476 prices = {30.89, 41.23, 44.44, 49.18};
478 commTenors, prices, ccDayCounter, USDCurrency()));
479 ptsOil->enableExtrapolation();
481 QuantLib::ext::make_shared<CommoditySpotIndex>(
"COMDTY_WTI_USD", NullCalendar(), ptsOil));
493 QuantLib::ext::shared_ptr<YieldTermStructure> yts(
494 new FlatForward(Settings::instance().evaluationDate(), forward, ActualActual(ActualActual::ISDA)));
495 return Handle<YieldTermStructure>(yts);
499 QuantLib::ext::shared_ptr<BlackVolTermStructure> fxv(
500 new BlackConstantVol(Settings::instance().evaluationDate(), NullCalendar(), forward, ActualActual(ActualActual::ISDA)));
501 return Handle<BlackVolTermStructure>(fxv);
505 QuantLib::ext::shared_ptr<YieldTermStructure> yts(
506 new FlatForward(Settings::instance().evaluationDate(), dividend, ActualActual(ActualActual::ISDA)));
507 return Handle<YieldTermStructure>(yts);
510Handle<QuantLib::SwaptionVolatilityStructure>
512 QuantLib::ext::shared_ptr<QuantLib::SwaptionVolatilityStructure> svs(
513 new QuantLib::ConstantSwaptionVolatility(Settings::instance().evaluationDate(), NullCalendar(),
514 ModifiedFollowing, forward, ActualActual(ActualActual::ISDA), type, shift));
515 return Handle<QuantLib::SwaptionVolatilityStructure>(svs);
519 QuantLib::ext::shared_ptr<DefaultProbabilityTermStructure> dcs(
520 new FlatHazardRate(
asof_, forward, ActualActual(ActualActual::ISDA)));
521 return Handle<QuantExt::CreditCurve>(QuantLib::ext::make_shared<QuantExt::CreditCurve>(Handle<DefaultProbabilityTermStructure>(dcs)));
525 QuantLib::ext::shared_ptr<OptionletVolatilityStructure> ts(
526 new QuantLib::ConstantOptionletVolatility(Settings::instance().evaluationDate(), NullCalendar(),
527 ModifiedFollowing, vol, ActualActual(ActualActual::ISDA), type, shift));
528 return Handle<OptionletVolatilityStructure>(ts);
532 QuantLib::ext::shared_ptr<QuantExt::CorrelationTermStructure> ts(
534 return Handle<QuantExt::CorrelationTermStructure>(ts);
538 const std::vector<Rate> cStrikes, std::vector<Rate> fStrikes,
539 std::vector<Period> cfMaturities, Matrix cPrice, Matrix fPrice) {
540 QuantLib::ext::shared_ptr<CPICapFloorTermPriceSurface> ts(
541 new InterpolatedCPICapFloorTermPriceSurface<QuantLib::Bilinear>(
542 1.0, 0.0, infIndex->availabilityLag(), infIndex->zeroInflationTermStructure()->calendar(), Following,
543 ActualActual(ActualActual::ISDA), infIndex.currentLink(), CPI::AsIndex,
discountCurve(infIndex->currency().code()), cStrikes, fStrikes, cfMaturities,
545 return Handle<CPICapFloorTermPriceSurface>(ts);
549 Natural settleDays = 0;
550 Calendar cal = TARGET();
551 BusinessDayConvention bdc = Following;
552 DayCounter dc = Actual365Fixed();
553 Period lag = 2 * Months;
554 Frequency freq = Annual;
556 QuantLib::ext::shared_ptr<QuantLib::ConstantCPIVolatility> cpiCapFloorVolSurface =
557 QuantLib::ext::make_shared<QuantLib::ConstantCPIVolatility>(v, settleDays, cal, bdc, dc, lag, freq, interp);
558 return Handle<QuantLib::CPIVolatilitySurface>(cpiCapFloorVolSurface);
562 QuantLib::ext::shared_ptr<ZeroInflationIndex> ii,
563 Handle<YieldTermStructure> yts) {
565 QuantLib::ext::shared_ptr<ZeroInflationTermStructure> cpiTS;
567 vector<QuantLib::ext::shared_ptr<BootstrapHelper<ZeroInflationTermStructure>>> instruments;
568 for (Size i = 0; i < dates.size(); i++) {
569 Handle<Quote> quote(QuantLib::ext::shared_ptr<Quote>(
new SimpleQuote(rates[i] / 100.0)));
570 QuantLib::ext::shared_ptr<BootstrapHelper<ZeroInflationTermStructure>> anInstrument(
new ZeroCouponInflationSwapHelper(
571 quote, Period(2, Months), dates[i], TARGET(), ModifiedFollowing, ActualActual(ActualActual::ISDA), ii, CPI::AsIndex, yts));
572 anInstrument->unregisterWith(Settings::instance().evaluationDate());
573 instruments.push_back(anInstrument);
577 Rate baseZeroRate = rates[0] / 100.0;
578 QuantLib::ext::shared_ptr<PiecewiseZeroInflationCurve<Linear>> pCPIts(
580 baseZeroRate, instruments));
581 pCPIts->recalculate();
582 cpiTS = QuantLib::ext::dynamic_pointer_cast<ZeroInflationTermStructure>(pCPIts);
583 cpiTS->enableExtrapolation(
true);
584 cpiTS->unregisterWith(Settings::instance().evaluationDate());
589 QuantLib::ext::shared_ptr<YoYInflationIndex> ii,
590 Handle<YieldTermStructure> yts) {
592 QuantLib::ext::shared_ptr<YoYInflationTermStructure> yoyTS;
594 vector<QuantLib::ext::shared_ptr<BootstrapHelper<YoYInflationTermStructure>>> instruments;
595 for (Size i = 0; i < dates.size(); i++) {
596 Handle<Quote> quote(QuantLib::ext::shared_ptr<Quote>(
new SimpleQuote(rates[i] / 100.0)));
597 QuantLib::ext::shared_ptr<BootstrapHelper<YoYInflationTermStructure>> anInstrument(
new YearOnYearInflationSwapHelper(
598 quote, Period(2, Months), dates[i], TARGET(), ModifiedFollowing, ActualActual(ActualActual::ISDA), ii, yts));
599 instruments.push_back(anInstrument);
603 Rate baseZeroRate = rates[0] / 100.0;
604 QuantLib::ext::shared_ptr<PiecewiseYoYInflationCurve<Linear>> pYoYts(
605 new PiecewiseYoYInflationCurve<Linear>(
asof_, TARGET(), ActualActual(ActualActual::ISDA), Period(2, Months), ii->frequency(),
606 ii->interpolated(), baseZeroRate, instruments));
607 pYoYts->recalculate();
608 yoyTS = QuantLib::ext::dynamic_pointer_cast<YoYInflationTermStructure>(pYoYts);
609 return Handle<YoYInflationIndex>(QuantLib::ext::make_shared<QuantExt::YoYInflationIndexWrapper>(
614 Date today = Settings::instance().evaluationDate();
615 Period lag = 2 * Months;
616 std::vector<Date> dates;
617 dates.push_back(today - lag);
618 dates.push_back(today + 1 * Years);
619 std::vector<Real> rates(dates.size(), inflationRate);
620 auto curve = QuantLib::ext::make_shared<QuantLib::InterpolatedZeroInflationCurve<Linear>>(
621 today, NullCalendar(), QuantLib::ActualActual(ActualActual::ISDA), 2 * Months, Monthly, dates, rates);
622 curve->enableExtrapolation();
623 return Handle<ZeroInflationTermStructure>(curve);
627 Date today = Settings::instance().evaluationDate();
628 Period lag = 2 * Months;
629 std::vector<Date> dates;
630 dates.push_back(today - lag);
631 dates.push_back(today + 1 * Years);
632 std::vector<Real> rates(dates.size(), inflationRate);
633 auto curve = QuantLib::ext::make_shared<QuantLib::InterpolatedYoYInflationCurve<Linear>>(
634 today, NullCalendar(), QuantLib::ActualActual(ActualActual::ISDA), 2 * Months, Monthly,
false, dates, rates);
635 curve->enableExtrapolation();
636 return Handle<YoYInflationTermStructure>(curve);
640 auto qlTs = QuantLib::ext::make_shared<ConstantYoYOptionletVolatility>(
641 normalVol, 0, NullCalendar(), Unadjusted, ActualActual(ActualActual::ISDA), 2 * Months, Monthly,
false, -1.0, 100.0, Normal);
642 return Handle<YoYOptionletVolatilitySurface>(qlTs);
650 vector<pair<string, Real>> ccys = {{
"EUR", 0.02}, {
"USD", 0.03}, {
"GBP", 0.04}, {
"CHF", 0.02}};
651 vector<pair<string, Real>> o_ccys = {{
"JPY", 0.005}};
652 vector<pair<string, Real>> x_ccys = {{
"CHF", 0.02}};
653 vector<pair<string, Real>> d_names = {{
"dc", 0.001}, {
"dc2", 0.001}, {
"dc3", 0.001}};
654 map<string, string> d_ccys;
655 d_ccys[
"dc"] =
"USD";
656 d_ccys[
"dc2"] =
"EUR";
657 d_ccys[
"dc3"] =
"GBP";
658 vector<Period> parTenor = {2 * Weeks, 1 * Months, 3 * Months, 6 * Months, 1 * Years, 2 * Years, 3 * Years,
659 5 * Years, 10 * Years, 13 * Years, 15 * Years, 20 * Years, 30 * Years};
660 vector<Period> parTenor2 = {3 * Months, 6 * Months, 1 * Years, 2 * Years, 3 * Years,
661 5 * Years, 10 * Years, 13 * Years, 15 * Years, 20 * Years};
662 vector<Period> parTenor3 = {6 * Months, 1 * Years, 2 * Years, 5 * Years, 10 * Years};
664 for (
auto it : ccys) {
665 string ccy = it.first;
666 Real parRate = it.second;
667 vector<string> parInst;
669 parInst = {
"OIS",
"OIS",
"OIS",
"OIS",
"OIS",
"OIS",
"OIS",
"OIS",
"OIS",
"OIS",
"OIS",
"OIS",
"OIS"};
671 parInst = {
"DEP",
"DEP",
"DEP",
"DEP",
"FRA",
"IRS",
"IRS",
"IRS",
"IRS",
"IRS",
"IRS",
"IRS",
"IRS"};
672 vector<Real> parRates(parInst.size(), parRate);
675 for (
auto it : o_ccys) {
676 string ccy = it.first;
677 Real parRate = it.second;
678 vector<string> parInst;
679 parInst = {
"OIS",
"OIS",
"OIS",
"OIS",
"OIS",
"OIS",
"OIS",
"OIS",
"OIS",
"OIS",
"OIS",
"OIS",
"OIS"};
680 vector<Real> parRates(parInst.size(), parRate);
686 std::map<std::string, QuantLib::Handle<QuantLib::Quote>> quotes;
687 quotes[
"EURUSD"] = Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(1.2));
688 quotes[
"EURGBP"] = Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(0.8));
689 quotes[
"EURCHF"] = Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(1.0));
690 quotes[
"EURJPY"] = Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(128.0));
691 fx_ = QuantLib::ext::make_shared<FXTriangulation>(quotes);
695 Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(0.4));
697 Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(0.4));
699 for (
auto it : d_names) {
700 string name = it.first;
701 Real parRate = it.second;
702 string ccy = d_ccys[
name];
703 vector<string> parInst;
704 parInst = {
"CDS",
"CDS",
"CDS",
"CDS",
"CDS",
"CDS",
"CDS",
"CDS",
"CDS",
"CDS"};
705 vector<Real> parRates(parInst.size(), parRate);
710 vector<pair<string, Real>> indexData = {
711 {
"EUR-EONIA", 0.02}, {
"EUR-EURIBOR-2W", 0.02}, {
"EUR-EURIBOR-1M", 0.02}, {
"EUR-EURIBOR-3M", 0.02},
712 {
"EUR-EURIBOR-6M", 0.02}, {
"USD-FedFunds", 0.03}, {
"USD-LIBOR-2W", 0.03}, {
"USD-LIBOR-1M", 0.03},
713 {
"USD-LIBOR-3M", 0.03}, {
"USD-LIBOR-6M", 0.03}, {
"GBP-SONIA", 0.04}, {
"GBP-LIBOR-2W", 0.04},
714 {
"GBP-LIBOR-1M", 0.04}, {
"GBP-LIBOR-3M", 0.04}, {
"GBP-LIBOR-6M", 0.04}, {
"JPY-TONAR", 0.005},
715 {
"JPY-LIBOR-2W", 0.005}, {
"JPY-LIBOR-1M", 0.005}, {
"JPY-LIBOR-3M", 0.005}, {
"JPY-LIBOR-6M", 0.005}};
716 vector<pair<string, Real>> singleCurve_indexData = {{
"CHF-LIBOR-3M", 0.02}, {
"CHF-LIBOR-6M", 0.02}};
717 for (
auto id : indexData) {
718 string idxName =
id.first;
719 string ccy = idxName.substr(0, 3);
720 vector<string> parInst = {
"DEP",
"DEP",
"DEP",
"DEP",
"FRA",
"IRS",
"IRS",
721 "IRS",
"IRS",
"IRS",
"IRS",
"IRS",
"IRS"};
722 vector<Real> parRates(parInst.size(),
id.second);
725 for (
auto id : singleCurve_indexData) {
726 string idxName =
id.first;
727 string ccy = idxName.substr(0, 3);
728 vector<string> parInst = {
"DEP",
"DEP",
"DEP",
"DEP",
"FRA",
"IRS",
"IRS",
729 "IRS",
"IRS",
"IRS",
"IRS",
"IRS",
"IRS"};
730 vector<Real> parRates(parInst.size(),
id.second);
734 for (
auto it : x_ccys) {
735 string baseCcy =
"EUR";
736 string ccy = it.first;
737 Real parRate = it.second;
738 vector<string> parInst;
739 parInst = {
"FXF",
"FXF",
"FXF",
"FXF",
"FXF",
"XBS",
"XBS",
"XBS",
"XBS",
"XBS",
"XBS",
"XBS",
"XBS"};
740 vector<Real> parRates(parInst.size(), parRate);
741 BOOST_ASSERT(ccy != baseCcy);
771 vector<pair<string, Real>> swapvolrates = {
772 {
"EUR", 0.2}, {
"USD", 0.30}, {
"GBP", 0.25}, {
"CHF", 0.25}, {
"JPY", 0.25}};
773 vector<Period> swapTenors = {2 * Weeks, 1 * Months, 3 * Months, 6 * Months, 1 * Years, 2 * Years, 3 * Years,
774 5 * Years, 10 * Years, 13 * Years, 15 * Years, 20 * Years, 30 * Years};
775 vector<Period> swapTerms = {1 * Years, 2 * Years, 3 * Years, 4 * Years, 5 * Years,
776 7 * Years, 10 * Years, 15 * Years, 20 * Years, 30 * Years};
784 vector<Real> swapStrikes = {-0.02, -0.005, 0, 0.005, 0.02};
785 for (
auto it : swapvolrates) {
786 string name = it.first;
787 Real parRate = it.second;
788 vector<Real> parRates(swapTenors.size() * swapTerms.size() * swapStrikes.size(), parRate);
794 Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(2147.56));
796 Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(12.75));
798 vector<pair<string, Real>> eqvolrates = {{
"SP5", 0.2514}, {
"Lufthansa", 0.30}};
799 map<string, string> currencyMap;
800 currencyMap[
"SP5"] =
"USD";
801 currencyMap[
"Lufthansa"] =
"EUR";
802 for (
auto it : eqvolrates) {
803 string name = it.first;
804 Real parRate = it.second;
805 vector<Real> parRates(parTenor.size(), parRate);
813 vector<string> parInst = {
"DEP",
"DEP",
"DEP",
"DEP",
"FRA",
"IRS",
"IRS",
814 "IRS",
"IRS",
"IRS",
"IRS",
"IRS",
"IRS"};
815 vector<Real> parRates1(parInst.size(), 0.03);
816 vector<Real> parRates2(parInst.size(), 0.02);
820 yieldCurve(YieldCurveType::EquityDividend,
"SP5")));
822 Handle<EquityIndex2>(QuantLib::ext::make_shared<EquityIndex2>(
824 yieldCurve(YieldCurveType::Discount,
"EUR"),
yieldCurve(YieldCurveType::EquityDividend,
"Lufthansa")));
826 vector<pair<string, Real>> cdsrates = {{
"dc", 0.12}, {
"dc2", 0.1313}, {
"dc3", 0.14}};
827 for (
auto it : cdsrates) {
828 string name = it.first;
829 Real parRate = it.second;
830 vector<Real> parRates(parTenor3.size(), parRate);
834 vector<pair<string, vector<Real>>> bcrates = {{
"Tranch1", {0.1, 0.2, 0.3, 0.4, 0.5, 0.6}}};
835 vector<Period> bctenors = {1 * Days, 2 * Days};
836 vector<string> lossLevel = {
"0.03",
"0.06",
"0.09",
"0.12",
"0.22",
"1.00"};
837 for (
auto it : bcrates) {
838 string name = it.first;
839 vector<Real> corrRates = it.second;
843 Date cpiFixingEnd(1,
asof_.month(),
asof_.year());
844 Date cpiFixingStart = cpiFixingEnd - Period(14, Months);
845 Schedule fixingDatesUKRPI = MakeSchedule().from(cpiFixingStart).to(cpiFixingEnd).withTenor(1 * Months);
846 Real fixingRatesUKRPI[] = {258.5, 258.9, 258.6, 259.8, 259.6, 259.5, 259.8, 260.6,
847 258.8, 260.0, 261.1, 261.4, 262.1, -264.3, -265.2};
849 RelinkableHandle<ZeroInflationTermStructure> hcpi;
850 QuantLib::ext::shared_ptr<ZeroInflationIndex> ii = QuantLib::ext::shared_ptr<UKRPI>(
new UKRPI(hcpi));
851 for (Size i = 0; i < fixingDatesUKRPI.size(); i++) {
852 ii->addFixing(fixingDatesUKRPI[i], fixingRatesUKRPI[i],
true);
855 vector<pair<string, vector<Real>>> zirates = {
856 {
"UKRPI", {2.825, 2.9425, 2.975, 2.983, 3.0, 3.01, 3.008, 3.009, 3.013}}};
857 vector<Period> zitenors = {6 * Months, 1 * Years, 2 * Years, 3 * Years, 5 * Years,
858 7 * Years, 10 * Years, 15 * Years, 20 * Years};
859 for (
auto it : zirates) {
860 string index = it.first;
861 vector<Real> parRates = it.second;
862 vector<string> parInst = {
"ZIS",
"ZIS",
"ZIS",
"ZIS",
"ZIS",
"ZIS",
"ZIS",
"ZIS",
"ZIS"};
865 vector<pair<string, vector<Real>>> yyrates = {
866 {
"UKRPI", { 2.9425, 2.975, 2.983, 3.0, 3.01, 3.008, 3.009, 3.013}}};
867 vector<Period> yytenors = {1 * Years, 2 * Years, 3 * Years, 5 * Years,
868 7 * Years, 10 * Years, 15 * Years, 20 * Years};
869 for (
auto it : yyrates) {
870 string index = it.first;
871 vector<Real> parRates = it.second;
872 vector<string> parInst = {
"YYS",
"YYS",
"YYS",
"YYS",
"YYS",
"YYS",
"YYS",
"YYS"};
878 const vector<Period>& parTenor,
const vector<Real>& parRates) {
881 vector<Handle<Quote>> parQuotes(parRates.size());
882 for (Size i = 0; i < parRates.size(); ++i)
883 parQuotes[i] = Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(parRates[i]));
891 const vector<string>& parInst,
const vector<Period>& parTenor,
892 const vector<Real>& parRates) {
895 vector<Handle<Quote>> parQuotes(parRates.size());
896 for (Size i = 0; i < parRates.size(); ++i)
897 parQuotes[i] = Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(parRates[i]));
901 Handle<YieldTermStructure> ccyDiscountHandle =
902 Handle<YieldTermStructure>();
904 ccyDiscountHandle,
fxSpot, baseDiscount,
this);
910 const vector<Period>& parTenor,
const vector<Real>& parRates,
912 string ccy = idxName.substr(0, 3);
915 vector<Handle<Quote>> parQuotes(parRates.size());
916 for (Size i = 0; i < parRates.size(); ++i)
917 parQuotes[i] = Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(parRates[i]));
921 singleCurve ? Handle<YieldTermStructure>()
928 if (h->isValidFixingDate(d))
929 h->addFixing(d, 0.01);
934 const vector<Period>& parTenor,
const vector<Real>& parRates) {
935 QuantLib::ext::shared_ptr<Conventions> conventions = InstrumentConventions::instance().conventions();
938 vector<Handle<Quote>> parQuotes(parRates.size());
939 for (Size i = 0; i < parRates.size(); ++i)
940 parQuotes[i] = Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(parRates[i]));
942 QuantLib::ext::shared_ptr<Convention> conv = conventions->get(
"CDS-STANDARD-CONVENTIONS");
952 const vector<Real>& parRates) {
954 vector<Handle<Quote>> parQuotes(parRates.size());
955 for (Size i = 0; i < parRates.size(); ++i)
956 parQuotes[i] = Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(parRates[i]));
959 DayCounter dc = Actual365Fixed();
960 Calendar cal = TARGET();
961 BusinessDayConvention bdc = Following;
962 vector<Volatility> atmVols(parQuotes.size());
963 vector<Date> dates(parQuotes.size());
964 vector<Time> times(parQuotes.size());
966 for (Size i = 0; i < parQuotes.size(); i++) {
967 dates[i] =
asof_ + parTenor[i];
968 atmVols[i] = parQuotes[i]->value();
969 times[i] = dc.yearFraction(
asof_, dates[i]);
973 QuantLib::ext::shared_ptr<BlackVolTermStructure> vol(
new BlackVarianceCurve3(0, cal, bdc, dc, times, parQuotes));
974 vol->enableExtrapolation();
976 QuantLib::ext::make_shared<QuantExt::CreditVolCurveWrapper>(Handle<BlackVolTermStructure>(vol)));
980 const vector<Real>& parRates) {
982 vector<Handle<Quote>> parQuotes(parRates.size());
983 for (Size i = 0; i < parRates.size(); ++i)
984 parQuotes[i] = Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(parRates[i]));
987 DayCounter dc = Actual365Fixed();
990 BusinessDayConvention bdc = Following;
991 vector<Date> dates(parQuotes.size());
992 vector<Time> times(parQuotes.size());
994 for (Size i = 0; i < parQuotes.size(); i++) {
995 dates[i] = cal.advance(
asof_, parTenor[i]);
996 times[i] = dc.yearFraction(
asof_, dates[i]);
998 QuantLib::ext::shared_ptr<BlackVolTermStructure> vol(
new BlackVarianceCurve3(0, cal, bdc, dc, times, parQuotes));
999 vol->enableExtrapolation();
1004 const vector<string>& lossLevel,
const vector<Real> quotes) {
1005 Natural settlementDays = 0;
1007 BusinessDayConvention bdc = Following;
1008 DayCounter dc = Actual365Fixed();
1010 vector<Handle<Quote>> allQuotes(quotes.size());
1011 vector<vector<Handle<Quote>>> correls(quotes.size());
1012 for (Size i = 0; i < quotes.size(); i++) {
1013 Handle<Quote> sq(QuantLib::ext::make_shared<SimpleQuote>(quotes[i]));
1015 vector<Handle<Quote>> qt(tenors.size(), sq);
1022 vector<Real> ll_quotes(lossLevel.size());
1023 for (Size j = 0; j < lossLevel.size(); j++) {
1027 QuantLib::ext::make_shared<QuantExt::InterpolatedBaseCorrelationTermStructure<Bilinear>>(settlementDays,
calendar, bdc, tenors, ll_quotes,
1029 bcts->enableExtrapolation(
true);
1031 Handle<QuantExt::BaseCorrelationTermStructure>(bcts);
1035 const vector<Period>& swapTenors,
const vector<Real>& strikeSpreads,
1036 const vector<Real>& parRates) {
1037 DayCounter dc = Actual365Fixed();
1038 Calendar cal = TARGET();
1039 BusinessDayConvention bdc = Following;
1043 vector<vector<Handle<Quote>>> parQuotes(optionTenors.size(), vector<Handle<Quote>>(swapTenors.size()));
1044 vector<vector<Handle<Quote>>> cubeQuotes(optionTenors.size() * swapTenors.size(),
1045 vector<Handle<Quote>>(strikeSpreads.size(), Handle<Quote>()));
1046 vector<Handle<Quote>> allQuotes(parRates.size());
1048 vector<vector<Real>> shift(optionTenors.size(), vector<Real>(swapTenors.size(), 0.0));
1049 for (Size i = 0; i < optionTenors.size(); ++i) {
1050 for (Size j = 0; j < swapTenors.size(); ++j) {
1051 for (Size k = 0; k < strikeSpreads.size(); ++k) {
1052 Size l = (i * swapTenors.size() * strikeSpreads.size()) + j * strikeSpreads.size() + k;
1053 Handle<Quote> quote = Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(parRates[l]));
1055 parQuotes[i][j] = quote;
1057 cubeQuotes[i * swapTenors.size() + j][k] = quote;
1058 allQuotes[l] = quote;
1063 QuantLib::ext::shared_ptr<SwaptionVolatilityStructure> atm(
new SwaptionVolatilityMatrix(
1064 asof_, cal, bdc, optionTenors, swapTenors, parQuotes, dc,
true, QuantLib::Normal, shift));
1066 Handle<SwaptionVolatilityStructure> hATM(atm);
1071 hATM, optionTenors, swapTenors, strikeSpreads, cubeQuotes, *si, *ssi,
false,
true,
false));
1072 tmp->enableExtrapolation();
1074 Handle<SwaptionVolatilityStructure> svp =
1075 Handle<SwaptionVolatilityStructure>(QuantLib::ext::make_shared<SwaptionVolCubeWithATM>(tmp));
1081 const vector<Period>& parTenor,
const vector<Real>& parRates,
1083 QuantLib::ext::shared_ptr<Conventions> conventions = InstrumentConventions::instance().conventions();
1087 vector<Handle<Quote>> parQuotes(parRates.size());
1088 for (Size i = 0; i < parRates.size(); ++i)
1089 parQuotes[i] = Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(parRates[i] / 100));
1093 string ccy = zii->currency().code();
1094 QuantLib::ext::shared_ptr<ore::data::InflationSwapConvention> conv =
1095 QuantLib::ext::dynamic_pointer_cast<ore::data::InflationSwapConvention>(conventions->get(idxName));
1097 std::vector<QuantLib::ext::shared_ptr<ZeroInflationTraits::helper>> instruments;
1099 for (Size i = 0; i < parTenor.size(); i++) {
1100 instruments.push_back(QuantLib::ext::make_shared<ZeroCouponInflationSwapHelper>(
1101 parQuotes[i], conv->observationLag(),
asof_ + parTenor[i], conv->infCalendar(), conv->infConvention(),
1102 conv->dayCounter(), zii, conv->interpolated() ? QuantLib::CPI::Linear : QuantLib::CPI::Flat,
1105 QuantLib::ext::shared_ptr<ZeroInflationTermStructure> zeroCurve;
1106 Real baseRate = parQuotes[0]->value();
1107 zeroCurve = QuantLib::ext::shared_ptr<PiecewiseZeroInflationCurve<Linear>>(
1109 zii->frequency(), baseRate, instruments));
1110 Handle<ZeroInflationTermStructure> its(zeroCurve);
1111 its->enableExtrapolation();
1112 QuantLib::ext::shared_ptr<ZeroInflationIndex> i =
1114 Handle<ZeroInflationIndex> zh(i);
1119 const vector<Period>& parTenor,
const vector<Real>& parRates,
1121 QuantLib::ext::shared_ptr<Conventions> conventions = InstrumentConventions::instance().conventions();
1125 vector<Handle<Quote>> parQuotes(parRates.size());
1126 for (Size i = 0; i < parRates.size(); ++i)
1127 parQuotes[i] = Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(parRates[i] / 100));
1131 QuantLib::ext::shared_ptr<YoYInflationIndex> yi = QuantLib::ext::make_shared<QuantExt::YoYInflationIndexWrapper>(zii,
false);
1132 string ccy = zii->currency().code();
1133 QuantLib::ext::shared_ptr<ore::data::InflationSwapConvention> conv =
1134 QuantLib::ext::dynamic_pointer_cast<ore::data::InflationSwapConvention>(conventions->get(idxName));
1136 std::vector<QuantLib::ext::shared_ptr<YoYInflationTraits::helper>> instruments;
1137 for (Size i = 0; i < parTenor.size(); i++) {
1138 instruments.push_back(QuantLib::ext::make_shared<YearOnYearInflationSwapHelper>(
1139 parQuotes[i], conv->observationLag(),
asof_ + parTenor[i], conv->infCalendar(), conv->infConvention(),
1142 QuantLib::ext::shared_ptr<YoYInflationTermStructure> yoyCurve;
1144 Real baseRate = parQuotes[0]->value();
1145 yoyCurve = QuantLib::ext::shared_ptr<PiecewiseYoYInflationCurve<Linear>>(
1146 new PiecewiseYoYInflationCurve<Linear>(
asof_, conv->fixCalendar(), conv->dayCounter(), conv->observationLag(),
1147 yi->frequency(), conv->interpolated(), baseRate, instruments));
1148 yoyCurve->enableExtrapolation();
1149 Handle<YoYInflationTermStructure> its(yoyCurve);
1150 QuantLib::ext::shared_ptr<YoYInflationIndex> i(yi->clone(its));
1151 Handle<YoYInflationIndex> zh(i);
1156 QuantLib::ext::shared_ptr<YieldTermStructure> yts(
1157 new FlatForward(Settings::instance().evaluationDate(), forward, ActualActual(ActualActual::ISDA)));
1158 return Handle<YieldTermStructure>(yts);
1161 QuantLib::ext::shared_ptr<BlackVolTermStructure> fxv(
1162 new BlackConstantVol(Settings::instance().evaluationDate(), NullCalendar(), forward, Actual365Fixed()));
1163 return Handle<BlackVolTermStructure>(fxv);
1167 QuantLib::ext::shared_ptr<QuantLib::SwaptionVolatilityStructure> svs(
1168 new QuantLib::ConstantSwaptionVolatility(Settings::instance().evaluationDate(), NullCalendar(),
1169 ModifiedFollowing, forward, ActualActual(ActualActual::ISDA), type, shift));
1170 return Handle<QuantLib::SwaptionVolatilityStructure>(svs);
1173 QuantLib::ext::shared_ptr<DefaultProbabilityTermStructure> dcs(
new FlatHazardRate(
asof_, forward, ActualActual(ActualActual::ISDA)));
1174 return Handle<DefaultProbabilityTermStructure>(dcs);
1177 QuantLib::ext::shared_ptr<OptionletVolatilityStructure> ts(
new QuantLib::ConstantOptionletVolatility(
1178 Settings::instance().evaluationDate(), NullCalendar(), ModifiedFollowing, vol, ActualActual(ActualActual::ISDA), type, shift));
1179 return Handle<OptionletVolatilityStructure>(ts);
1183 QuantLib::ext::shared_ptr<Conventions> conventions = QuantLib::ext::make_shared<Conventions>();
1186 conventions->add(QuantLib::ext::make_shared<ore::data::SwapIndexConvention>(
"EUR-CMS-2Y",
"EUR-6M-SWAP-CONVENTIONS"));
1187 conventions->add(QuantLib::ext::make_shared<ore::data::SwapIndexConvention>(
"EUR-CMS-30Y",
"EUR-6M-SWAP-CONVENTIONS"));
1188 conventions->add(QuantLib::ext::make_shared<ore::data::SwapIndexConvention>(
"USD-CMS-1Y",
"USD-3M-SWAP-CONVENTIONS"));
1189 conventions->add(QuantLib::ext::make_shared<ore::data::SwapIndexConvention>(
"USD-CMS-2Y",
"USD-3M-SWAP-CONVENTIONS"));
1190 conventions->add(QuantLib::ext::make_shared<ore::data::SwapIndexConvention>(
"USD-CMS-30Y",
"USD-3M-SWAP-CONVENTIONS"));
1191 conventions->add(QuantLib::ext::make_shared<ore::data::SwapIndexConvention>(
"GBP-CMS-2Y",
"GBP-3M-SWAP-CONVENTIONS"));
1192 conventions->add(QuantLib::ext::make_shared<ore::data::SwapIndexConvention>(
"GBP-CMS-30Y",
"GBP-6M-SWAP-CONVENTIONS"));
1193 conventions->add(QuantLib::ext::make_shared<ore::data::SwapIndexConvention>(
"CHF-CMS-2Y",
"CHF-3M-SWAP-CONVENTIONS"));
1194 conventions->add(QuantLib::ext::make_shared<ore::data::SwapIndexConvention>(
"CHF-CMS-30Y",
"CHF-6M-SWAP-CONVENTIONS"));
1195 conventions->add(QuantLib::ext::make_shared<ore::data::SwapIndexConvention>(
"JPY-CMS-1Y",
"JPY-LIBOR-6M-SWAP-CONVENTIONS"));
1196 conventions->add(QuantLib::ext::make_shared<ore::data::SwapIndexConvention>(
"JPY-CMS-2Y",
"JPY-LIBOR-6M-SWAP-CONVENTIONS"));
1197 conventions->add(QuantLib::ext::make_shared<ore::data::SwapIndexConvention>(
"JPY-CMS-30Y",
"JPY-LIBOR-6M-SWAP-CONVENTIONS"));
1199 conventions->add(QuantLib::ext::make_shared<ore::data::IRSwapConvention>(
"EUR-6M-SWAP-CONVENTIONS",
"TARGET",
"Annual",
"MF",
"30/360",
"EUR-EURIBOR-6M"));
1200 conventions->add(QuantLib::ext::make_shared<ore::data::IRSwapConvention>(
"USD-3M-SWAP-CONVENTIONS",
"US",
"Semiannual",
"MF",
"30/360",
"USD-LIBOR-3M"));
1201 conventions->add(QuantLib::ext::make_shared<ore::data::IRSwapConvention>(
"GBP-3M-SWAP-CONVENTIONS",
"UK",
"Semiannual",
"MF",
"A365",
"GBP-LIBOR-3M"));
1202 conventions->add(QuantLib::ext::make_shared<ore::data::IRSwapConvention>(
"GBP-6M-SWAP-CONVENTIONS",
"UK",
"Semiannual",
"MF",
"A365",
"GBP-LIBOR-6M"));
1203 conventions->add(QuantLib::ext::make_shared<ore::data::IRSwapConvention>(
"CHF-3M-SWAP-CONVENTIONS",
"TARGET",
"Annual",
"MF",
"30/360",
"CHF-LIBOR-3M"));
1204 conventions->add(QuantLib::ext::make_shared<ore::data::IRSwapConvention>(
"CHF-6M-SWAP-CONVENTIONS",
"TARGET",
"Annual",
"MF",
"30/360",
"CHF-LIBOR-6M"));
1205 conventions->add(QuantLib::ext::make_shared<ore::data::IRSwapConvention>(
"JPY-LIBOR-6M-SWAP-CONVENTIONS",
"JP",
"Semiannual",
"MF",
"A365",
"JPY-LIBOR-6M"));
1206 conventions->add(QuantLib::ext::make_shared<ore::data::IRSwapConvention>(
"JPY-6M-SWAP-CONVENTIONS",
"JP",
"S",
"MF",
"ACT",
"JPY-LIBOR-6M"));
1207 conventions->add(QuantLib::ext::make_shared<ore::data::IRSwapConvention>(
"USD-6M-SWAP-CONVENTIONS",
"US",
"S",
"MF",
"30/360",
"USD-LIBOR-6M"));
1209 conventions->add(QuantLib::ext::make_shared<ore::data::DepositConvention>(
"EUR-DEP-CONVENTIONS",
"EUR-EURIBOR"));
1210 conventions->add(QuantLib::ext::make_shared<ore::data::DepositConvention>(
"USD-DEP-CONVENTIONS",
"USD-LIBOR"));
1211 conventions->add(QuantLib::ext::make_shared<ore::data::DepositConvention>(
"GBP-DEP-CONVENTIONS",
"GBP-LIBOR"));
1212 conventions->add(QuantLib::ext::make_shared<ore::data::DepositConvention>(
"JPY-DEP-CONVENTIONS",
"JPY-LIBOR"));
1213 conventions->add(QuantLib::ext::make_shared<ore::data::DepositConvention>(
"CHF-DEP-CONVENTIONS",
"CHF-LIBOR"));
1215 conventions->add(QuantLib::ext::make_shared<ore::data::FraConvention>(
"EUR-FRA-CONVENTIONS",
"EUR-EURIBOR-6M"));
1216 conventions->add(QuantLib::ext::make_shared<ore::data::FraConvention>(
"USD-FRA-CONVENTIONS",
"USD-LIBOR-6M"));
1217 conventions->add(QuantLib::ext::make_shared<ore::data::FraConvention>(
"GBP-FRA-CONVENTIONS",
"GBP-LIBOR-6M"));
1218 conventions->add(QuantLib::ext::make_shared<ore::data::FraConvention>(
"JPY-FRA-CONVENTIONS",
"JPY-LIBOR-6M"));
1219 conventions->add(QuantLib::ext::make_shared<ore::data::FraConvention>(
"CHF-FRA-CONVENTIONS",
"CHF-LIBOR-6M"));
1221 conventions->add(QuantLib::ext::make_shared<FXConvention>(
"EUR-USD-FX",
"0",
"EUR",
"USD",
"10000",
"EUR,USD"));
1222 conventions->add(QuantLib::ext::make_shared<FXConvention>(
"EUR-GBP-FX",
"0",
"EUR",
"GBP",
"10000",
"EUR,GBP"));
1223 conventions->add(QuantLib::ext::make_shared<FXConvention>(
"EUR-CHF-FX",
"0",
"EUR",
"CHF",
"10000",
"EUR,CHF"));
1224 conventions->add(QuantLib::ext::make_shared<FXConvention>(
"EUR-JPY-FX",
"0",
"EUR",
"JPY",
"10000",
"EUR,JPY"));
1226 conventions->add(QuantLib::ext::make_shared<ore::data::FXConvention>(
"CHF-FX-CONVENTIONS",
"0",
"CHF",
"EUR",
"10000",
1227 "CHF,EUR",
"true"));
1229 conventions->add(QuantLib::ext::make_shared<ore::data::OisConvention>(
1230 "JPY-OIS-CONVENTIONS",
"2",
"JPY-TONAR",
"ACT/365",
"JPY",
"1",
"false",
"Annual",
"MF",
"MF",
"Backward"));
1232 conventions->add(QuantLib::ext::make_shared<ore::data::CdsConvention>(
1233 "CDS-STANDARD-CONVENTIONS",
"0",
"WeekendsOnly",
"Quarterly",
"Following",
"CDS2015",
"A360",
"true",
"true"));
1235 conventions->add(QuantLib::ext::make_shared<ore::data::CrossCcyBasisSwapConvention>(
1236 "CHF-XCCY-BASIS-CONVENTIONS",
"2",
"CHF,EUR",
"MF",
"EUR-EURIBOR-6M",
"CHF-LIBOR-6M",
"false"));
1238 conventions->add(QuantLib::ext::make_shared<ore::data::InflationSwapConvention>(
"UKRPI",
"UK",
"MF",
"A365",
"UKRPI",
1239 "false",
"3M",
"false",
"UK",
"MF"));
1240 conventions->add(QuantLib::ext::make_shared<ore::data::InflationSwapConvention>(
"UKRP1",
"UK",
"MF",
"A365",
"UKRPI",
1241 "false",
"3M",
"false",
"UK",
"MF"));
1242 InstrumentConventions::instance().setConventions(conventions);
1245QuantLib::ext::shared_ptr<ore::analytics::ScenarioSimMarketParameters>
1247 QuantLib::ext::shared_ptr<ore::analytics::ScenarioSimMarketParameters> simMarketData(
1250 simMarketData->baseCcy() =
"EUR";
1251 simMarketData->setDiscountCurveNames({
"EUR",
"GBP",
"USD",
"CHF",
"JPY"});
1252 simMarketData->setYieldCurveTenors(
"",
1253 {2 * Weeks, 1 * Months, 3 * Months, 6 * Months, 1 * Years, 2 * Years, 3 * Years,
1254 5 * Years, 10 * Years, 13 * Years, 15 * Years, 20 * Years, 30 * Years});
1255 simMarketData->setIndices({
"EUR-EURIBOR-2W",
"EUR-EURIBOR-1M",
"EUR-EURIBOR-3M",
"EUR-EURIBOR-6M",
"USD-LIBOR-2W",
1256 "USD-LIBOR-1M",
"USD-LIBOR-3M",
"USD-LIBOR-6M",
"GBP-LIBOR-2W",
"GBP-LIBOR-1M",
1257 "GBP-LIBOR-3M",
"GBP-LIBOR-6M",
"CHF-LIBOR-6M",
"JPY-LIBOR-2W",
"JPY-LIBOR-1M",
1258 "JPY-LIBOR-3M",
"JPY-LIBOR-6M",
"JPY-TONAR"});
1259 simMarketData->interpolation() =
"LogLinear";
1260 simMarketData->swapIndices()[
"EUR-CMS-2Y"] =
"EUR-EURIBOR-6M";
1261 simMarketData->swapIndices()[
"EUR-CMS-30Y"] =
"EUR-EURIBOR-6M";
1263 simMarketData->setSwapVolTerms(
"", {1 * Years, 2 * Years, 3 * Years, 4 * Years, 5 * Years, 7 * Years, 10 * Years,
1264 15 * Years, 20 * Years, 30 * Years});
1265 simMarketData->setSwapVolExpiries(
"",
1266 {2 * Weeks, 1 * Months, 3 * Months, 6 * Months, 1 * Years, 2 * Years, 3 * Years,
1267 5 * Years, 10 * Years, 13 * Years, 15 * Years, 20 * Years, 30 * Years});
1268 simMarketData->setSwapVolKeys({
"EUR",
"GBP",
"USD",
"CHF",
"JPY"});
1269 simMarketData->swapVolDecayMode() =
"ForwardVariance";
1270 simMarketData->setSimulateSwapVols(
true);
1271 if (hasSwapVolCube) {
1272 simMarketData->setSwapVolIsCube(
"",
true);
1273 simMarketData->simulateSwapVolATMOnly() =
false;
1274 simMarketData->setSwapVolStrikeSpreads(
"", {-0.02, -0.005, 0.0, 0.005, 0.02});
1277 simMarketData->setFxVolExpiries(
"",
1278 vector<Period>{1 * Months, 3 * Months, 6 * Months, 2 * Years, 3 * Years, 4 * Years, 5 * Years});
1279 simMarketData->setFxVolDecayMode(
string(
"ConstantVariance"));
1280 simMarketData->setSimulateFXVols(
true);
1281 simMarketData->setFxVolCcyPairs({
"EURUSD",
"EURGBP",
"EURCHF",
"EURJPY"});
1282 simMarketData->setFxVolIsSurface(
true);
1283 simMarketData->setFxVolMoneyness(vector<Real>{0.1, 0.5, 1, 1.5, 2, 2.5, 3});
1284 simMarketData->setFxCcyPairs({
"EURUSD",
"EURGBP",
"EURCHF",
"EURJPY"});
1286 simMarketData->setSimulateCapFloorVols(
true);
1287 simMarketData->capFloorVolDecayMode() =
"ForwardVariance";
1288 simMarketData->setCapFloorVolKeys({
"EUR",
"USD"});
1289 simMarketData->setCapFloorVolExpiries(
1290 "", {6 * Months, 1 * Years, 2 * Years, 3 * Years, 5 * Years, 7 * Years, 10 * Years, 15 * Years, 20 * Years});
1291 simMarketData->setCapFloorVolStrikes(
"", {0.00, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06});
1293 simMarketData->setDefaultNames({
"dc",
"dc2",
"dc3"});
1294 simMarketData->setDefaultTenors(
"", {3 * Months, 6 * Months, 1 * Years, 2 * Years, 3 * Years, 5 * Years, 10 * Years,
1295 13 * Years, 15 * Years, 20 * Years});
1296 simMarketData->setSimulateSurvivalProbabilities(
true);
1297 simMarketData->setSimulateRecoveryRates(
false);
1298 simMarketData->setDefaultCurveCalendars(
"",
"TARGET");
1300 simMarketData->setSimulateCdsVols(
true);
1301 simMarketData->cdsVolExpiries() = {6 * Months, 1 * Years, 2 * Years, 5 * Years, 10 * Years};
1302 simMarketData->cdsVolDecayMode() =
"ForwardVariance";
1303 simMarketData->setCdsVolNames({
"dc",
"dc2",
"dc3"});
1305 simMarketData->setEquityNames({
"SP5",
"Lufthansa"});
1306 simMarketData->setEquityDividendTenors(
"SP5", {6 * Months, 1 * Years, 2 * Years});
1307 simMarketData->setEquityDividendTenors(
"Lufthansa", {6 * Months, 1 * Years, 2 * Years});
1309 simMarketData->setSimulateEquityVols(
true);
1310 simMarketData->setEquityVolDecayMode(
"ForwardVariance");
1311 simMarketData->setEquityVolNames({
"SP5",
"Lufthansa"});
1312 simMarketData->setEquityVolExpiries(
"",
1313 {2 * Weeks, 1 * Months, 3 * Months, 6 * Months, 1 * Years, 2 * Years, 3 * Years,
1314 5 * Years, 10 * Years, 13 * Years, 15 * Years, 20 * Years, 30 * Years});
1315 simMarketData->setEquityVolIsSurface(
"",
true);
1316 simMarketData->setEquityVolMoneyness(
1317 "", {0.5, 0.6, 0.7, 0.8, 0.9, 0.95, 1.0, 1.05, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.5, 3.0});
1319 simMarketData->setSimulateBaseCorrelations(
true);
1320 simMarketData->setBaseCorrelationNames({
"Tranch1"});
1321 simMarketData->baseCorrelationDetachmentPoints() = {0.03, 0.06, 0.09, 0.12, 0.22, 1.0};
1322 simMarketData->baseCorrelationTerms() = {1 * Days};
1324 simMarketData->setZeroInflationIndices({
"UKRPI"});
1325 simMarketData->setZeroInflationTenors(
"UKRPI", {6 * Months, 1 * Years, 2 * Years, 3 * Years, 5 * Years, 7 * Years,
1326 10 * Years, 15 * Years, 20 * Years});
1328 simMarketData->setYoyInflationIndices({
"UKRPI"});
1329 simMarketData->setYoyInflationTenors(
1330 "UKRPI", {1 * Years, 2 * Years, 3 * Years, 5 * Years, 7 * Years, 10 * Years, 15 * Years, 20 * Years});
1333 simMarketData->setSimulateYoYInflationCapFloorVols(
true);
1334 simMarketData->setYoYInflationCapFloorVolNames({
"UKRPI"});
1335 simMarketData->setYoYInflationCapFloorVolExpiries(
1336 "UKRPI", {1 * Years, 2 * Years, 3 * Years, 5 * Years, 7 * Years, 10 * Years, 15 * Years, 20 * Years});
1337 simMarketData->setYoYInflationCapFloorVolStrikes(
"", {-0.02, -0.01, 0.00, 0.01, 0.02, 0.03});
1338 simMarketData->yoyInflationCapFloorVolDecayMode() =
"ForwardVariance";
1341 return simMarketData;
1347 cvsData.
shiftTenors = {2 * Weeks, 1 * Months, 3 * Months, 6 * Months, 1 * Years, 2 * Years, 3 * Years,
1348 5 * Years, 10 * Years, 13 * Years, 15 * Years, 20 * Years, 30 * Years};
1349 cvsData.
shiftType = ShiftType::Absolute;
1351 cvsData.
parInstruments = {
"DEP",
"DEP",
"DEP",
"DEP",
"FRA",
"IRS",
"IRS",
1352 "IRS",
"IRS",
"IRS",
"IRS",
"IRS",
"IRS"};
1357QuantLib::ext::shared_ptr<ore::analytics::SensitivityScenarioData>
1359 QuantLib::ext::shared_ptr<ore::analytics::SensitivityScenarioData> sensiData =
1360 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData>(parConversion);
1361 vector<string> oisInstruments = {
"OIS",
"OIS",
"OIS",
"OIS",
"OIS",
"OIS",
"OIS",
1362 "OIS",
"OIS",
"OIS",
"OIS",
"OIS",
"OIS"};
1363 vector<string> xbsInstruments = {
"FXF",
"FXF",
"FXF",
"FXF",
"FXF",
"XBS",
"XBS",
1364 "XBS",
"XBS",
"XBS",
"XBS",
"XBS",
"XBS"};
1367 fxsData.
shiftType = ShiftType::Relative;
1371 fxvsData.
shiftType = ShiftType::Relative;
1376 cfvsData.
shiftType = ShiftType::Absolute;
1378 cfvsData.
shiftExpiries = {1 * Years, 2 * Years, 3 * Years, 5 * Years, 10 * Years};
1379 cfvsData.
shiftStrikes = {0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.10};
1382 swvsData.
shiftType = ShiftType::Relative;
1384 swvsData.
shiftExpiries = {2 * Weeks, 1 * Months, 3 * Months, 6 * Months, 1 * Years, 2 * Years, 3 * Years,
1385 5 * Years, 10 * Years, 13 * Years, 15 * Years, 20 * Years, 30 * Years};
1386 swvsData.
shiftTerms = {1 * Years, 2 * Years, 3 * Years, 4 * Years, 5 * Years,
1387 7 * Years, 10 * Years, 15 * Years, 20 * Years, 30 * Years};
1389 swvsData.
shiftStrikes = {-0.02, -0.005, 0.0, 0.005, 0.02};
1392 cdsvsData.
shiftType = ShiftType::Relative;
1394 cdsvsData.
shiftExpiries = {6 * Months, 1 * Years, 2 * Years, 5 * Years, 10 * Years};
1397 eqsData.
shiftType = ShiftType::Relative;
1401 eqvsData.
shiftType = ShiftType::Relative;
1403 eqvsData.
shiftExpiries = {2 * Weeks, 1 * Months, 3 * Months, 6 * Months, 1 * Years, 2 * Years, 3 * Years,
1404 5 * Years, 10 * Years, 13 * Years, 15 * Years, 20 * Years, 30 * Years};
1406 QuantLib::ext::shared_ptr<ore::analytics::SensitivityScenarioData::CurveShiftData> eqdivData =
1407 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftData>();
1408 eqdivData->shiftType = ShiftType::Absolute;
1409 eqdivData->shiftSize = 0.00001;
1410 eqdivData->shiftTenors = {6 * Months, 1 * Years, 2 * Years};
1413 bcorrData.
shiftType = ShiftType::Absolute;
1418 QuantLib::ext::shared_ptr<ore::analytics::SensitivityScenarioData::CurveShiftParData> zinfData =
1419 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftParData>();
1420 zinfData->shiftType = ShiftType::Absolute;
1421 zinfData->shiftSize = 0.0001;
1422 zinfData->shiftTenors = {6 * Months, 1 * Years, 2 * Years, 3 * Years, 5 * Years,
1423 7 * Years, 10 * Years, 15 * Years, 20 * Years};
1424 zinfData->parInstruments = {
"ZIS",
"ZIS",
"ZIS",
"ZIS",
"ZIS",
"ZIS",
"ZIS",
"ZIS",
"ZIS"};
1425 zinfData->parInstrumentConventions[
"ZIS"] =
"UKRPI";
1427 QuantLib::ext::shared_ptr<ore::analytics::SensitivityScenarioData::CurveShiftParData> yinfData =
1428 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftParData>();
1429 yinfData->shiftType = ShiftType::Absolute;
1430 yinfData->shiftSize = 0.0001;
1431 yinfData->shiftTenors = {1 * Years, 2 * Years, 3 * Years, 5 * Years, 7 * Years, 10 * Years, 15 * Years, 20 * Years};
1432 yinfData->parInstruments = {
"YYS",
"YYS",
"YYS",
"YYS",
"YYS",
"YYS",
"YYS",
"YYS"};
1433 yinfData->parInstrumentConventions[
"ZIS"] =
"UKRPI";
1434 yinfData->parInstrumentConventions[
"YYS"] =
"UKRPI";
1436 auto yinfCfData = QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CapFloorVolShiftParData>();
1437 yinfCfData->shiftType = ShiftType::Absolute;
1438 yinfCfData->shiftSize = 0.00001;
1439 yinfCfData->shiftExpiries = {1 * Years, 2 * Years, 3 * Years, 5 * Years,
1440 7 * Years, 10 * Years, 15 * Years, 20 * Years};
1441 yinfCfData->shiftStrikes = {-0.02, -0.01, 0.00, 0.01, 0.02, 0.03};
1442 yinfCfData->parInstruments = {
"YYS",
"YYS",
"YYS",
"YYS",
"YYS",
"YYS",
"YYS",
"YYS"};
1443 yinfCfData->parInstrumentSingleCurve =
false;
1444 yinfCfData->parInstrumentConventions[
"ZIS"] =
"UKRPI";
1445 yinfCfData->parInstrumentConventions[
"YYS"] =
"UKRPI";
1453 sensiData->discountCurveShiftData()[
"EUR"] =
1454 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftParData>(cvsData);
1463 sensiData->discountCurveShiftData()[
"USD"] =
1464 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftParData>(cvsData);
1473 sensiData->discountCurveShiftData()[
"GBP"] =
1474 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftParData>(cvsData);
1485 sensiData->discountCurveShiftData()[
"JPY"] =
1486 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftParData>(cvsData);
1497 sensiData->discountCurveShiftData()[
"CHF"] =
1498 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftParData>(cvsData);
1506 sensiData->indexCurveShiftData()[
"EUR-EURIBOR-2W"] =
1507 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftParData>(cvsData);
1515 sensiData->indexCurveShiftData()[
"EUR-EURIBOR-1M"] =
1516 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftParData>(cvsData);
1524 sensiData->indexCurveShiftData()[
"EUR-EURIBOR-3M"] =
1525 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftParData>(cvsData);
1533 sensiData->indexCurveShiftData()[
"EUR-EURIBOR-6M"] =
1534 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftParData>(cvsData);
1542 sensiData->indexCurveShiftData()[
"USD-LIBOR-2W"] =
1543 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftParData>(cvsData);
1551 sensiData->indexCurveShiftData()[
"USD-LIBOR-1M"] =
1552 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftParData>(cvsData);
1560 sensiData->indexCurveShiftData()[
"USD-LIBOR-3M"] =
1561 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftParData>(cvsData);
1569 sensiData->indexCurveShiftData()[
"USD-LIBOR-6M"] =
1570 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftParData>(cvsData);
1578 sensiData->indexCurveShiftData()[
"GBP-LIBOR-2W"] =
1579 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftParData>(cvsData);
1587 sensiData->indexCurveShiftData()[
"GBP-LIBOR-1M"] =
1588 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftParData>(cvsData);
1596 sensiData->indexCurveShiftData()[
"GBP-LIBOR-3M"] =
1597 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftParData>(cvsData);
1605 sensiData->indexCurveShiftData()[
"GBP-LIBOR-6M"] =
1606 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftParData>(cvsData);
1615 sensiData->indexCurveShiftData()[
"JPY-TONAR"] =
1616 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftParData>(cvsData);
1625 sensiData->indexCurveShiftData()[
"JPY-LIBOR-2W"] =
1626 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftParData>(cvsData);
1635 sensiData->indexCurveShiftData()[
"JPY-LIBOR-1M"] =
1636 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftParData>(cvsData);
1645 sensiData->indexCurveShiftData()[
"JPY-LIBOR-3M"] =
1646 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftParData>(cvsData);
1655 sensiData->indexCurveShiftData()[
"JPY-LIBOR-6M"] =
1656 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftParData>(cvsData);
1666 sensiData->indexCurveShiftData()[
"CHF-LIBOR-6M"] =
1667 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftParData>(cvsData);
1669 sensiData->fxShiftData()[
"EURUSD"] = fxsData;
1670 sensiData->fxShiftData()[
"EURGBP"] = fxsData;
1671 sensiData->fxShiftData()[
"EURJPY"] = fxsData;
1672 sensiData->fxShiftData()[
"EURCHF"] = fxsData;
1674 sensiData->fxVolShiftData()[
"EURUSD"] = fxvsData;
1675 sensiData->fxVolShiftData()[
"EURGBP"] = fxvsData;
1676 sensiData->fxVolShiftData()[
"EURJPY"] = fxvsData;
1677 sensiData->fxVolShiftData()[
"EURCHF"] = fxvsData;
1679 sensiData->swaptionVolShiftData()[
"EUR"] = swvsData;
1680 sensiData->swaptionVolShiftData()[
"GBP"] = swvsData;
1681 sensiData->swaptionVolShiftData()[
"USD"] = swvsData;
1682 sensiData->swaptionVolShiftData()[
"JPY"] = swvsData;
1683 sensiData->swaptionVolShiftData()[
"CHF"] = swvsData;
1685 sensiData->capFloorVolShiftData()[
"EUR"] =
1686 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CapFloorVolShiftData>(cfvsData);
1687 sensiData->capFloorVolShiftData()[
"EUR"]->indexName =
"EUR-EURIBOR-6M";
1688 sensiData->capFloorVolShiftData()[
"USD"] =
1689 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CapFloorVolShiftData>(cfvsData);
1690 sensiData->capFloorVolShiftData()[
"USD"]->indexName =
"USD-LIBOR-6M";
1692 sensiData->creditCcys()[
"dc"] =
"USD";
1693 sensiData->creditCcys()[
"dc2"] =
"EUR";
1694 sensiData->creditCcys()[
"dc3"] =
"GBP";
1697 cvsData.
shiftTenors = {3 * Months, 6 * Months, 1 * Years, 2 * Years, 3 * Years,
1698 5 * Years, 10 * Years, 13 * Years, 15 * Years, 20 * Years};
1699 cvsData.
parInstruments = {
"CDS",
"CDS",
"CDS",
"CDS",
"CDS",
"CDS",
"CDS",
"CDS",
"CDS",
"CDS"};
1701 sensiData->creditCurveShiftData()[
"dc"] =
1702 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftParData>(cvsData);
1706 cvsData.
shiftTenors = {3 * Months, 6 * Months, 1 * Years, 2 * Years, 3 * Years,
1707 5 * Years, 10 * Years, 13 * Years, 15 * Years, 20 * Years};
1708 cvsData.
parInstruments = {
"CDS",
"CDS",
"CDS",
"CDS",
"CDS",
"CDS",
"CDS",
"CDS",
"CDS",
"CDS"};
1710 sensiData->creditCurveShiftData()[
"dc2"] =
1711 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftParData>(cvsData);
1715 cvsData.
shiftTenors = {3 * Months, 6 * Months, 1 * Years, 2 * Years, 3 * Years,
1716 5 * Years, 10 * Years, 13 * Years, 15 * Years, 20 * Years};
1717 cvsData.
parInstruments = {
"CDS",
"CDS",
"CDS",
"CDS",
"CDS",
"CDS",
"CDS",
"CDS",
"CDS",
"CDS"};
1719 sensiData->creditCurveShiftData()[
"dc3"] =
1720 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftParData>(cvsData);
1722 sensiData->cdsVolShiftData()[
"dc"] = cdsvsData;
1723 sensiData->cdsVolShiftData()[
"dc2"] = cdsvsData;
1724 sensiData->cdsVolShiftData()[
"dc3"] = cdsvsData;
1726 sensiData->equityShiftData()[
"SP5"] = eqsData;
1727 sensiData->equityShiftData()[
"Lufthansa"] = eqsData;
1729 sensiData->equityVolShiftData()[
"SP5"] = eqvsData;
1730 sensiData->equityVolShiftData()[
"Lufthansa"] = eqvsData;
1731 sensiData->dividendYieldShiftData()[
"SP5"] = eqdivData;
1732 sensiData->dividendYieldShiftData()[
"Lufthansa"] = eqdivData;
1734 sensiData->baseCorrelationShiftData()[
"Tranch1"] = bcorrData;
1736 sensiData->zeroInflationCurveShiftData()[
"UKRPI"] = zinfData;
1738 sensiData->yoyInflationCurveShiftData()[
"UKRPI"] = yinfData;
1741 sensiData->yoyInflationCapFloorVolShiftData()[
"UKRPI"] = yinfCfData;
1748 QuantLib::ext::shared_ptr<ore::analytics::ScenarioSimMarketParameters> simMarketData(
1750 simMarketData->baseCcy() =
"EUR";
1751 simMarketData->setDiscountCurveNames({
"EUR",
"GBP"});
1752 simMarketData->setYieldCurveNames({
"BondCurve0"});
1753 simMarketData->setYieldCurveTenors(
"", {1 * Months, 6 * Months, 1 * Years, 2 * Years, 3 * Years, 4 * Years,
1754 5 * Years, 6 * Years, 7 * Years, 8 * Years, 9 * Years, 10 * Years,
1755 12 * Years, 15 * Years, 20 * Years, 25 * Years, 30 * Years});
1756 simMarketData->setIndices({
"EUR-EURIBOR-6M",
"GBP-LIBOR-6M"});
1757 simMarketData->setDefaultNames({
"BondIssuer0"});
1758 simMarketData->setDefaultTenors(
1759 "", {6 * Months, 1 * Years, 2 * Years, 3 * Years, 5 * Years, 7 * Years, 10 * Years, 15 * Years, 20 * Years});
1760 simMarketData->setSecurities({
"Bond0"});
1761 simMarketData->setSimulateSurvivalProbabilities(
true);
1762 simMarketData->setDefaultCurveCalendars(
"",
"TARGET");
1763 simMarketData->interpolation() =
"LogLinear";
1765 simMarketData->setSwapVolTerms(
1766 "", {1 * Years, 2 * Years, 3 * Years, 4 * Years, 5 * Years, 7 * Years, 10 * Years, 20 * Years});
1767 simMarketData->setSwapVolExpiries(
1768 "", {6 * Months, 1 * Years, 2 * Years, 3 * Years, 5 * Years, 7 * Years, 10 * Years, 20 * Years});
1769 simMarketData->setSwapVolKeys({
"EUR",
"GBP"});
1770 simMarketData->swapVolDecayMode() =
"ForwardVariance";
1771 simMarketData->setSimulateSwapVols(
true);
1773 simMarketData->setFxVolExpiries(
"",
1774 vector<Period>{1 * Months, 3 * Months, 6 * Months, 2 * Years, 3 * Years, 4 * Years, 5 * Years});
1775 simMarketData->setFxVolDecayMode(
string(
"ConstantVariance"));
1776 simMarketData->setSimulateFXVols(
true);
1777 simMarketData->setFxVolCcyPairs({
"EURGBP"});
1778 simMarketData->setFxVolIsSurface(
true);
1779 simMarketData->setFxVolMoneyness(vector<Real>{0.1, 0.2, 0.3, 0.5, 1, 2, 3});
1781 simMarketData->setFxCcyPairs({
"EURGBP"});
1783 simMarketData->setSimulateCapFloorVols(
false);
1785 return simMarketData;
1789 QuantLib::ext::shared_ptr<ore::analytics::ScenarioSimMarketParameters> simMarketData(
1792 simMarketData->baseCcy() =
"EUR";
1793 simMarketData->setDiscountCurveNames({
"EUR",
"GBP",
"USD",
"CHF",
"JPY"});
1794 simMarketData->setYieldCurveTenors(
"", {1 * Months, 6 * Months, 1 * Years, 2 * Years, 3 * Years, 4 * Years,
1795 5 * Years, 7 * Years, 10 * Years, 15 * Years, 20 * Years, 30 * Years});
1796 simMarketData->setIndices(
1797 {
"EUR-EURIBOR-6M",
"USD-LIBOR-3M",
"USD-LIBOR-6M",
"GBP-LIBOR-6M",
"CHF-LIBOR-6M",
"JPY-LIBOR-6M"});
1798 simMarketData->swapIndices()[
"EUR-CMS-2Y"] =
"EUR-EURIBOR-6M";
1799 simMarketData->swapIndices()[
"EUR-CMS-30Y"] =
"EUR-EURIBOR-6M";
1801 simMarketData->setYieldCurveNames({
"BondCurve0"});
1802 simMarketData->interpolation() =
"LogLinear";
1804 simMarketData->setSwapVolTerms(
"", {1 * Years, 2 * Years, 3 * Years, 5 * Years, 7 * Years, 10 * Years, 20 * Years});
1805 simMarketData->setSwapVolExpiries(
1806 "", {6 * Months, 1 * Years, 2 * Years, 3 * Years, 5 * Years, 7 * Years, 10 * Years, 20 * Years});
1807 simMarketData->setSwapVolKeys({
"EUR",
"GBP",
"USD",
"CHF",
"JPY"});
1808 simMarketData->swapVolDecayMode() =
"ForwardVariance";
1809 simMarketData->setSimulateSwapVols(
true);
1811 simMarketData->setFxVolExpiries(
"",
1812 vector<Period>{1 * Months, 3 * Months, 6 * Months, 2 * Years, 3 * Years, 4 * Years, 5 * Years});
1813 simMarketData->setFxVolDecayMode(
string(
"ConstantVariance"));
1814 simMarketData->setSimulateFXVols(
true);
1815 simMarketData->setFxVolCcyPairs({
"EURUSD",
"EURGBP",
"EURCHF",
"EURJPY",
"GBPCHF"});
1816 simMarketData->setFxVolIsSurface(
true);
1817 simMarketData->setFxVolMoneyness(vector<Real>{0.1, 0.2, 0.3, 0.5, 1, 2, 3});
1819 simMarketData->setFxCcyPairs({
"EURUSD",
"EURGBP",
"EURCHF",
"EURJPY"});
1821 simMarketData->setSimulateCapFloorVols(
true);
1822 simMarketData->capFloorVolDecayMode() =
"ForwardVariance";
1823 simMarketData->setCapFloorVolKeys({
"EUR",
"USD"});
1824 simMarketData->setCapFloorVolExpiries(
1825 "", {6 * Months, 1 * Years, 2 * Years, 3 * Years, 5 * Years, 7 * Years, 10 * Years, 15 * Years, 20 * Years});
1826 simMarketData->setCapFloorVolStrikes(
"", {0.00, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06});
1828 simMarketData->setDefaultNames({
"BondIssuer0"});
1829 simMarketData->setDefaultTenors(
1830 "", {6 * Months, 1 * Years, 2 * Years, 3 * Years, 5 * Years, 7 * Years, 10 * Years, 15 * Years, 20 * Years});
1831 simMarketData->setSimulateSurvivalProbabilities(
true);
1832 simMarketData->setSecurities({
"Bond0"});
1833 simMarketData->setDefaultCurveCalendars(
"",
"TARGET");
1835 simMarketData->setEquityNames({
"SP5",
"Lufthansa"});
1836 simMarketData->setEquityDividendTenors(
"SP5", {6 * Months, 1 * Years, 2 * Years});
1837 simMarketData->setEquityDividendTenors(
"Lufthansa", {6 * Months, 1 * Years, 2 * Years});
1839 simMarketData->setSimulateEquityVols(
true);
1840 simMarketData->setEquityVolDecayMode(
"ForwardVariance");
1841 simMarketData->setEquityVolNames({
"SP5",
"Lufthansa"});
1842 simMarketData->setEquityVolExpiries(
"", {6 * Months, 1 * Years, 2 * Years, 3 * Years,
1843 5 * Years, 7 * Years, 10 * Years, 20 * Years});
1844 simMarketData->setEquityVolIsSurface(
"",
false);
1845 simMarketData->setSimulateEquityVolATMOnly(
true);
1846 simMarketData->setEquityVolMoneyness(
"", {1});
1848 simMarketData->setZeroInflationIndices({
"UKRPI"});
1849 simMarketData->setZeroInflationTenors(
1850 "UKRPI", {1 * Years, 2 * Years, 3 * Years, 5 * Years, 7 * Years, 10 * Years, 15 * Years, 20 * Years});
1851 simMarketData->setYoyInflationIndices({
"UKRPI"});
1852 simMarketData->setYoyInflationTenors(
1853 "UKRPI", {1 * Years, 2 * Years, 3 * Years, 5 * Years, 7 * Years, 10 * Years, 15 * Years, 20 * Years});
1855 simMarketData->setCommodityCurveSimulate(
true);
1856 simMarketData->setCommodityNames({
"COMDTY_GOLD_USD",
"COMDTY_WTI_USD"});
1857 simMarketData->setCommodityCurveTenors(
"", {0 * Days, 1 * Years, 2 * Years, 5 * Years});
1859 simMarketData->setCommodityVolSimulate(
true);
1860 simMarketData->commodityVolDecayMode() =
"ForwardVariance";
1861 simMarketData->setCommodityVolNames({
"COMDTY_GOLD_USD",
"COMDTY_WTI_USD"});
1862 simMarketData->commodityVolExpiries(
"COMDTY_GOLD_USD") = {1 * Years, 2 * Years, 5 * Years};
1863 simMarketData->commodityVolMoneyness(
"COMDTY_GOLD_USD") = {1.0};
1864 simMarketData->commodityVolExpiries(
"COMDTY_WTI_USD") = {1 * Years, 5 * Years};
1865 simMarketData->commodityVolMoneyness(
"COMDTY_WTI_USD") = {0.9, 0.95, 1.0, 1.05, 1.1};
1867 return simMarketData;
1871 QuantLib::ext::shared_ptr<ore::analytics::SensitivityScenarioData> sensiData =
1872 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData>();
1875 cvsData.
shiftTenors = {1 * Years, 2 * Years, 3 * Years, 5 * Years,
1876 7 * Years, 10 * Years, 15 * Years, 20 * Years};
1877 cvsData.
shiftType = ShiftType::Absolute;
1881 fxsData.
shiftType = ShiftType::Relative;
1885 fxvsData.
shiftType = ShiftType::Relative;
1890 cfvsData.
shiftType = ShiftType::Absolute;
1892 cfvsData.
shiftExpiries = {1 * Years, 2 * Years, 3 * Years, 5 * Years, 10 * Years};
1896 swvsData.
shiftType = ShiftType::Relative;
1898 swvsData.
shiftExpiries = {3 * Years, 5 * Years, 10 * Years};
1899 swvsData.
shiftTerms = {2 * Years, 5 * Years, 10 * Years};
1901 sensiData->discountCurveShiftData()[
"EUR"] =
1902 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftData>(cvsData);
1904 sensiData->discountCurveShiftData()[
"GBP"] =
1905 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftData>(cvsData);
1907 sensiData->indexCurveShiftData()[
"EUR-EURIBOR-6M"] =
1908 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftData>(cvsData);
1909 sensiData->indexCurveShiftData()[
"GBP-LIBOR-6M"] =
1910 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftData>(cvsData);
1912 sensiData->yieldCurveShiftData()[
"BondCurve0"] =
1913 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftData>(cvsData);
1915 sensiData->fxShiftData()[
"EURGBP"] = fxsData;
1917 sensiData->fxVolShiftData()[
"EURGBP"] = fxvsData;
1919 sensiData->swaptionVolShiftData()[
"EUR"] = swvsData;
1920 sensiData->swaptionVolShiftData()[
"GBP"] = swvsData;
1922 sensiData->creditCurveShiftData()[
"BondIssuer0"] =
1923 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftData>(cvsData);
1935 QuantLib::ext::shared_ptr<ore::analytics::SensitivityScenarioData> sensiData =
1936 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData>();
1941 cvsData.
shiftTenors = {1 * Years, 15 * Months, 18 * Months, 21 * Months, 27 * Months, 30 * Months, 33 * Months,
1942 42 * Months, 54 * Months, 5 * Years, 6 * Years, 7 * Years, 8 * Years, 9 * Years,
1943 10 * Years, 11 * Years, 12 * Years, 13 * Years, 14 * Years, 15 * Years, 16 * Years,
1944 17 * Years, 18 * Years, 19 * Years, 20 * Years};
1945 cvsData.
shiftType = ShiftType::Absolute;
1949 fxsData.
shiftType = ShiftType::Relative;
1953 fxvsData.
shiftType = ShiftType::Relative;
1958 cfvsData.
shiftType = ShiftType::Absolute;
1960 cfvsData.
shiftExpiries = {1 * Years, 2 * Years, 3 * Years, 5 * Years, 10 * Years};
1964 swvsData.
shiftType = ShiftType::Relative;
1966 swvsData.
shiftExpiries = {3 * Years, 5 * Years, 10 * Years};
1967 swvsData.
shiftTerms = {2 * Years, 5 * Years, 10 * Years};
1969 sensiData->discountCurveShiftData()[
"EUR"] =
1970 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftData>(cvsData);
1972 sensiData->discountCurveShiftData()[
"GBP"] =
1973 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftData>(cvsData);
1975 sensiData->indexCurveShiftData()[
"EUR-EURIBOR-6M"] =
1976 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftData>(cvsData);
1977 sensiData->indexCurveShiftData()[
"GBP-LIBOR-6M"] =
1978 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftData>(cvsData);
1980 sensiData->yieldCurveShiftData()[
"BondCurve0"] =
1981 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftData>(cvsData);
1983 sensiData->fxShiftData()[
"EURGBP"] = fxsData;
1985 sensiData->fxVolShiftData()[
"EURGBP"] = fxvsData;
1987 sensiData->swaptionVolShiftData()[
"EUR"] = swvsData;
1988 sensiData->swaptionVolShiftData()[
"GBP"] = swvsData;
1990 sensiData->creditCurveShiftData()[
"BondIssuer0"] =
1991 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftData>(cvsData);
2003 QuantLib::ext::shared_ptr<ore::analytics::SensitivityScenarioData> sensiData =
2004 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData>();
2007 cvsData.
shiftTenors = {6 * Months, 1 * Years, 2 * Years, 3 * Years, 5 * Years,
2008 7 * Years, 10 * Years, 15 * Years, 20 * Years};
2009 cvsData.
shiftType = ShiftType::Absolute;
2013 fxsData.
shiftType = ShiftType::Relative;
2017 fxvsData.
shiftType = ShiftType::Relative;
2022 cfvsData.
shiftType = ShiftType::Absolute;
2024 cfvsData.
shiftExpiries = {1 * Years, 2 * Years, 3 * Years, 5 * Years, 10 * Years};
2025 cfvsData.
shiftStrikes = {0.01, 0.02, 0.03, 0.04, 0.05};
2028 swvsData.
shiftType = ShiftType::Relative;
2030 swvsData.
shiftExpiries = {2 * Years, 5 * Years, 10 * Years};
2031 swvsData.
shiftTerms = {5 * Years, 10 * Years};
2034 eqsData.
shiftType = ShiftType::Relative;
2038 eqvsData.
shiftType = ShiftType::Relative;
2043 zinfData.
shiftType = ShiftType::Absolute;
2045 zinfData.
shiftTenors = {1 * Years, 2 * Years, 3 * Years, 5 * Years, 7 * Years, 10 * Years, 15 * Years, 20 * Years};
2047 auto commodityShiftData = QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftData>();
2048 commodityShiftData->shiftType = ShiftType::Relative;
2049 commodityShiftData->shiftSize = 0.01;
2050 commodityShiftData->shiftTenors = {0 * Days, 1 * Years, 2 * Years, 5 * Years};
2053 commodityVolShiftData.
shiftType = ShiftType::Relative;
2055 commodityVolShiftData.
shiftExpiries = {1 * Years, 2 * Years, 5 * Years};
2056 commodityVolShiftData.
shiftStrikes = {0.9, 0.95, 1.0, 1.05, 1.1};
2058 sensiData->discountCurveShiftData()[
"EUR"] =
2059 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftData>(cvsData);
2061 sensiData->discountCurveShiftData()[
"USD"] =
2062 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftData>(cvsData);
2064 sensiData->discountCurveShiftData()[
"GBP"] =
2065 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftData>(cvsData);
2067 sensiData->discountCurveShiftData()[
"JPY"] =
2068 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftData>(cvsData);
2070 sensiData->discountCurveShiftData()[
"CHF"] =
2071 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftData>(cvsData);
2073 sensiData->indexCurveShiftData()[
"EUR-EURIBOR-6M"] =
2074 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftData>(cvsData);
2076 sensiData->indexCurveShiftData()[
"USD-LIBOR-3M"] =
2077 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftData>(cvsData);
2079 sensiData->indexCurveShiftData()[
"GBP-LIBOR-6M"] =
2080 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftData>(cvsData);
2082 sensiData->indexCurveShiftData()[
"JPY-LIBOR-6M"] =
2083 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftData>(cvsData);
2085 sensiData->indexCurveShiftData()[
"CHF-LIBOR-6M"] =
2086 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftData>(cvsData);
2088 sensiData->yieldCurveShiftData()[
"BondCurve0"] =
2089 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftData>(cvsData);
2091 sensiData->creditCurveShiftData()[
"BondIssuer0"] =
2092 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftData>(cvsData);
2094 sensiData->fxShiftData()[
"EURUSD"] = fxsData;
2095 sensiData->fxShiftData()[
"EURGBP"] = fxsData;
2096 sensiData->fxShiftData()[
"EURJPY"] = fxsData;
2097 sensiData->fxShiftData()[
"EURCHF"] = fxsData;
2099 sensiData->fxVolShiftData()[
"EURUSD"] = fxvsData;
2100 sensiData->fxVolShiftData()[
"EURGBP"] = fxvsData;
2101 sensiData->fxVolShiftData()[
"EURJPY"] = fxvsData;
2102 sensiData->fxVolShiftData()[
"EURCHF"] = fxvsData;
2103 sensiData->fxVolShiftData()[
"GBPCHF"] = fxvsData;
2105 sensiData->swaptionVolShiftData()[
"EUR"] = swvsData;
2106 sensiData->swaptionVolShiftData()[
"GBP"] = swvsData;
2107 sensiData->swaptionVolShiftData()[
"USD"] = swvsData;
2108 sensiData->swaptionVolShiftData()[
"JPY"] = swvsData;
2109 sensiData->swaptionVolShiftData()[
"CHF"] = swvsData;
2111 sensiData->capFloorVolShiftData()[
"EUR"] =
2112 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CapFloorVolShiftData>(cfvsData);
2113 sensiData->capFloorVolShiftData()[
"EUR"]->indexName =
"EUR-EURIBOR-6M";
2114 sensiData->capFloorVolShiftData()[
"USD"] =
2115 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CapFloorVolShiftData>(cfvsData);
2116 sensiData->capFloorVolShiftData()[
"USD"]->indexName =
"USD-LIBOR-3M";
2118 sensiData->equityShiftData()[
"SP5"] = eqsData;
2119 sensiData->equityShiftData()[
"Lufthansa"] = eqsData;
2121 sensiData->equityVolShiftData()[
"SP5"] = eqvsData;
2122 sensiData->equityVolShiftData()[
"Lufthansa"] = eqvsData;
2124 sensiData->zeroInflationCurveShiftData()[
"UKRPI"] =
2125 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftData>(zinfData);
2127 sensiData->yoyInflationCurveShiftData()[
"UKRPI"] =
2128 QuantLib::ext::make_shared<ore::analytics::SensitivityScenarioData::CurveShiftData>(zinfData);
2130 sensiData->commodityCurveShiftData()[
"COMDTY_GOLD_USD"] = commodityShiftData;
2131 sensiData->commodityCurrencies()[
"COMDTY_GOLD_USD"] =
"USD";
2132 sensiData->commodityCurveShiftData()[
"COMDTY_WTI_USD"] = commodityShiftData;
2133 sensiData->commodityCurrencies()[
"COMDTY_WTI_USD"] =
"USD";
2135 sensiData->commodityVolShiftData()[
"COMDTY_GOLD_USD"] = commodityVolShiftData;
2136 sensiData->commodityVolShiftData()[
"COMDTY_WTI_USD"] = commodityVolShiftData;
ScenarioSimMarket description.
Handle< Quote > fxSpot(const string &ccypair, const string &configuration=Market::defaultConfiguration) const
static const string defaultConfiguration
Handle< YieldTermStructure > discountCurve(const string &ccy, const string &configuration=Market::defaultConfiguration) const
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< tuple< string, string, string >, Handle< QuantExt::CorrelationTermStructure > > correlationCurves_
map< pair< string, string >, QuantLib::Handle< QuantExt::EquityIndex2 > > equityCurves_
map< pair< string, string >, Handle< CPIVolatilitySurface > > cpiInflationCapFloorVolatilitySurfaces_
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 >, QuantLib::Handle< QuantExt::CommodityIndex > > commodityIndices_
map< pair< string, string >, Handle< QuantExt::CreditCurve > > defaultCurves_
map< pair< string, string >, Handle< IborIndex > > iborIndices_
map< pair< string, string >, Handle< YoYOptionletVolatilitySurface > > yoyCapFloorVolSurfaces_
map< pair< string, string >, Handle< YoYInflationIndex > > yoyInflationIndices_
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< QuantExt::BaseCorrelationTermStructure > > baseCorrelations_
map< pair< string, string >, Handle< Quote > > recoveryRates_
Handle< Quote > equitySpot(const string &eqName, const string &configuration=Market::defaultConfiguration) const override
map< pair< string, string >, Handle< ZeroInflationIndex > > zeroInflationIndices_
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
map< pair< string, string >, QuantLib::Handle< QuantLib::BlackVolTermStructure > > commodityVols_
void addSwapIndex(const string &swapindex, const string &discountIndex, const string &configuration=Market::defaultConfiguration) const
static QuantLib::ext::shared_ptr< ore::analytics::SensitivityScenarioData > setupSensitivityScenarioData(bool hasSwapVolCube=false, bool hasYYCapVols=false, bool parConversion=false)
SensitivityScenarioData instance.
static QuantLib::ext::shared_ptr< ore::analytics::ScenarioSimMarketParameters > setupSimMarketData2()
ScenarioSimMarketParameters instance, 2 currencies.
static QuantLib::ext::shared_ptr< ore::analytics::SensitivityScenarioData > setupSensitivityScenarioData2()
SensitivityScenarioData instance, 2 currencies.
static QuantLib::ext::shared_ptr< ore::analytics::SensitivityScenarioData > setupSensitivityScenarioData5()
SensitivityScenarioData instance, 5 currencies.
static void setConventions()
Set Conventions.
static QuantLib::ext::shared_ptr< ore::analytics::SensitivityScenarioData > setupSensitivityScenarioData2b()
SensitivityScenarioData instance, 2 currencies, shifts more granular than base curve.
static QuantLib::ext::shared_ptr< ore::analytics::ScenarioSimMarketParameters > setupSimMarketData(bool hasSwapVolCube=false, bool hasYYCapVols=false)
ScenarioSimMarketParameters instance.
static QuantLib::ext::shared_ptr< ore::analytics::ScenarioSimMarketParameters > setupSimMarketData5()
ScenarioSimMarketParameters instance, 5 currencies.
TestMarket(Date asof, bool swapVolCube=false)
Handle< YoYInflationIndex > makeYoYInflationIndex(string index, vector< Date > dates, vector< Rate > rates, QuantLib::ext::shared_ptr< YoYInflationIndex > ii, Handle< YieldTermStructure > yts)
Handle< CPICapFloorTermPriceSurface > flatRateCps(Handle< ZeroInflationIndex > infIndex, const std::vector< Rate > cStrikes, std::vector< Rate > fStrikes, std::vector< Period > cfMaturities, Matrix cPrice, Matrix fPrice)
Handle< YoYInflationTermStructure > flatYoYInflationCurve(Real inflationRate, Rate nominalRate)
Handle< YoYOptionletVolatilitySurface > flatYoYOptionletVolatilitySurface(Real normalVol)
Handle< OptionletVolatilityStructure > flatRateCvs(Volatility vol, VolatilityType type=Normal, Real shift=0.0)
Handle< ZeroInflationIndex > makeZeroInflationIndex(string index, vector< Date > dates, vector< Rate > rates, QuantLib::ext::shared_ptr< ZeroInflationIndex > ii, Handle< YieldTermStructure > yts)
Handle< QuantLib::CPIVolatilitySurface > flatCpiVolSurface(Volatility v)
Handle< QuantExt::CreditCurve > flatRateDcs(Volatility forward)
Handle< QuantExt::CorrelationTermStructure > flatCorrelation(Real correlation=0.0)
Handle< ZeroInflationTermStructure > flatZeroInflationCurve(Real inflationRate, Rate nominalRate)
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)
map< string, vector< Period > > swaptionVolRateHelperSwapTenorsMap_
map< string, vector< Handle< Quote > > > discountRateHelperValuesMap_
void createIborIndex(const string &idxName, const vector< string > &parInst, const vector< Period > &parTenor, const vector< Real > &parRates, bool singleCurve)
map< string, vector< string > > baseCorrLossLevelsMap_
map< string, vector< Handle< Quote > > > defaultRateHelperValuesMap_
map< string, vector< Handle< Quote > > > baseCorrRateHelperValuesMap_
map< string, vector< Period > > equityVolRateHelperTenorsMap_
map< string, vector< Period > > zeroInflationRateHelperTenorsMap_
map< string, vector< Handle< Quote > > > zeroInflationRateHelperValuesMap_
void createDiscountCurve(const string &ccy, const vector< string > &parInst, const vector< Period > &parTenor, const vector< Real > &parRates)
map< string, vector< QuantLib::ext::shared_ptr< QuantExt::DefaultProbabilityHelper > > > defaultRateHelpersMap_
map< string, vector< string > > indexCurveRateHelperInstMap_
map< string, vector< Handle< Quote > > > indexCurveRateHelperValuesMap_
map< string, vector< Period > > baseCorrRateHelperTenorsMap_
map< string, vector< string > > discountRateHelperInstMap_
map< string, vector< Period > > swaptionVolRateHelperTenorsMap_
Handle< OptionletVolatilityStructure > flatRateCvs(Volatility vol, VolatilityType type=Normal, Real shift=0.0)
void createCdsVolCurve(const string &name, const vector< Period > &parTenor, const vector< Real > &parRates)
void createXccyDiscountCurve(const string &ccy, const string &baseCcy, const vector< string > &parInst, const vector< Period > &parTenor, const vector< Real > &parRates)
map< string, vector< Period > > cdsVolRateHelperTenorsMap_
map< string, vector< QuantLib::ext::shared_ptr< RateHelper > > > discountRateHelpersMap_
Handle< YieldTermStructure > flatRateYts(Real forward)
TestMarketParCurves(const Date &asof)
map< string, vector< string > > zeroInflationRateHelperInstMap_
map< string, vector< Period > > defaultRateHelperTenorsMap_
map< string, vector< Period > > discountRateHelperTenorsMap_
map< string, vector< string > > defaultRateHelperInstMap_
void createEquityVolCurve(const string &name, const string &ccy, const vector< Period > &parTenor, const vector< Real > &parRates)
Handle< DefaultProbabilityTermStructure > flatRateDcs(Volatility forward)
map< string, vector< QuantLib::ext::shared_ptr< RateHelper > > > indexCurveRateHelpersMap_
map< string, vector< Handle< Quote > > > equityVolRateHelperValuesMap_
void createBaseCorrel(const string &name, const vector< Period > &tenors, const vector< string > &lossLevel, const vector< Real > quotes)
map< string, vector< Period > > indexCurveRateHelperTenorsMap_
void createYoYInflationIndex(const string &idxName, const vector< string > &parInst, const vector< Period > &parTenor, const vector< Real > &parRates, bool singleCurve)
Handle< BlackVolTermStructure > flatRateFxv(Volatility forward)
map< string, vector< Period > > yoyInflationRateHelperTenorsMap_
map< string, vector< Handle< Quote > > > cdsVolRateHelperValuesMap_
map< string, vector< string > > yoyInflationRateHelperInstMap_
void createDefaultCurve(const string &name, const string &ccy, const vector< string > &parInst, const vector< Period > &parTenor, const vector< Real > &parRates)
Handle< QuantLib::SwaptionVolatilityStructure > flatRateSvs(Volatility forward, VolatilityType type=ShiftedLognormal, Real shift=0.0)
void createSwaptionVolCurve(const string &name, const vector< Period > &optionTenors, const vector< Period > &swapTenors, const vector< Real > &strikeSpreads, const vector< Real > &parRates)
map< string, vector< Handle< Quote > > > yoyInflationRateHelperValuesMap_
void createZeroInflationIndex(const string &idxName, const vector< string > &parInst, const vector< Period > &parTenor, const vector< Real > &parRates, bool singleCurve)
map< string, vector< Handle< Quote > > > swaptionVolRateHelperValuesMap_
QuantLib::ext::shared_ptr< ZeroInflationIndex > parseZeroInflationIndex(const string &s, const Handle< ZeroInflationTermStructure > &h=Handle< ZeroInflationTermStructure >())
Calendar parseCalendar(const string &s)
QuantLib::ext::shared_ptr< IborIndex > parseIborIndex(const string &s, const Handle< YieldTermStructure > &h=Handle< YieldTermStructure >())
Currency parseCurrency(const string &s)
Real parseReal(const string &s)
Filter close_enough(const RandomVariable &x, const RandomVariable &y)
ore::analytics::SensitivityScenarioData::CurveShiftParData createCurveData()
A class to hold the parametrisation for building sensitivity scenarios.
vector< Period > shiftTerms
vector< Real > shiftLossLevels
vector< Period > shiftExpiries
vector< Period > shiftTenors
map< string, string > parInstrumentConventions
bool parInstrumentSingleCurve
vector< string > parInstruments
vector< Period > shiftTerms
vector< Real > shiftStrikes
vector< Period > shiftExpiries