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

Container class for all Curve Configurations. More...

#include <ored/configuration/curveconfigurations.hpp>

+ Inheritance diagram for CurveConfigurations:
+ Collaboration diagram for CurveConfigurations:

Public Member Functions

 CurveConfigurations ()
 Default constructor. More...
 
Setters and Getters
const ReportConfigreportConfigEqVols () const
 
const ReportConfigreportConfigFxVols () const
 
const ReportConfigreportConfigCommVols () const
 
const ReportConfigreportConfigIrCapFloorVols () const
 
const ReportConfigreportConfigIrSwaptionVols () const
 
bool hasYieldCurveConfig (const std::string &curveID) const
 
QuantLib::ext::shared_ptr< YieldCurveConfigyieldCurveConfig (const string &curveID) const
 
bool hasFxVolCurveConfig (const std::string &curveID) const
 
QuantLib::ext::shared_ptr< FXVolatilityCurveConfigfxVolCurveConfig (const string &curveID) const
 
bool hasSwaptionVolCurveConfig (const std::string &curveID) const
 
QuantLib::ext::shared_ptr< SwaptionVolatilityCurveConfigswaptionVolCurveConfig (const string &curveID) const
 
bool hasYieldVolCurveConfig (const std::string &curveID) const
 
QuantLib::ext::shared_ptr< YieldVolatilityCurveConfigyieldVolCurveConfig (const string &curveID) const
 
bool hasCapFloorVolCurveConfig (const std::string &curveID) const
 
QuantLib::ext::shared_ptr< CapFloorVolatilityCurveConfigcapFloorVolCurveConfig (const string &curveID) const
 
bool hasDefaultCurveConfig (const std::string &curveID) const
 
QuantLib::ext::shared_ptr< DefaultCurveConfigdefaultCurveConfig (const string &curveID) const
 
bool hasCdsVolCurveConfig (const std::string &curveID) const
 
QuantLib::ext::shared_ptr< CDSVolatilityCurveConfigcdsVolCurveConfig (const string &curveID) const
 
bool hasBaseCorrelationCurveConfig (const std::string &curveID) const
 
QuantLib::ext::shared_ptr< BaseCorrelationCurveConfigbaseCorrelationCurveConfig (const string &curveID) const
 
bool hasInflationCurveConfig (const std::string &curveID) const
 
QuantLib::ext::shared_ptr< InflationCurveConfiginflationCurveConfig (const string &curveID) const
 
bool hasInflationCapFloorVolCurveConfig (const std::string &curveID) const
 
QuantLib::ext::shared_ptr< InflationCapFloorVolatilityCurveConfiginflationCapFloorVolCurveConfig (const string &curveID) const
 
bool hasEquityCurveConfig (const std::string &curveID) const
 
QuantLib::ext::shared_ptr< EquityCurveConfigequityCurveConfig (const string &curveID) const
 
bool hasEquityVolCurveConfig (const std::string &curveID) const
 
QuantLib::ext::shared_ptr< EquityVolatilityCurveConfigequityVolCurveConfig (const string &curveID) const
 
bool hasSecurityConfig (const std::string &curveID) const
 
QuantLib::ext::shared_ptr< SecurityConfigsecurityConfig (const string &curveID) const
 
bool hasFxSpotConfig (const std::string &curveID) const
 
QuantLib::ext::shared_ptr< FXSpotConfigfxSpotConfig (const string &curveID) const
 
bool hasCommodityCurveConfig (const std::string &curveID) const
 
QuantLib::ext::shared_ptr< CommodityCurveConfigcommodityCurveConfig (const std::string &curveID) const
 
bool hasCommodityVolatilityConfig (const std::string &curveID) const
 
QuantLib::ext::shared_ptr< CommodityVolatilityConfigcommodityVolatilityConfig (const std::string &curveID) const
 
bool hasCorrelationCurveConfig (const std::string &curveID) const
 
QuantLib::ext::shared_ptr< CorrelationCurveConfigcorrelationCurveConfig (const std::string &curveID) const
 
QuantLib::ext::shared_ptr< CurveConfigurationsminimalCurveConfig (const QuantLib::ext::shared_ptr< TodaysMarketParameters > todaysMarketParams, const std::set< std::string > &configurations={""}) const
 
std::set< string > quotes (const QuantLib::ext::shared_ptr< TodaysMarketParameters > todaysMarketParams, const std::set< std::string > &configurations={""}) const
 
std::set< string > quotes () const
 
std::set< string > conventions (const QuantLib::ext::shared_ptr< TodaysMarketParameters > todaysMarketParams, const std::set< std::string > &configurations={""}) const
 
std::set< string > conventions () const
 
std::set< string > yieldCurveConfigIds ()
 
std::map< CurveSpec::CurveType, std::set< string > > requiredCurveIds (const CurveSpec::CurveType &type, const std::string &curveId) const
 
void add (const CurveSpec::CurveType &type, const string &curveId, const QuantLib::ext::shared_ptr< CurveConfig > &config)
 
bool has (const CurveSpec::CurveType &type, const string &curveId) const
 
const QuantLib::ext::shared_ptr< CurveConfig > & get (const CurveSpec::CurveType &type, const string &curveId) const
 
void parseAll ()
 
void addAdditionalCurveConfigs (const CurveConfigurations &c)
 
- Public Member Functions inherited from XMLSerializable
virtual ~XMLSerializable ()
 
virtual void fromXML (XMLNode *node)=0
 
virtual XMLNodetoXML (XMLDocument &doc) const =0
 
void fromFile (const std::string &filename)
 
void toFile (const std::string &filename) const
 
void fromXMLString (const std::string &xml)
 Parse from XML string. More...
 
std::string toXMLString () const
 Parse from XML string. More...
 

Serialisation

ReportConfig reportConfigEqVols_
 
ReportConfig reportConfigFxVols_
 
ReportConfig reportConfigCommVols_
 
ReportConfig reportConfigIrCapFloorVols_
 
ReportConfig reportConfigIrSwaptionVols_
 
std::map< CurveSpec::CurveType, std::map< std::string, QuantLib::ext::shared_ptr< CurveConfig > > > configs_
 
std::map< CurveSpec::CurveType, std::map< std::string, std::string > > unparsed_
 
void fromXML (XMLNode *node) override
 
XMLNodetoXML (XMLDocument &doc) const override
 
void parseNode (const CurveSpec::CurveType &type, const string &curveId) const
 
void getNode (XMLNode *node, const char *parentName, const char *childName)
 
void addNodes (XMLDocument &doc, XMLNode *parent, const char *nodeName) const
 

Detailed Description

Container class for all Curve Configurations.

Definition at line 59 of file curveconfigurations.hpp.

Constructor & Destructor Documentation

◆ CurveConfigurations()

Default constructor.

Definition at line 62 of file curveconfigurations.hpp.

62{}

Member Function Documentation

◆ reportConfigEqVols()

const ReportConfig & reportConfigEqVols ( ) const

Definition at line 66 of file curveconfigurations.hpp.

◆ reportConfigFxVols()

const ReportConfig & reportConfigFxVols ( ) const

Definition at line 67 of file curveconfigurations.hpp.

◆ reportConfigCommVols()

const ReportConfig & reportConfigCommVols ( ) const

Definition at line 68 of file curveconfigurations.hpp.

◆ reportConfigIrCapFloorVols()

const ReportConfig & reportConfigIrCapFloorVols ( ) const

Definition at line 69 of file curveconfigurations.hpp.

◆ reportConfigIrSwaptionVols()

const ReportConfig & reportConfigIrSwaptionVols ( ) const

Definition at line 70 of file curveconfigurations.hpp.

◆ hasYieldCurveConfig()

bool hasYieldCurveConfig ( const std::string &  curveID) const

Definition at line 363 of file curveconfigurations.cpp.

363{ return has(CurveSpec::CurveType::Yield, curveID); }
bool has(const CurveSpec::CurveType &type, const string &curveId) const
+ Here is the call graph for this function:

◆ yieldCurveConfig()

QuantLib::ext::shared_ptr< YieldCurveConfig > yieldCurveConfig ( const string &  curveID) const

Definition at line 364 of file curveconfigurations.cpp.

364 {
365 QuantLib::ext::shared_ptr<CurveConfig> cc = get(CurveSpec::CurveType::Yield, curveID);
366 return QuantLib::ext::dynamic_pointer_cast<YieldCurveConfig>(cc);
367}
const QuantLib::ext::shared_ptr< CurveConfig > & get(const CurveSpec::CurveType &type, const string &curveId) const
+ Here is the call graph for this function:

◆ hasFxVolCurveConfig()

bool hasFxVolCurveConfig ( const std::string &  curveID) const

Definition at line 369 of file curveconfigurations.cpp.

+ Here is the call graph for this function:

◆ fxVolCurveConfig()

QuantLib::ext::shared_ptr< FXVolatilityCurveConfig > fxVolCurveConfig ( const string &  curveID) const

Definition at line 373 of file curveconfigurations.cpp.

373 {
374 auto cc = get(CurveSpec::CurveType::FXVolatility, curveID);
375 return QuantLib::ext::dynamic_pointer_cast<FXVolatilityCurveConfig>(cc);
376}
+ Here is the call graph for this function:

◆ hasSwaptionVolCurveConfig()

bool hasSwaptionVolCurveConfig ( const std::string &  curveID) const

Definition at line 378 of file curveconfigurations.cpp.

+ Here is the call graph for this function:

◆ swaptionVolCurveConfig()

QuantLib::ext::shared_ptr< SwaptionVolatilityCurveConfig > swaptionVolCurveConfig ( const string &  curveID) const

Definition at line 383 of file curveconfigurations.cpp.

383 {
385 return QuantLib::ext::dynamic_pointer_cast<SwaptionVolatilityCurveConfig>(cc);
386}
+ Here is the call graph for this function:

◆ hasYieldVolCurveConfig()

bool hasYieldVolCurveConfig ( const std::string &  curveID) const

Definition at line 388 of file curveconfigurations.cpp.

+ Here is the call graph for this function:

◆ yieldVolCurveConfig()

QuantLib::ext::shared_ptr< YieldVolatilityCurveConfig > yieldVolCurveConfig ( const string &  curveID) const

Definition at line 393 of file curveconfigurations.cpp.

393 {
394 auto cc = get(CurveSpec::CurveType::YieldVolatility, curveID);
395 return QuantLib::ext::dynamic_pointer_cast<YieldVolatilityCurveConfig>(cc);
396}
+ Here is the call graph for this function:

◆ hasCapFloorVolCurveConfig()

bool hasCapFloorVolCurveConfig ( const std::string &  curveID) const

Definition at line 398 of file curveconfigurations.cpp.

+ Here is the call graph for this function:

◆ capFloorVolCurveConfig()

QuantLib::ext::shared_ptr< CapFloorVolatilityCurveConfig > capFloorVolCurveConfig ( const string &  curveID) const

Definition at line 403 of file curveconfigurations.cpp.

403 {
405 return QuantLib::ext::dynamic_pointer_cast<CapFloorVolatilityCurveConfig>(cc);
406}
+ Here is the call graph for this function:

◆ hasDefaultCurveConfig()

bool hasDefaultCurveConfig ( const std::string &  curveID) const

Definition at line 408 of file curveconfigurations.cpp.

+ Here is the call graph for this function:

◆ defaultCurveConfig()

QuantLib::ext::shared_ptr< DefaultCurveConfig > defaultCurveConfig ( const string &  curveID) const

Definition at line 412 of file curveconfigurations.cpp.

412 {
413 auto cc = get(CurveSpec::CurveType::Default, curveID);
414 return QuantLib::ext::dynamic_pointer_cast<DefaultCurveConfig>(cc);
415}
+ Here is the call graph for this function:

◆ hasCdsVolCurveConfig()

bool hasCdsVolCurveConfig ( const std::string &  curveID) const

Definition at line 417 of file curveconfigurations.cpp.

+ Here is the call graph for this function:

◆ cdsVolCurveConfig()

QuantLib::ext::shared_ptr< CDSVolatilityCurveConfig > cdsVolCurveConfig ( const string &  curveID) const

Definition at line 421 of file curveconfigurations.cpp.

421 {
422 auto cc = get(CurveSpec::CurveType::CDSVolatility, curveID);
423 return QuantLib::ext::dynamic_pointer_cast<CDSVolatilityCurveConfig>(cc);
424}
+ Here is the call graph for this function:

◆ hasBaseCorrelationCurveConfig()

bool hasBaseCorrelationCurveConfig ( const std::string &  curveID) const

Definition at line 426 of file curveconfigurations.cpp.

+ Here is the call graph for this function:

◆ baseCorrelationCurveConfig()

QuantLib::ext::shared_ptr< BaseCorrelationCurveConfig > baseCorrelationCurveConfig ( const string &  curveID) const

Definition at line 431 of file curveconfigurations.cpp.

431 {
432 auto cc = get(CurveSpec::CurveType::BaseCorrelation, curveID);
433 return QuantLib::ext::dynamic_pointer_cast<BaseCorrelationCurveConfig>(cc);
434}
+ Here is the call graph for this function:

◆ hasInflationCurveConfig()

bool hasInflationCurveConfig ( const std::string &  curveID) const

Definition at line 436 of file curveconfigurations.cpp.

+ Here is the call graph for this function:

◆ inflationCurveConfig()

QuantLib::ext::shared_ptr< InflationCurveConfig > inflationCurveConfig ( const string &  curveID) const

Definition at line 440 of file curveconfigurations.cpp.

440 {
441 auto cc = get(CurveSpec::CurveType::Inflation, curveID);
442 return QuantLib::ext::dynamic_pointer_cast<InflationCurveConfig>(cc);
443}
+ Here is the call graph for this function:

◆ hasInflationCapFloorVolCurveConfig()

bool hasInflationCapFloorVolCurveConfig ( const std::string &  curveID) const

Definition at line 445 of file curveconfigurations.cpp.

+ Here is the call graph for this function:

◆ inflationCapFloorVolCurveConfig()

QuantLib::ext::shared_ptr< InflationCapFloorVolatilityCurveConfig > inflationCapFloorVolCurveConfig ( const string &  curveID) const

Definition at line 450 of file curveconfigurations.cpp.

450 {
452 return QuantLib::ext::dynamic_pointer_cast<InflationCapFloorVolatilityCurveConfig>(cc);
453}
+ Here is the call graph for this function:

◆ hasEquityCurveConfig()

bool hasEquityCurveConfig ( const std::string &  curveID) const

Definition at line 455 of file curveconfigurations.cpp.

+ Here is the call graph for this function:

◆ equityCurveConfig()

QuantLib::ext::shared_ptr< EquityCurveConfig > equityCurveConfig ( const string &  curveID) const

Definition at line 459 of file curveconfigurations.cpp.

459 {
460 auto cc = get(CurveSpec::CurveType::Equity, curveID);
461 return QuantLib::ext::dynamic_pointer_cast<EquityCurveConfig>(cc);
462}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasEquityVolCurveConfig()

bool hasEquityVolCurveConfig ( const std::string &  curveID) const

Definition at line 464 of file curveconfigurations.cpp.

+ Here is the call graph for this function:

◆ equityVolCurveConfig()

QuantLib::ext::shared_ptr< EquityVolatilityCurveConfig > equityVolCurveConfig ( const string &  curveID) const

Definition at line 469 of file curveconfigurations.cpp.

469 {
471 return QuantLib::ext::dynamic_pointer_cast<EquityVolatilityCurveConfig>(cc);
472}
+ Here is the call graph for this function:

◆ hasSecurityConfig()

bool hasSecurityConfig ( const std::string &  curveID) const

Definition at line 474 of file curveconfigurations.cpp.

+ Here is the call graph for this function:

◆ securityConfig()

QuantLib::ext::shared_ptr< SecurityConfig > securityConfig ( const string &  curveID) const

Definition at line 478 of file curveconfigurations.cpp.

478 {
479 auto cc = get(CurveSpec::CurveType::Security, curveID);
480 return QuantLib::ext::dynamic_pointer_cast<SecurityConfig>(cc);
481}
+ Here is the call graph for this function:

◆ hasFxSpotConfig()

bool hasFxSpotConfig ( const std::string &  curveID) const

Definition at line 483 of file curveconfigurations.cpp.

+ Here is the call graph for this function:

◆ fxSpotConfig()

QuantLib::ext::shared_ptr< FXSpotConfig > fxSpotConfig ( const string &  curveID) const

Definition at line 487 of file curveconfigurations.cpp.

487 {
488 auto cc = get(CurveSpec::CurveType::FX, curveID);
489 return QuantLib::ext::dynamic_pointer_cast<FXSpotConfig>(cc);
490}
+ Here is the call graph for this function:

◆ hasCommodityCurveConfig()

bool hasCommodityCurveConfig ( const std::string &  curveID) const

Definition at line 492 of file curveconfigurations.cpp.

+ Here is the call graph for this function:

◆ commodityCurveConfig()

QuantLib::ext::shared_ptr< CommodityCurveConfig > commodityCurveConfig ( const std::string &  curveID) const

Definition at line 496 of file curveconfigurations.cpp.

496 {
497 auto cc = get(CurveSpec::CurveType::Commodity, curveID);
498 return QuantLib::ext::dynamic_pointer_cast<CommodityCurveConfig>(cc);
499}
+ Here is the call graph for this function:

◆ hasCommodityVolatilityConfig()

bool hasCommodityVolatilityConfig ( const std::string &  curveID) const

Definition at line 501 of file curveconfigurations.cpp.

+ Here is the call graph for this function:

◆ commodityVolatilityConfig()

QuantLib::ext::shared_ptr< CommodityVolatilityConfig > commodityVolatilityConfig ( const std::string &  curveID) const

Definition at line 506 of file curveconfigurations.cpp.

506 {
508 return QuantLib::ext::dynamic_pointer_cast<CommodityVolatilityConfig>(cc);
509}
+ Here is the call graph for this function:

◆ hasCorrelationCurveConfig()

bool hasCorrelationCurveConfig ( const std::string &  curveID) const

Definition at line 511 of file curveconfigurations.cpp.

+ Here is the call graph for this function:

◆ correlationCurveConfig()

QuantLib::ext::shared_ptr< CorrelationCurveConfig > correlationCurveConfig ( const std::string &  curveID) const

Definition at line 516 of file curveconfigurations.cpp.

516 {
517 auto cc = get(CurveSpec::CurveType::Correlation, curveID);
518 return QuantLib::ext::dynamic_pointer_cast<CorrelationCurveConfig>(cc);
519}
+ Here is the call graph for this function:

◆ minimalCurveConfig()

QuantLib::ext::shared_ptr< CurveConfigurations > minimalCurveConfig ( const QuantLib::ext::shared_ptr< TodaysMarketParameters todaysMarketParams,
const std::set< std::string > &  configurations = {""} 
) const

Definition at line 193 of file curveconfigurations.cpp.

194 {
195
196 QuantLib::ext::shared_ptr<CurveConfigurations> minimum = QuantLib::ext::make_shared<CurveConfigurations>();
197 // If tmparams is not null, organise its specs in to a map [CurveType, set of CurveConfigID]
198 map<CurveSpec::CurveType, set<string>> curveConfigIds;
199
200 for (const auto& config : configurations) {
201 for (const auto& strSpec : todaysMarketParams->curveSpecs(config)) {
202 auto spec = parseCurveSpec(strSpec);
203 if (curveConfigIds.count(spec->baseType()))
204 curveConfigIds[spec->baseType()].insert(spec->curveConfigID());
205 else
206 curveConfigIds[spec->baseType()] = {spec->curveConfigID()};
207 }
208 }
209
210 for (const auto& it : curveConfigIds) {
211 for (auto& c : it.second) {
212 try {
213 auto cc = get(it.first, c);
214 minimum->add(it.first, c, get(it.first, c));
215 } catch (...) {
216 }
217 }
218 }
219 return minimum;
220}
QuantLib::ext::shared_ptr< CurveSpec > parseCurveSpec(const string &s)
function to convert a string into a curve spec
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ quotes() [1/2]

std::set< string > quotes ( const QuantLib::ext::shared_ptr< TodaysMarketParameters todaysMarketParams,
const std::set< std::string > &  configurations = {""} 
) const

Return the set of quotes that are required by the CurveConfig elements in CurveConfigurations.

The set of quotes required by only those CurveConfig elements appearing in todaysMarketParams for the given configuration(s) is returned.

Definition at line 222 of file curveconfigurations.cpp.

223 {
224
225 std::set<string> quotes = minimalCurveConfig(todaysMarketParams, configurations)->quotes();
226
227 // FX spot is special in that we generally do not enter a curve configuration for it. Above, we ran over the
228 // curve configurations asking each for its quotes. We may end up missing FX spot quotes that are specified in a
229 // TodaysMarketParameters but do not have a CurveConfig. If we have a TodaysMarketParameters instance we can add
230 // them here directly using it.
231
232 for (const auto& config : configurations) {
233 for (const auto& strSpec : todaysMarketParams->curveSpecs(config)) {
234 auto spec = parseCurveSpec(strSpec);
235 if (spec->baseType() == CurveSpec::CurveType::FX) {
236 QuantLib::ext::shared_ptr<FXSpotSpec> fxss = QuantLib::ext::dynamic_pointer_cast<FXSpotSpec>(spec);
237 QL_REQUIRE(fxss, "Expected an FXSpotSpec but did not get one");
238 string strQuote = "FX/RATE/" + fxss->unitCcy() + "/" + fxss->ccy();
239 quotes.insert(strQuote);
240 }
241 }
242 }
243
244 return quotes;
245}
QuantLib::ext::shared_ptr< CurveConfigurations > minimalCurveConfig(const QuantLib::ext::shared_ptr< TodaysMarketParameters > todaysMarketParams, const std::set< std::string > &configurations={""}) const
std::set< string > quotes() const
+ Here is the call graph for this function:

◆ quotes() [2/2]

std::set< string > quotes ( ) const

Definition at line 247 of file curveconfigurations.cpp.

247 {
248 set<string> quotes;
249
250 // only add quotes for parsed configs
251 for (const auto& ct : configs_) {
252 for (const auto& c : ct.second) {
253 quotes.insert(c.second->quotes().begin(), c.second->quotes().end());
254 }
255 }
256 return quotes;
257}
std::map< CurveSpec::CurveType, std::map< std::string, QuantLib::ext::shared_ptr< CurveConfig > > > configs_
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ conventions() [1/2]

std::set< string > conventions ( const QuantLib::ext::shared_ptr< TodaysMarketParameters todaysMarketParams,
const std::set< std::string > &  configurations = {""} 
) const

Definition at line 259 of file curveconfigurations.cpp.

260 {
261 set<string> conventions = minimalCurveConfig(todaysMarketParams, configurations)->conventions();
262
263 // Checking for any swapIndices
264 if (todaysMarketParams->hasMarketObject(MarketObject::SwapIndexCurve)) {
265 for (const auto& m : todaysMarketParams->mapping(MarketObject::SwapIndexCurve, Market::defaultConfiguration)) {
266 conventions.insert(m.first);
267 }
268 }
269
270 return conventions;
271}
std::set< string > conventions() const
static const string defaultConfiguration
Default configuration label.
Definition: market.hpp:296
+ Here is the call graph for this function:

◆ conventions() [2/2]

std::set< string > conventions ( ) const

Definition at line 273 of file curveconfigurations.cpp.

273 {
274 set<string> conventions;
275 for (const auto& cc : configs_) {
276 if (cc.first == CurveSpec::CurveType::Yield) {
277 for (const auto& c : cc.second) {
278 auto ycc = QuantLib::ext::dynamic_pointer_cast<YieldCurveConfig>(c.second);
279 if (ycc) {
280 for (auto& s : ycc->curveSegments())
281 if (!s->conventionsID().empty())
282 conventions.insert(s->conventionsID());
283 }
284 }
285 }
286
287 if (cc.first == CurveSpec::CurveType::Default) {
288 for (const auto& c : cc.second) {
289 auto dcc = QuantLib::ext::dynamic_pointer_cast<DefaultCurveConfig>(c.second);
290 if (dcc) {
291 for (auto& s : dcc->configs()) {
292 if (s.second.conventionID() != "")
293 conventions.insert(s.second.conventionID());
294 }
295 }
296 }
297 }
298
299 if (cc.first == CurveSpec::CurveType::Inflation) {
300 for (const auto& c : cc.second) {
301 auto icc = QuantLib::ext::dynamic_pointer_cast<InflationCurveConfig>(c.second);
302 if (icc) {
303 if (icc->conventions() != "")
304 conventions.insert(icc->conventions());
305 }
306 }
307 }
308
309 if (cc.first == CurveSpec::CurveType::Correlation) {
310 for (const auto& c : cc.second) {
311 auto ccc = QuantLib::ext::dynamic_pointer_cast<CorrelationCurveConfig>(c.second);
312 if (ccc) {
313 if (ccc->conventions() != "")
314 conventions.insert(ccc->conventions());
315 }
316 }
317 }
318
319 if (cc.first == CurveSpec::CurveType::FXVolatility) {
320 for (const auto& c : cc.second) {
321 auto fcc = QuantLib::ext::dynamic_pointer_cast<FXVolatilityCurveConfig>(c.second);
322 if (fcc) {
323 if (fcc->conventionsID() != "")
324 conventions.insert(fcc->conventionsID());
325 }
326 }
327 }
328 }
329 return conventions;
330}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ yieldCurveConfigIds()

set< string > yieldCurveConfigIds ( )

Return the Yields curves available

Definition at line 332 of file curveconfigurations.cpp.

332 {
333 set<string> curves;
334 const auto& it = configs_.find(CurveSpec::CurveType::Yield);
335 if (it != configs_.end()) {
336 for (const auto& c : it->second)
337 curves.insert(c.first);
338 }
339
340 const auto& itu = unparsed_.find(CurveSpec::CurveType::Yield);
341 if (itu != unparsed_.end()) {
342 for (const auto& c : itu->second)
343 curves.insert(c.first);
344 }
345
346 return curves;
347}
std::map< CurveSpec::CurveType, std::map< std::string, std::string > > unparsed_

◆ requiredCurveIds()

std::map< CurveSpec::CurveType, std::set< string > > requiredCurveIds ( const CurveSpec::CurveType type,
const std::string &  curveId 
) const

Return all curve ids required by a given curve id of a given type

Definition at line 350 of file curveconfigurations.cpp.

350 {
351 QuantLib::ext::shared_ptr<CurveConfig> cc;
352 std::map<CurveSpec::CurveType, std::set<string>> ids;
353 if (!curveId.empty())
354 try {
355 cc = get(type, curveId);
356 } catch (...) {
357 }
358 if (cc)
359 ids = cc->requiredCurveIds();
360 return ids;
361}
+ Here is the call graph for this function:

◆ add()

void add ( const CurveSpec::CurveType type,
const string &  curveId,
const QuantLib::ext::shared_ptr< CurveConfig > &  config 
)

Definition at line 148 of file curveconfigurations.cpp.

149 {
150 configs_[type][curveId] = config;
151}

◆ has()

bool has ( const CurveSpec::CurveType type,
const string &  curveId 
) const

Definition at line 153 of file curveconfigurations.cpp.

153 {
154 return (configs_.count(type) > 0 && configs_.at(type).count(curveId) > 0) ||
155 (unparsed_.count(type) > 0 && unparsed_.at(type).count(curveId) > 0);
156}
+ Here is the caller graph for this function:

◆ get()

const QuantLib::ext::shared_ptr< CurveConfig > & get ( const CurveSpec::CurveType type,
const string &  curveId 
) const

Definition at line 158 of file curveconfigurations.cpp.

159 {
160 const auto& it = configs_.find(type);
161 if (it != configs_.end()) {
162 const auto& itc = it->second.find(curveId);
163 if (itc != it->second.end()) {
164 return itc->second;
165 }
166 }
167 parseNode(type, curveId);
168 return configs_.at(type).at(curveId);
169}
void parseNode(const CurveSpec::CurveType &type, const string &curveId) const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseAll()

void parseAll ( )

Definition at line 171 of file curveconfigurations.cpp.

171 {
172 for (const auto& u : unparsed_) {
173 for (auto it = u.second.cbegin(), nit = it; it != u.second.cend(); it = nit) {
174 nit++;
175 parseNode(u.first, it->first);
176 }
177 }
178}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addAdditionalCurveConfigs()

void addAdditionalCurveConfigs ( const CurveConfigurations c)

add curve configs from given container that are not present in this container

Definition at line 593 of file curveconfigurations.cpp.

593 {
594
595 // add parsed configs
596
597 for (auto const& [curveType, configs] : c.configs_) {
598 for (auto const& [name, config] : configs) {
599 auto c1 = configs_.find(curveType);
600 if (c1 == configs_.end()) {
601 configs_[curveType] = {{name, config}};
602 continue;
603 }
604 auto c2 = c1->second.find(name);
605 if (c2 == c1->second.end()) {
606 c1->second[name] = config;
607 continue;
608 }
609 }
610 }
611
612 // add unparsed configs
613
614 for (auto const& [curveType, configs] : c.unparsed_) {
615 for (auto const& [name, config] : configs) {
616 auto c1 = unparsed_.find(curveType);
617 if (c1 == unparsed_.end()) {
618 unparsed_[curveType] = {{name, config}};
619 continue;
620 }
621 auto c2 = c1->second.find(name);
622 if (c2 == c1->second.end()) {
623 c1->second[name] = config;
624 continue;
625 }
626 }
627 }
628}
string name

◆ fromXML()

void fromXML ( XMLNode node)
overridevirtual

Implements XMLSerializable.

Definition at line 522 of file curveconfigurations.cpp.

522 {
523 XMLUtils::checkNode(node, "CurveConfiguration");
524
525 // Load global settings
526 if (auto tmp = XMLUtils::getChildNode(node, "ReportConfiguration")) {
527 if (auto tmp2 = XMLUtils::getChildNode(tmp, "EquityVolatilities")) {
528 if (auto tmp3 = XMLUtils::getChildNode(tmp2, "Report"))
530 }
531 if (auto tmp2 = XMLUtils::getChildNode(tmp, "FXVolatilities")) {
532 if (auto tmp3 = XMLUtils::getChildNode(tmp2, "Report"))
534 }
535 if (auto tmp2 = XMLUtils::getChildNode(tmp, "CommodityVolatilities")) {
536 if (auto tmp3 = XMLUtils::getChildNode(tmp2, "Report"))
538 }
539 if (auto tmp2 = XMLUtils::getChildNode(tmp, "IRCapFloorVolatilities")) {
540 if (auto tmp3 = XMLUtils::getChildNode(tmp2, "Report"))
542 }
543 if (auto tmp2 = XMLUtils::getChildNode(tmp, "IRSwaptionVolatilities")) {
544 if (auto tmp3 = XMLUtils::getChildNode(tmp2, "Report"))
546 }
547 }
548
549 // Load YieldCurves, FXVols, etc, etc
550 getNode(node, "YieldCurves", "YieldCurve");
551 getNode(node, "FXVolatilities", "FXVolatility");
552 getNode(node, "SwaptionVolatilities", "SwaptionVolatility");
553 getNode(node, "YieldVolatilities", "YieldVolatility");
554 getNode(node, "CapFloorVolatilities", "CapFloorVolatility");
555 getNode(node, "DefaultCurves", "DefaultCurve");
556 getNode(node, "CDSVolatilities", "CDSVolatility");
557 getNode(node, "BaseCorrelations", "BaseCorrelation");
558 getNode(node, "EquityCurves", "EquityCurve");
559 getNode(node, "EquityVolatilities", "EquityVolatility");
560 getNode(node, "InflationCurves", "InflationCurve");
561 getNode(node, "InflationCapFloorVolatilities", "InflationCapFloorVolatility");
562 getNode(node, "Securities", "Security");
563 getNode(node, "FXSpots", "FXSpot");
564 getNode(node, "CommodityCurves", "CommodityCurve");
565 getNode(node, "CommodityVolatilities", "CommodityVolatility");
566 getNode(node, "Correlations", "Correlation");
567}
void getNode(XMLNode *node, const char *parentName, const char *childName)
void fromXML(XMLNode *node) override
static void checkNode(XMLNode *n, const string &expectedName)
Definition: xmlutils.cpp:175
static XMLNode * getChildNode(XMLNode *n, const string &name="")
Definition: xmlutils.cpp:387
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ toXML()

XMLNode * toXML ( XMLDocument doc) const
overridevirtual

Implements XMLSerializable.

Definition at line 569 of file curveconfigurations.cpp.

569 {
570 XMLNode* parent = doc.allocNode("CurveConfiguration");
571
572 addNodes(doc, parent, "FXSpots");
573 addNodes(doc, parent, "FXVolatilities");
574 addNodes(doc, parent, "SwaptionVolatilities");
575 addNodes(doc, parent, "YieldVolatilities");
576 addNodes(doc, parent, "CapFloorVolatilities");
577 addNodes(doc, parent, "CDSVolatilities");
578 addNodes(doc, parent, "DefaultCurves");
579 addNodes(doc, parent, "YieldCurves");
580 addNodes(doc, parent, "InflationCurves");
581 addNodes(doc, parent, "InflationCapFloorVolatilities");
582 addNodes(doc, parent, "EquityCurves");
583 addNodes(doc, parent, "EquityVolatilities");
584 addNodes(doc, parent, "Securities");
585 addNodes(doc, parent, "BaseCorrelations");
586 addNodes(doc, parent, "CommodityCurves");
587 addNodes(doc, parent, "CommodityVolatilities");
588 addNodes(doc, parent, "Correlations");
589
590 return parent;
591}
void addNodes(XMLDocument &doc, XMLNode *parent, const char *nodeName) const
rapidxml::xml_node< char > XMLNode
Definition: xmlutils.hpp:60
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseNode()

void parseNode ( const CurveSpec::CurveType type,
const string &  curveId 
) const
private

Definition at line 57 of file curveconfigurations.cpp.

57 {
58 QuantLib::ext::shared_ptr<CurveConfig> config;
59 const auto& it = unparsed_.find(type);
60 if (it != unparsed_.end()) {
61 const auto& itc = it->second.find(curveId);
62 if (itc != it->second.end()) {
63 switch (type) {
65 config = QuantLib::ext::make_shared<YieldCurveConfig>();
66 break;
67 }
69 config = QuantLib::ext::make_shared<DefaultCurveConfig>();
70 break;
71 }
73 config = QuantLib::ext::make_shared<CDSVolatilityCurveConfig>();
74 break;
75 }
77 config = QuantLib::ext::make_shared<BaseCorrelationCurveConfig>();
78 break;
79 }
81 config = QuantLib::ext::make_shared<FXSpotConfig>();
82 break;
83 }
85 config = QuantLib::ext::make_shared<FXVolatilityCurveConfig>();
86 break;
87 }
89 config = QuantLib::ext::make_shared<SwaptionVolatilityCurveConfig>();
90 break;
91 }
93 config = QuantLib::ext::make_shared<YieldVolatilityCurveConfig>();
94 break;
95 }
97 config = QuantLib::ext::make_shared<CapFloorVolatilityCurveConfig>();
98 break;
99 }
101 config = QuantLib::ext::make_shared<InflationCurveConfig>();
102 break;
103 }
105 config = QuantLib::ext::make_shared<InflationCapFloorVolatilityCurveConfig>();
106 break;
107 }
109 config = QuantLib::ext::make_shared<EquityCurveConfig>();
110 break;
111 }
113 config = QuantLib::ext::make_shared<EquityVolatilityCurveConfig>();
114 break;
115 }
117 config = QuantLib::ext::make_shared<SecurityConfig>();
118 break;
119 }
121 config = QuantLib::ext::make_shared<CommodityCurveConfig>();
122 break;
123 }
125 config = QuantLib::ext::make_shared<CommodityVolatilityConfig>();
126 break;
127 }
129 config = QuantLib::ext::make_shared<CorrelationCurveConfig>();
130 break;
131 }
132 }
133 try {
134 config->fromXMLString(itc->second);
135 configs_[type][curveId] = config;
136 unparsed_.at(type).erase(curveId);
137 } catch (std::exception& ex) {
138 string err = "Curve config under node '" + to_string(type) + " was requested, but could not be parsed.";
139 StructuredCurveErrorMessage(curveId, err, ex.what()).log();
140 QL_FAIL(err);
141 }
142 } else
143 QL_FAIL("Could not find curveId " << curveId << " of type " << type << " in unparsed curve configurations");
144 } else
145 QL_FAIL("Could not find CurveType " << type << " in unparsed curve configurations");
146}
std::string to_string(const LocationInfo &l)
Definition: ast.cpp:28
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNode()

void getNode ( XMLNode node,
const char *  parentName,
const char *  childName 
)
private

Definition at line 180 of file curveconfigurations.cpp.

180 {
181 const auto& type = parseCurveConfigurationType(parentName);
182 XMLNode* parentNode = XMLUtils::getChildNode(node, parentName);
183 if (parentNode) {
184 for (XMLNode* child = XMLUtils::getChildNode(parentNode, childName); child;
185 child = XMLUtils::getNextSibling(child, childName)) {
186 const auto& id = XMLUtils::getChildValue(child, "CurveId", true);
187 unparsed_[type][id] = XMLUtils::toString(child);
188 }
189 }
190}
static string getChildValue(XMLNode *node, const string &name, bool mandatory=false, const string &defaultValue=string())
Definition: xmlutils.cpp:277
static XMLNode * getNextSibling(XMLNode *node, const string &name="")
Get a node's next sibling node.
Definition: xmlutils.cpp:484
static string toString(XMLNode *node)
Write a node out as a string.
Definition: xmlutils.cpp:714
CurveSpec::CurveType parseCurveConfigurationType(const std::string &s)
function to convert a curve configuration node string into a curve spec type
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addNodes()

void addNodes ( XMLDocument doc,
XMLNode parent,
const char *  nodeName 
) const
private

Definition at line 44 of file curveconfigurations.cpp.

44 {
45 const auto& ct = parseCurveConfigurationType(nodeName);
46 const auto& it = configs_.find(ct);
47 if (it != configs_.end()) {
48 XMLNode* node = doc.allocNode(nodeName);
49 XMLUtils::appendNode(parent, node);
50
51 for (const auto& c : it->second) {
52 XMLUtils::appendNode(node, c.second->toXML(doc));
53 }
54 }
55}
static void appendNode(XMLNode *parent, XMLNode *child)
Definition: xmlutils.cpp:406
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ reportConfigEqVols_

ReportConfig reportConfigEqVols_
private

Definition at line 164 of file curveconfigurations.hpp.

◆ reportConfigFxVols_

ReportConfig reportConfigFxVols_
private

Definition at line 165 of file curveconfigurations.hpp.

◆ reportConfigCommVols_

ReportConfig reportConfigCommVols_
private

Definition at line 166 of file curveconfigurations.hpp.

◆ reportConfigIrCapFloorVols_

ReportConfig reportConfigIrCapFloorVols_
private

Definition at line 167 of file curveconfigurations.hpp.

◆ reportConfigIrSwaptionVols_

ReportConfig reportConfigIrSwaptionVols_
private

Definition at line 168 of file curveconfigurations.hpp.

◆ configs_

std::map<CurveSpec::CurveType, std::map<std::string, QuantLib::ext::shared_ptr<CurveConfig> > > configs_
mutableprivate

Definition at line 170 of file curveconfigurations.hpp.

◆ unparsed_

std::map<CurveSpec::CurveType, std::map<std::string, std::string> > unparsed_
mutableprivate

Definition at line 171 of file curveconfigurations.hpp.