Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | List of all members
OredTestMarket Class Reference

Simple flat market setup to be used in the test suite, plain copy from OREAP test suite. More...

#include <test/oredtestmarket.hpp>

+ Inheritance diagram for OredTestMarket:
+ Collaboration diagram for OredTestMarket:

Public Member Functions

 OredTestMarket (Date asof, bool swapVolCube=false)
 
- Public Member Functions inherited from MarketImpl
 MarketImpl (const bool handlePseudoCurrencies)
 
Date asofDate () const override
 Get the asof Date. More...
 
Handle< YieldTermStructure > yieldCurve (const YieldCurveType &type, const string &ccy, const string &configuration=Market::defaultConfiguration) const override
 Yield Curves. More...
 
Handle< YieldTermStructure > discountCurveImpl (const string &ccy, const string &configuration=Market::defaultConfiguration) const override
 
Handle< YieldTermStructure > yieldCurve (const string &name, const string &configuration=Market::defaultConfiguration) const override
 
Handle< IborIndexiborIndex (const string &indexName, const string &configuration=Market::defaultConfiguration) const override
 
Handle< SwapIndex > swapIndex (const string &indexName, const string &configuration=Market::defaultConfiguration) const override
 
Handle< QuantLib::SwaptionVolatilityStructure > swaptionVol (const string &key, const string &configuration=Market::defaultConfiguration) const override
 Swaptions. More...
 
string shortSwapIndexBase (const string &key, const string &configuration=Market::defaultConfiguration) const override
 
string swapIndexBase (const string &key, const string &configuration=Market::defaultConfiguration) const override
 
Handle< QuantLib::SwaptionVolatilityStructure > yieldVol (const string &securityID, const string &configuration=Market::defaultConfiguration) const override
 Yield volatility. More...
 
QuantLib::Handle< QuantExt::FxIndexfxIndexImpl (const string &fxIndex, const string &configuration=Market::defaultConfiguration) const override
 FX. More...
 
Handle< Quote > fxRateImpl (const string &ccypair, const string &configuration=Market::defaultConfiguration) const override
 
Handle< Quote > fxSpotImpl (const string &ccypair, const string &configuration=Market::defaultConfiguration) const override
 
Handle< BlackVolTermStructurefxVolImpl (const string &ccypair, const string &configuration=Market::defaultConfiguration) const override
 
Handle< QuantExt::CreditCurvedefaultCurve (const string &, const string &configuration=Market::defaultConfiguration) const override
 Default Curves and Recovery Rates. More...
 
Handle< Quote > recoveryRate (const string &, const string &configuration=Market::defaultConfiguration) const override
 
Handle< QuantExt::CreditVolCurvecdsVol (const string &name, const string &configuration=Market::defaultConfiguration) const override
 CDS volatilities. More...
 
Handle< QuantExt::BaseCorrelationTermStructurebaseCorrelation (const string &name, const string &configuration=Market::defaultConfiguration) const override
 Base correlation structures. More...
 
Handle< OptionletVolatilityStructure > capFloorVol (const string &key, const string &configuration=Market::defaultConfiguration) const override
 CapFloor volatilities. More...
 
std::pair< string, QuantLib::Period > capFloorVolIndexBase (const string &key, const string &configuration=Market::defaultConfiguration) const override
 
Handle< QuantExt::YoYOptionletVolatilitySurface > yoyCapFloorVol (const string &name, const string &configuration=Market::defaultConfiguration) const override
 YoY Inflation CapFloor volatilities. More...
 
virtual Handle< ZeroInflationIndex > zeroInflationIndex (const string &indexName, const string &configuration=Market::defaultConfiguration) const override
 Inflation Indexes. More...
 
virtual Handle< YoYInflationIndex > yoyInflationIndex (const string &indexName, const string &configuration=Market::defaultConfiguration) const override
 
virtual Handle< CPIVolatilitySurfacecpiInflationCapFloorVolatilitySurface (const string &indexName, const string &configuration=Market::defaultConfiguration) const override
 Inflation Cap Floor Volatility Surfaces. More...
 
Handle< Quote > equitySpot (const string &eqName, const string &configuration=Market::defaultConfiguration) const override
 Equity curves. More...
 
Handle< QuantExt::EquityIndex2equityCurve (const string &eqName, const string &configuration=Market::defaultConfiguration) const override
 
Handle< YieldTermStructure > equityDividendCurve (const string &eqName, const string &configuration=Market::defaultConfiguration) const override
 
Handle< BlackVolTermStructureequityVol (const string &eqName, const string &configuration=Market::defaultConfiguration) const override
 Equity volatilities. More...
 
Handle< YieldTermStructure > equityForecastCurve (const string &eqName, const string &configuration=Market::defaultConfiguration) const override
 Equity forecasting curves. More...
 
Handle< Quote > securitySpread (const string &securityID, const string &configuration=Market::defaultConfiguration) const override
 Bond Spreads. More...
 
Handle< QuantExt::InflationIndexObserverbaseCpis (const string &index, const string &configuration=Market::defaultConfiguration) const
 Cpi Base Quotes. More...
 
QuantLib::Handle< QuantExt::PriceTermStructurecommodityPriceCurve (const string &commodityName, const string &configuration=Market::defaultConfiguration) const override
 Commodity curves. More...
 
QuantLib::Handle< QuantExt::CommodityIndexcommodityIndex (const std::string &commodityName, const std::string &configuration=Market::defaultConfiguration) const override
 Commodity index. More...
 
QuantLib::Handle< QuantLib::BlackVolTermStructure > commodityVolatility (const string &commodityName, const string &configuration=Market::defaultConfiguration) const override
 Commodity volatility. More...
 
Handle< QuantExt::CorrelationTermStructurecorrelationCurve (const string &index1, const string &index2, const string &configuration=Market::defaultConfiguration) const override
 Correlation curves. More...
 
QuantLib::Handle< Quote > cpr (const string &securityID, const string &configuration=Market::defaultConfiguration) const override
 
 MarketImpl (const MarketImpl &)=delete
 
MarketImploperator= (const MarketImpl &)=delete
 
void refresh (const string &configuration=Market::defaultConfiguration) override
 Send an explicit update() call to all term structures. More...
 
- Public Member Functions inherited from Market
 Market (const bool handlePseudoCurrencies)
 Constructor. More...
 
virtual ~Market ()
 Destructor. More...
 
virtual Date asofDate () const =0
 Get the asof Date. More...
 
Handle< YieldTermStructure > discountCurve (const string &ccy, const string &configuration=Market::defaultConfiguration) const
 
QuantLib::Handle< QuantExt::FxIndexfxIndex (const string &fxIndex, const string &configuration=Market::defaultConfiguration) const
 
Handle< Quote > fxRate (const string &ccypair, const string &configuration=Market::defaultConfiguration) const
 
Handle< Quote > fxSpot (const string &ccypair, const string &configuration=Market::defaultConfiguration) const
 
Handle< BlackVolTermStructurefxVol (const string &ccypair, const string &configuration=Market::defaultConfiguration) const
 
string commodityCurveLookup (const string &pm) const
 
bool handlePseudoCurrencies () const
 

Private Member Functions

Handle< YieldTermStructure > flatRateYts (Real forward)
 
Handle< BlackVolTermStructureflatRateFxv (Volatility forward)
 
Handle< YieldTermStructure > flatRateDiv (Real dividend)
 
Handle< QuantLib::SwaptionVolatilityStructure > flatRateSvs (Volatility forward, VolatilityType type=ShiftedLognormal, Real shift=0.0)
 
Handle< QuantExt::CreditCurveflatRateDcs (Volatility forward)
 
Handle< OptionletVolatilityStructure > flatRateCvs (Volatility vol, VolatilityType type=Normal, Real shift=0.0)
 

Additional Inherited Members

- Static Public Attributes inherited from Market
static const string defaultConfiguration = "default"
 Default configuration label. More...
 
static const string inCcyConfiguration = "inccy"
 InCcy configuration label. More...
 
- Protected Member Functions inherited from MarketImpl
virtual void require (const MarketObject o, const string &name, const string &configuration, const bool forceBuild=false) const
 
void addSwapIndex (const string &swapindex, const string &discountIndex, const string &configuration=Market::defaultConfiguration) const
 add a swap index to the market More...
 
- Protected Attributes inherited from MarketImpl
Date asof_
 
QuantLib::ext::shared_ptr< FXTriangulationfx_
 
map< tuple< string, YieldCurveType, string >, Handle< YieldTermStructure > > yieldCurves_
 
map< pair< string, string >, Handle< IborIndex > > iborIndices_
 
map< pair< string, string >, Handle< SwapIndex > > swapIndices_
 
map< pair< string, string >, Handle< QuantLib::SwaptionVolatilityStructure > > swaptionCurves_
 
map< pair< string, string >, pair< string, string > > swaptionIndexBases_
 
map< pair< string, string >, Handle< QuantLib::SwaptionVolatilityStructure > > yieldVolCurves_
 
map< pair< string, string >, Handle< BlackVolTermStructure > > fxVols_
 
map< pair< string, string >, Handle< QuantExt::CreditCurve > > defaultCurves_
 
map< pair< string, string >, Handle< QuantExt::CreditVolCurve > > cdsVols_
 
map< pair< string, string >, Handle< QuantExt::BaseCorrelationTermStructure > > baseCorrelations_
 
map< pair< string, string >, Handle< Quote > > recoveryRates_
 
map< pair< string, string >, Handle< OptionletVolatilityStructure > > capFloorCurves_
 
map< pair< string, string >, std::pair< string, QuantLib::Period > > capFloorIndexBase_
 
map< pair< string, string >, Handle< YoYOptionletVolatilitySurface > > yoyCapFloorVolSurfaces_
 
map< pair< string, string >, Handle< ZeroInflationIndex > > zeroInflationIndices_
 
map< pair< string, string >, Handle< YoYInflationIndex > > yoyInflationIndices_
 
map< pair< string, string >, Handle< CPIVolatilitySurface > > cpiInflationCapFloorVolatilitySurfaces_
 
map< pair< string, string >, Handle< Quote > > equitySpots_
 
map< pair< string, string >, Handle< BlackVolTermStructure > > equityVols_
 
map< pair< string, string >, Handle< Quote > > securitySpreads_
 
map< pair< string, string >, Handle< QuantExt::InflationIndexObserver > > baseCpis_
 
map< tuple< string, string, string >, Handle< QuantExt::CorrelationTermStructure > > correlationCurves_
 
map< pair< string, string >, QuantLib::Handle< QuantExt::CommodityIndex > > commodityIndices_
 
map< pair< string, string >, QuantLib::Handle< QuantLib::BlackVolTermStructure > > commodityVols_
 
map< pair< string, string >, QuantLib::Handle< QuantExt::EquityIndex2 > > equityCurves_
 
map< pair< string, string >, Handle< Quote > > cprs_
 
map< string, std::set< QuantLib::ext::shared_ptr< TermStructure > > > refreshTs_
 
- Protected Attributes inherited from Market
bool handlePseudoCurrencies_ = false
 

Detailed Description

Simple flat market setup to be used in the test suite, plain copy from OREAP test suite.

Definition at line 46 of file oredtestmarket.hpp.

Constructor & Destructor Documentation

◆ OredTestMarket()

OredTestMarket ( Date  asof,
bool  swapVolCube = false 
)

Definition at line 47 of file oredtestmarket.cpp.

47 : MarketImpl(false) {
48 asof_ = asof;
49
50 QuantLib::ext::shared_ptr<Conventions> conventions = QuantLib::ext::make_shared<Conventions>();
51
52 // add conventions
53 QuantLib::ext::shared_ptr<ore::data::Convention> swapIndexEURConv(
54 new ore::data::SwapIndexConvention("EUR-CMS-2Y", "EUR-6M-SWAP-CONVENTIONS"));
55 QuantLib::ext::shared_ptr<ore::data::Convention> swapIndexEURLongConv(
56 new ore::data::SwapIndexConvention("EUR-CMS-30Y", "EUR-6M-SWAP-CONVENTIONS"));
57 QuantLib::ext::shared_ptr<ore::data::Convention> swapIndexUSDConv(
58 new ore::data::SwapIndexConvention("USD-CMS-2Y", "USD-3M-SWAP-CONVENTIONS"));
59 QuantLib::ext::shared_ptr<ore::data::Convention> swapIndexUSDLongConv(
60 new ore::data::SwapIndexConvention("USD-CMS-30Y", "USD-3M-SWAP-CONVENTIONS"));
61 QuantLib::ext::shared_ptr<ore::data::Convention> swapIndexGBPConv(
62 new ore::data::SwapIndexConvention("GBP-CMS-2Y", "GBP-3M-SWAP-CONVENTIONS"));
63 QuantLib::ext::shared_ptr<ore::data::Convention> swapIndexGBPLongConv(
64 new ore::data::SwapIndexConvention("GBP-CMS-30Y", "GBP-6M-SWAP-CONVENTIONS"));
65 QuantLib::ext::shared_ptr<ore::data::Convention> swapIndexCHFConv(
66 new ore::data::SwapIndexConvention("CHF-CMS-2Y", "CHF-3M-SWAP-CONVENTIONS"));
67 QuantLib::ext::shared_ptr<ore::data::Convention> swapIndexCHFLongConv(
68 new ore::data::SwapIndexConvention("CHF-CMS-30Y", "CHF-6M-SWAP-CONVENTIONS"));
69 QuantLib::ext::shared_ptr<ore::data::Convention> swapIndexJPYConv(
70 new ore::data::SwapIndexConvention("JPY-CMS-2Y", "JPY-LIBOR-6M-SWAP-CONVENTIONS"));
71 QuantLib::ext::shared_ptr<ore::data::Convention> swapIndexJPYLongConv(
72 new ore::data::SwapIndexConvention("JPY-CMS-30Y", "JPY-LIBOR-6M-SWAP-CONVENTIONS"));
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
85 QuantLib::ext::shared_ptr<ore::data::Convention> swapEURConv(new ore::data::IRSwapConvention(
86 "EUR-6M-SWAP-CONVENTIONS", "TARGET", "Annual", "MF", "30/360", "EUR-EURIBOR-6M"));
87 QuantLib::ext::shared_ptr<ore::data::Convention> swapUSDConv(
88 new ore::data::IRSwapConvention("USD-3M-SWAP-CONVENTIONS", "US", "Semiannual", "MF", "30/360", "USD-LIBOR-3M"));
89 QuantLib::ext::shared_ptr<ore::data::Convention> swapGBPConv(
90 new ore::data::IRSwapConvention("GBP-3M-SWAP-CONVENTIONS", "UK", "Semiannual", "MF", "A365", "GBP-LIBOR-3M"));
91 QuantLib::ext::shared_ptr<ore::data::Convention> swapGBPLongConv(
92 new ore::data::IRSwapConvention("GBP-6M-SWAP-CONVENTIONS", "UK", "Semiannual", "MF", "A365", "GBP-LIBOR-6M"));
93 QuantLib::ext::shared_ptr<ore::data::Convention> swapCHFConv(
94 new ore::data::IRSwapConvention("CHF-3M-SWAP-CONVENTIONS", "ZUB", "Annual", "MF", "30/360", "CHF-LIBOR-3M"));
95 QuantLib::ext::shared_ptr<ore::data::Convention> swapCHFLongConv(
96 new ore::data::IRSwapConvention("CHF-6M-SWAP-CONVENTIONS", "ZUB", "Annual", "MF", "30/360", "CHF-LIBOR-6M"));
97 QuantLib::ext::shared_ptr<ore::data::Convention> swapJPYConv(new ore::data::IRSwapConvention(
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 // build discount
111 yieldCurves_[make_tuple(Market::defaultConfiguration, YieldCurveType::Discount, "EUR")] = flatRateYts(0.02);
112 yieldCurves_[make_tuple(Market::defaultConfiguration, YieldCurveType::Discount, "USD")] = flatRateYts(0.03);
113 yieldCurves_[make_tuple(Market::defaultConfiguration, YieldCurveType::Discount, "GBP")] = flatRateYts(0.04);
114 yieldCurves_[make_tuple(Market::defaultConfiguration, YieldCurveType::Discount, "CHF")] = flatRateYts(0.01);
115 yieldCurves_[make_tuple(Market::defaultConfiguration, YieldCurveType::Discount, "JPY")] = flatRateYts(0.005);
116 yieldCurves_[make_tuple(Market::defaultConfiguration, YieldCurveType::Discount, "CAD")] = flatRateYts(0.005);
117 yieldCurves_[make_tuple(Market::defaultConfiguration, YieldCurveType::Discount, "SEK")] = flatRateYts(0.005);
118
119 // build ibor indices
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) {
128 Handle<IborIndex> h(parseIborIndex(id.first, flatRateYts(id.second)));
129 iborIndices_[make_pair(Market::defaultConfiguration, id.first)] = h;
130
131 // set up dummy fixings for the past 400 days
132 for (Date d = asof - 400; d < asof; d++) {
133 if (h->isValidFixingDate(d))
134 h->addFixing(d, 0.01);
135 }
136 }
137
138 // swap index
139 addSwapIndex("EUR-CMS-2Y", "EUR-EONIA", Market::defaultConfiguration);
140 addSwapIndex("EUR-CMS-30Y", "EUR-EONIA", Market::defaultConfiguration);
141 addSwapIndex("USD-CMS-2Y", "USD-FedFunds", Market::defaultConfiguration);
142 addSwapIndex("USD-CMS-30Y", "USD-FedFunds", Market::defaultConfiguration);
143 addSwapIndex("GBP-CMS-2Y", "GBP-SONIA", Market::defaultConfiguration);
144 addSwapIndex("GBP-CMS-30Y", "GBP-SONIA", Market::defaultConfiguration);
145 addSwapIndex("CHF-CMS-2Y", "CHF-LIBOR-6M", Market::defaultConfiguration);
146 addSwapIndex("CHF-CMS-30Y", "CHF-LIBOR-6M", Market::defaultConfiguration);
147 addSwapIndex("JPY-CMS-2Y", "JPY-LIBOR-6M", Market::defaultConfiguration);
148 addSwapIndex("JPY-CMS-30Y", "JPY-LIBOR-6M", Market::defaultConfiguration);
149
150 // add fx rates
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 // build fx vols
161 fxVols_[make_pair(Market::defaultConfiguration, "EURUSD")] = flatRateFxv(0.12);
162 fxVols_[make_pair(Market::defaultConfiguration, "EURGBP")] = flatRateFxv(0.15);
163 fxVols_[make_pair(Market::defaultConfiguration, "EURCHF")] = flatRateFxv(0.15);
164 fxVols_[make_pair(Market::defaultConfiguration, "EURJPY")] = flatRateFxv(0.15);
165 fxVols_[make_pair(Market::defaultConfiguration, "GBPCHF")] = flatRateFxv(0.15);
166 // Add Equity Spots
167 equitySpots_[make_pair(Market::defaultConfiguration, "SP5")] =
168 Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(2147.56));
169 equitySpots_[make_pair(Market::defaultConfiguration, "Lufthansa")] =
170 Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(12.75));
171
172 equityVols_[make_pair(Market::defaultConfiguration, "SP5")] = flatRateFxv(0.2514);
173 equityVols_[make_pair(Market::defaultConfiguration, "Lufthansa")] = flatRateFxv(0.30);
174
175 yieldCurves_[make_tuple(Market::defaultConfiguration, YieldCurveType::EquityDividend, "SP5")] = flatRateDiv(0.01);
176 yieldCurves_[make_tuple(Market::defaultConfiguration, YieldCurveType::EquityDividend, "Lufthansa")] =
177 flatRateDiv(0.0);
178
179 equityCurves_[make_pair(Market::defaultConfiguration, "SP5")] = Handle<EquityIndex2>(QuantLib::ext::make_shared<EquityIndex2>(
180 "SP5", UnitedStates(UnitedStates::Settlement), parseCurrency("USD"), equitySpot("SP5"), yieldCurve(YieldCurveType::Discount, "USD"),
181 yieldCurve(YieldCurveType::EquityDividend, "SP5")));
182 equityCurves_[make_pair(Market::defaultConfiguration, "Lufthansa")] =
183 Handle<EquityIndex2>(QuantLib::ext::make_shared<EquityIndex2>(
184 "Lufthansa", TARGET(), parseCurrency("EUR"), equitySpot("Lufthansa"),
185 yieldCurve(YieldCurveType::Discount, "EUR"), yieldCurve(YieldCurveType::EquityDividend, "Lufthansa")));
186
187 swaptionIndexBases_[make_pair(Market::defaultConfiguration, "EUR")] = std::make_pair("EUR-CMS-2Y", "EUR-CMS-30Y");
188 swaptionIndexBases_[make_pair(Market::defaultConfiguration, "USD")] = std::make_pair("USD-CMS-2Y", "USD-CMS-30Y");
189 swaptionIndexBases_[make_pair(Market::defaultConfiguration, "GBP")] = std::make_pair("GBP-CMS-2Y", "GBP-CMS-30Y");
190 swaptionIndexBases_[make_pair(Market::defaultConfiguration, "CHF")] = std::make_pair("CHF-CMS-2Y", "CHF-CMS-30Y");
191 swaptionIndexBases_[make_pair(Market::defaultConfiguration, "JPY")] = std::make_pair("JPY-CMS-2Y", "JPY-CMS-30Y");
192
193 // build swaption vols
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) {
219 Handle<SwapIndex> si = swapIndex(swapIndexBase(name));
220 Handle<SwapIndex> ssi = swapIndex(shortSwapIndexBase(name));
221
222 QuantLib::ext::shared_ptr<SwaptionVolatilityCube> tmp(new QuantExt::SwaptionVolCube2(
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 // build cap/floor vol structures
240 capFloorCurves_[make_pair(Market::defaultConfiguration, "EUR")] = flatRateCvs(0.0050, Normal);
241 capFloorCurves_[make_pair(Market::defaultConfiguration, "USD")] = flatRateCvs(0.0060, Normal);
242 capFloorCurves_[make_pair(Market::defaultConfiguration, "GBP")] = flatRateCvs(0.0055, Normal);
243 capFloorCurves_[make_pair(Market::defaultConfiguration, "CHF")] = flatRateCvs(0.0045, Normal);
244 capFloorCurves_[make_pair(Market::defaultConfiguration, "JPY")] = flatRateCvs(0.0040, Normal);
245
246 // build default curves
249 defaultCurves_[make_pair(Market::defaultConfiguration, "BondIssuer1")] = flatRateDcs(0.0);
250
251 recoveryRates_[make_pair(Market::defaultConfiguration, "dc")] = Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(0.4));
253 Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(0.4));
254 recoveryRates_[make_pair(Market::defaultConfiguration, "BondIssuer1")] =
255 Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(0.4));
256
257 yieldCurves_[make_tuple(Market::defaultConfiguration, YieldCurveType::Yield, "BondCurve1")] = flatRateYts(0.05);
258
260 Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(0.0));
261
262 cdsVols_[make_pair(Market::defaultConfiguration, "dc")] =
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.
Definition: market.hpp:296
Market Implementation.
Definition: marketimpl.hpp:53
map< pair< string, string >, Handle< OptionletVolatilityStructure > > capFloorCurves_
Definition: marketimpl.hpp:219
string shortSwapIndexBase(const string &key, const string &configuration=Market::defaultConfiguration) const override
Definition: marketimpl.cpp:184
string swapIndexBase(const string &key, const string &configuration=Market::defaultConfiguration) const override
Definition: marketimpl.cpp:188
map< pair< string, string >, QuantLib::Handle< QuantExt::EquityIndex2 > > equityCurves_
Definition: marketimpl.hpp:232
map< pair< string, string >, Handle< BlackVolTermStructure > > fxVols_
Definition: marketimpl.hpp:214
QuantLib::ext::shared_ptr< FXTriangulation > fx_
Definition: marketimpl.hpp:206
map< tuple< string, YieldCurveType, string >, Handle< YieldTermStructure > > yieldCurves_
Definition: marketimpl.hpp:208
map< pair< string, string >, Handle< QuantExt::CreditCurve > > defaultCurves_
Definition: marketimpl.hpp:215
map< pair< string, string >, Handle< IborIndex > > iborIndices_
Definition: marketimpl.hpp:209
map< pair< string, string >, Handle< QuantExt::CreditVolCurve > > cdsVols_
Definition: marketimpl.hpp:216
map< pair< string, string >, Handle< Quote > > equitySpots_
Definition: marketimpl.hpp:225
map< pair< string, string >, Handle< QuantLib::SwaptionVolatilityStructure > > swaptionCurves_
Definition: marketimpl.hpp:211
map< pair< string, string >, Handle< Quote > > recoveryRates_
Definition: marketimpl.hpp:218
Handle< Quote > equitySpot(const string &eqName, const string &configuration=Market::defaultConfiguration) const override
Equity curves.
Definition: marketimpl.cpp:359
Handle< SwapIndex > swapIndex(const string &indexName, const string &configuration=Market::defaultConfiguration) const override
Definition: marketimpl.cpp:112
map< pair< string, string >, pair< string, string > > swaptionIndexBases_
Definition: marketimpl.hpp:212
map< pair< string, string >, Handle< BlackVolTermStructure > > equityVols_
Definition: marketimpl.hpp:226
map< pair< string, string >, Handle< Quote > > securitySpreads_
Definition: marketimpl.hpp:227
Handle< YieldTermStructure > yieldCurve(const YieldCurveType &type, const string &ccy, const string &configuration=Market::defaultConfiguration) const override
Yield Curves.
Definition: marketimpl.cpp:74
void addSwapIndex(const string &swapindex, const string &discountIndex, const string &configuration=Market::defaultConfiguration) const
add a swap index to the market
Definition: marketimpl.cpp:473
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.
Definition: parsers.cpp:290
string name
+ Here is the call graph for this function:

Member Function Documentation

◆ flatRateYts()

Handle< YieldTermStructure > flatRateYts ( Real  forward)
private

Definition at line 266 of file oredtestmarket.cpp.

266 {
267 QuantLib::ext::shared_ptr<YieldTermStructure> yts(
268 new FlatForward(Settings::instance().evaluationDate(), forward, ActualActual(ActualActual::ISDA)));
269 return Handle<YieldTermStructure>(yts);
270}
+ Here is the caller graph for this function:

◆ flatRateFxv()

Handle< BlackVolTermStructure > flatRateFxv ( Volatility  forward)
private

Definition at line 278 of file oredtestmarket.cpp.

278 {
279 QuantLib::ext::shared_ptr<BlackVolTermStructure> fxv(
280 new BlackConstantVol(Settings::instance().evaluationDate(), NullCalendar(), forward, Actual365Fixed()));
281 return Handle<BlackVolTermStructure>(fxv);
282}
+ Here is the caller graph for this function:

◆ flatRateDiv()

Handle< YieldTermStructure > flatRateDiv ( Real  dividend)
private

Definition at line 272 of file oredtestmarket.cpp.

272 {
273 QuantLib::ext::shared_ptr<YieldTermStructure> yts(
274 new FlatForward(Settings::instance().evaluationDate(), dividend, ActualActual(ActualActual::ISDA)));
275 return Handle<YieldTermStructure>(yts);
276}
+ Here is the caller graph for this function:

◆ flatRateSvs()

Handle< QuantLib::SwaptionVolatilityStructure > flatRateSvs ( Volatility  forward,
VolatilityType  type = ShiftedLognormal,
Real  shift = 0.0 
)
private

Definition at line 284 of file oredtestmarket.cpp.

285 {
286 QuantLib::ext::shared_ptr<QuantLib::SwaptionVolatilityStructure> svs(
287 new QuantLib::ConstantSwaptionVolatility(Settings::instance().evaluationDate(), NullCalendar(),
288 ModifiedFollowing, forward, Actual365Fixed(), type, shift));
289 return Handle<QuantLib::SwaptionVolatilityStructure>(svs);
290}
+ Here is the caller graph for this function:

◆ flatRateDcs()

Handle< QuantExt::CreditCurve > flatRateDcs ( Volatility  forward)
private

Definition at line 292 of file oredtestmarket.cpp.

292 {
293 QuantLib::ext::shared_ptr<DefaultProbabilityTermStructure> dcs(new FlatHazardRate(asof_, forward, ActualActual(ActualActual::ISDA)));
294 return Handle<QuantExt::CreditCurve>(
295 QuantLib::ext::make_shared<QuantExt::CreditCurve>(Handle<DefaultProbabilityTermStructure>(dcs)));
296}
+ Here is the caller graph for this function:

◆ flatRateCvs()

Handle< OptionletVolatilityStructure > flatRateCvs ( Volatility  vol,
VolatilityType  type = Normal,
Real  shift = 0.0 
)
private

Definition at line 298 of file oredtestmarket.cpp.

298 {
299 QuantLib::ext::shared_ptr<OptionletVolatilityStructure> ts(new QuantLib::ConstantOptionletVolatility(
300 Settings::instance().evaluationDate(), NullCalendar(), ModifiedFollowing, vol, ActualActual(ActualActual::ISDA), type, shift));
301 return Handle<OptionletVolatilityStructure>(ts);
302}
+ Here is the caller graph for this function: