Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
curveconfigurations.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2016 Quaternion Risk Management Ltd
3 All rights reserved.
4
5 This file is part of ORE, a free-software/open-source library
6 for transparent pricing and risk analysis - http://opensourcerisk.org
7
8 ORE is free software: you can redistribute it and/or modify it
9 under the terms of the Modified BSD License. You should have received a
10 copy of the license along with this program.
11 The license is also available online at <http://opensourcerisk.org>
12
13 This program is distributed on the basis that it will form a useful
14 contribution to risk analytics and model standardisation, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
17*/
18
19/*! \file ored/configuration/curveconfigurations.hpp
20 \brief Curve configuration repository
21 \ingroup configuration
22*/
23
24#pragma once
25
46
47#include <typeindex>
48#include <typeinfo>
49
50namespace ore {
51namespace data {
54
55//! Container class for all Curve Configurations
56/*!
57 \ingroup configuration
58*/
60public:
61 //! Default constructor
63
64 //! \name Setters and Getters
65 //@{
71
72 bool hasYieldCurveConfig(const std::string& curveID) const;
73 QuantLib::ext::shared_ptr<YieldCurveConfig> yieldCurveConfig(const string& curveID) const;
74
75 bool hasFxVolCurveConfig(const std::string& curveID) const;
76 QuantLib::ext::shared_ptr<FXVolatilityCurveConfig> fxVolCurveConfig(const string& curveID) const;
77
78 bool hasSwaptionVolCurveConfig(const std::string& curveID) const;
79 QuantLib::ext::shared_ptr<SwaptionVolatilityCurveConfig> swaptionVolCurveConfig(const string& curveID) const;
80
81 bool hasYieldVolCurveConfig(const std::string& curveID) const;
82 QuantLib::ext::shared_ptr<YieldVolatilityCurveConfig> yieldVolCurveConfig(const string& curveID) const;
83
84 bool hasCapFloorVolCurveConfig(const std::string& curveID) const;
85 QuantLib::ext::shared_ptr<CapFloorVolatilityCurveConfig> capFloorVolCurveConfig(const string& curveID) const;
86
87 bool hasDefaultCurveConfig(const std::string& curveID) const;
88 QuantLib::ext::shared_ptr<DefaultCurveConfig> defaultCurveConfig(const string& curveID) const;
89
90 bool hasCdsVolCurveConfig(const std::string& curveID) const;
91 QuantLib::ext::shared_ptr<CDSVolatilityCurveConfig> cdsVolCurveConfig(const string& curveID) const;
92
93 bool hasBaseCorrelationCurveConfig(const std::string& curveID) const;
94 QuantLib::ext::shared_ptr<BaseCorrelationCurveConfig> baseCorrelationCurveConfig(const string& curveID) const;
95
96 bool hasInflationCurveConfig(const std::string& curveID) const;
97 QuantLib::ext::shared_ptr<InflationCurveConfig> inflationCurveConfig(const string& curveID) const;
98
99 bool hasInflationCapFloorVolCurveConfig(const std::string& curveID) const;
100 QuantLib::ext::shared_ptr<InflationCapFloorVolatilityCurveConfig>
101 inflationCapFloorVolCurveConfig(const string& curveID) const;
102
103 bool hasEquityCurveConfig(const std::string& curveID) const;
104 QuantLib::ext::shared_ptr<EquityCurveConfig> equityCurveConfig(const string& curveID) const;
105
106 bool hasEquityVolCurveConfig(const std::string& curveID) const;
107 QuantLib::ext::shared_ptr<EquityVolatilityCurveConfig> equityVolCurveConfig(const string& curveID) const;
108
109 bool hasSecurityConfig(const std::string& curveID) const;
110 QuantLib::ext::shared_ptr<SecurityConfig> securityConfig(const string& curveID) const;
111
112 bool hasFxSpotConfig(const std::string& curveID) const;
113 QuantLib::ext::shared_ptr<FXSpotConfig> fxSpotConfig(const string& curveID) const;
114
115 bool hasCommodityCurveConfig(const std::string& curveID) const;
116 QuantLib::ext::shared_ptr<CommodityCurveConfig> commodityCurveConfig(const std::string& curveID) const;
117
118 bool hasCommodityVolatilityConfig(const std::string& curveID) const;
119 QuantLib::ext::shared_ptr<CommodityVolatilityConfig> commodityVolatilityConfig(const std::string& curveID) const;
120
121 bool hasCorrelationCurveConfig(const std::string& curveID) const;
122 QuantLib::ext::shared_ptr<CorrelationCurveConfig> correlationCurveConfig(const std::string& curveID) const;
123
124 QuantLib::ext::shared_ptr<CurveConfigurations>
125 minimalCurveConfig(const QuantLib::ext::shared_ptr<TodaysMarketParameters> todaysMarketParams,
126 const std::set<std::string>& configurations = {""}) const;
127
128 /*! Return the set of quotes that are required by the CurveConfig elements in CurveConfigurations.
129
130 The set of quotes required by only those CurveConfig elements appearing
131 in \p todaysMarketParams for the given configuration(s) is returned.
132 */
133 std::set<string> quotes(const QuantLib::ext::shared_ptr<TodaysMarketParameters> todaysMarketParams,
134 const std::set<std::string>& configurations = {""}) const;
135 std::set<string> quotes() const;
136
137 std::set<string> conventions(const QuantLib::ext::shared_ptr<TodaysMarketParameters> todaysMarketParams,
138 const std::set<std::string>& configurations = {""}) const;
139 std::set<string> conventions() const;
140
141 /*! Return the Yields curves available */
142 std::set<string> yieldCurveConfigIds();
143
144 /*! Return all curve ids required by a given curve id of a given type */
145 std::map<CurveSpec::CurveType, std::set<string>> requiredCurveIds(const CurveSpec::CurveType& type,
146 const std::string& curveId) const;
147 //@}
148
149 void add(const CurveSpec::CurveType& type, const string& curveId, const QuantLib::ext::shared_ptr<CurveConfig>& config);
150 bool has(const CurveSpec::CurveType& type, const string& curveId) const;
151 const QuantLib::ext::shared_ptr<CurveConfig>& get(const CurveSpec::CurveType& type, const string& curveId) const;
152 void parseAll();
153
154 /*! add curve configs from given container that are not present in this container */
156
157 //! \name Serialisation
158 //@{
159 void fromXML(XMLNode* node) override;
160 XMLNode* toXML(XMLDocument& doc) const override;
161 //@}
162
163 private:
169
170 mutable std::map<CurveSpec::CurveType, std::map<std::string, QuantLib::ext::shared_ptr<CurveConfig>>> configs_;
171 mutable std::map<CurveSpec::CurveType, std::map<std::string, std::string>> unparsed_;
172
173 // utility function for parsing a node of name "parentName" and storing the result in the map
174 void parseNode(const CurveSpec::CurveType& type, const string& curveId) const;
175
176 // utility function for getting a child curve config node
177 void getNode(XMLNode* node, const char* parentName, const char* childName);
178
179 // add to XML doc
180 void addNodes(XMLDocument& doc, XMLNode* parent, const char* nodeName) const;
181};
182
184public:
186
187 // add a curve config, if no id provided it gets added as a default
188 void add(const QuantLib::ext::shared_ptr<CurveConfigurations>& config, std::string id = std::string());
189 const QuantLib::ext::shared_ptr<CurveConfigurations>& get(std::string id = std::string()) const;
190 const bool has(std::string id = std::string()) const;
191 const std::map<std::string, QuantLib::ext::shared_ptr<CurveConfigurations>>& curveConfigurations() const;
192 const bool empty() const;
193
194private:
195 std::map<std::string, QuantLib::ext::shared_ptr<CurveConfigurations>> configs_;
196};
197
198} // namespace data
199} // namespace ore
Base Correlation curve configuration classes.
Cap floor volatility curve configuration class.
CDS and index CDS volatility configuration.
Container class for all Curve Configurations.
const QuantLib::ext::shared_ptr< CurveConfig > & get(const CurveSpec::CurveType &type, const string &curveId) const
bool hasYieldVolCurveConfig(const std::string &curveID) const
bool hasEquityVolCurveConfig(const std::string &curveID) const
bool hasDefaultCurveConfig(const std::string &curveID) const
std::set< string > yieldCurveConfigIds()
const ReportConfig & reportConfigIrSwaptionVols() const
QuantLib::ext::shared_ptr< EquityCurveConfig > equityCurveConfig(const string &curveID) const
void getNode(XMLNode *node, const char *parentName, const char *childName)
QuantLib::ext::shared_ptr< YieldCurveConfig > yieldCurveConfig(const string &curveID) const
QuantLib::ext::shared_ptr< CDSVolatilityCurveConfig > cdsVolCurveConfig(const string &curveID) const
QuantLib::ext::shared_ptr< CurveConfigurations > minimalCurveConfig(const QuantLib::ext::shared_ptr< TodaysMarketParameters > todaysMarketParams, const std::set< std::string > &configurations={""}) const
QuantLib::ext::shared_ptr< BaseCorrelationCurveConfig > baseCorrelationCurveConfig(const string &curveID) const
std::set< string > conventions() const
const ReportConfig & reportConfigCommVols() const
std::set< string > quotes() const
bool hasCorrelationCurveConfig(const std::string &curveID) const
bool hasSecurityConfig(const std::string &curveID) const
QuantLib::ext::shared_ptr< CommodityCurveConfig > commodityCurveConfig(const std::string &curveID) const
QuantLib::ext::shared_ptr< InflationCurveConfig > inflationCurveConfig(const string &curveID) const
bool hasFxSpotConfig(const std::string &curveID) const
QuantLib::ext::shared_ptr< SwaptionVolatilityCurveConfig > swaptionVolCurveConfig(const string &curveID) const
QuantLib::ext::shared_ptr< CapFloorVolatilityCurveConfig > capFloorVolCurveConfig(const string &curveID) const
QuantLib::ext::shared_ptr< FXSpotConfig > fxSpotConfig(const string &curveID) const
QuantLib::ext::shared_ptr< InflationCapFloorVolatilityCurveConfig > inflationCapFloorVolCurveConfig(const string &curveID) const
bool hasFxVolCurveConfig(const std::string &curveID) const
bool hasCdsVolCurveConfig(const std::string &curveID) const
void fromXML(XMLNode *node) override
bool hasInflationCapFloorVolCurveConfig(const std::string &curveID) const
QuantLib::ext::shared_ptr< CorrelationCurveConfig > correlationCurveConfig(const std::string &curveID) const
XMLNode * toXML(XMLDocument &doc) const override
bool hasYieldCurveConfig(const std::string &curveID) const
bool hasCommodityVolatilityConfig(const std::string &curveID) const
bool hasEquityCurveConfig(const std::string &curveID) const
bool hasCommodityCurveConfig(const std::string &curveID) const
void addAdditionalCurveConfigs(const CurveConfigurations &c)
bool hasInflationCurveConfig(const std::string &curveID) const
std::map< CurveSpec::CurveType, std::map< std::string, std::string > > unparsed_
bool has(const CurveSpec::CurveType &type, const string &curveId) const
const ReportConfig & reportConfigIrCapFloorVols() const
const ReportConfig & reportConfigFxVols() const
QuantLib::ext::shared_ptr< YieldVolatilityCurveConfig > yieldVolCurveConfig(const string &curveID) const
std::map< CurveSpec::CurveType, std::set< string > > requiredCurveIds(const CurveSpec::CurveType &type, const std::string &curveId) const
QuantLib::ext::shared_ptr< DefaultCurveConfig > defaultCurveConfig(const string &curveID) const
CurveConfigurations()
Default constructor.
QuantLib::ext::shared_ptr< EquityVolatilityCurveConfig > equityVolCurveConfig(const string &curveID) const
void add(const CurveSpec::CurveType &type, const string &curveId, const QuantLib::ext::shared_ptr< CurveConfig > &config)
QuantLib::ext::shared_ptr< CommodityVolatilityConfig > commodityVolatilityConfig(const std::string &curveID) const
void addNodes(XMLDocument &doc, XMLNode *parent, const char *nodeName) const
const ReportConfig & reportConfigEqVols() const
std::map< CurveSpec::CurveType, std::map< std::string, QuantLib::ext::shared_ptr< CurveConfig > > > configs_
void parseNode(const CurveSpec::CurveType &type, const string &curveId) const
QuantLib::ext::shared_ptr< SecurityConfig > securityConfig(const string &curveID) const
bool hasCapFloorVolCurveConfig(const std::string &curveID) const
bool hasBaseCorrelationCurveConfig(const std::string &curveID) const
QuantLib::ext::shared_ptr< FXVolatilityCurveConfig > fxVolCurveConfig(const string &curveID) const
bool hasSwaptionVolCurveConfig(const std::string &curveID) const
std::map< std::string, QuantLib::ext::shared_ptr< CurveConfigurations > > configs_
const bool has(std::string id=std::string()) const
void add(const QuantLib::ext::shared_ptr< CurveConfigurations > &config, std::string id=std::string())
const QuantLib::ext::shared_ptr< CurveConfigurations > & get(std::string id=std::string()) const
const std::map< std::string, QuantLib::ext::shared_ptr< CurveConfigurations > > & curveConfigurations() const
CurveType
Supported curve types.
Definition: curvespec.hpp:43
Small XML Document wrapper class.
Definition: xmlutils.hpp:65
Base class for all serializable classes.
Definition: xmlutils.hpp:101
Commodity curve configuration class.
Commodity volatility curve configuration.
Curve requirements specification.
Default curve configuration classes.
Equity curve configuration classes.
Equity volatility curve configuration classes.
security spread configuration classes
FX volatility curve configuration classes.
Inflation CapFloor volatility curve configuration class.
Inflation curve config.
@ data
Definition: log.hpp:77
rapidxml::xml_node< char > XMLNode
Definition: xmlutils.hpp:60
Serializable Credit Default Swap.
Definition: namespaces.docs:23
security spread configuration classes
Swaption volatility curve configuration classes.
A class to hold todays market configuration(s)
XML utility functions.
Yield curve configuration classes.
yield volatility curve configuration classes