Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
capfloorvolcurveconfig.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/capfloorvolcurveconfig.hpp
20 \brief Cap floor volatility curve configuration class
21 \ingroup configuration
22*/
23
24#pragma once
25
30#include <ql/termstructures/volatility/volatilitytype.hpp>
31#include <ql/time/calendar.hpp>
32#include <ql/time/daycounter.hpp>
33#include <ql/time/period.hpp>
34#include <ql/types.hpp>
37
38namespace ore {
39namespace data {
40
41/*! Cap floor volatility curve configuration class
42 \ingroup configuration
43 */
45public:
46 //! The type of volatility quotes that have been configured.
48
49 //! The type of structure that has been configured
51
52 //! Default constructor
54
55 //! Detailed constructor
57 const std::string& curveID, const std::string& curveDescription, const VolatilityType& volatilityType,
58 bool extrapolate, bool flatExtrapolation, bool inlcudeAtm, const std::vector<std::string>& tenors,
59 const std::vector<std::string>& strikes, const QuantLib::DayCounter& dayCounter, QuantLib::Natural settleDays,
60 const QuantLib::Calendar& calendar, const QuantLib::BusinessDayConvention& businessDayConvention,
61 const std::string& index, const QuantLib::Period& rateComputationPeriod,
62 const QuantLib::Size onCapSettlementDays, const std::string& discountCurve,
63 const std::string& interpolationMethod = "BicubicSpline", const std::string& interpolateOn = "TermVolatilities",
64 const std::string& timeInterpolation = "LinearFlat", const std::string& strikeInterpolation = "LinearFlat",
65 const std::vector<std::string>& atmTenors = {}, const BootstrapConfig& bootstrapConfig = BootstrapConfig(),
66 const string& inputType = "TermVolatilities",
67 const boost::optional<ParametricSmileConfiguration>& parametricSmileConfiguration = boost::none);
68
69 //! Detailled constructor for proxy config
70 CapFloorVolatilityCurveConfig(const std::string& curveID, const std::string& curveDescription,
71 const std::string& proxySourceCurveId, const std::string& proxySourceIndex,
72 const std::string& proxyTargetIndex,
73 const QuantLib::Period& proxySourceRateComputationPeriod = 0 * Days,
74 const QuantLib::Period& proxyTargetRateComputationPeriod = 0 * Days);
75
76 //! \name XMLSerializable interface
77 //@{
78 void fromXML(XMLNode* node) override;
79 XMLNode* toXML(XMLDocument& doc) const override;
80 //@}
81
82 //! \name Inspectors
83 //@{
86 bool extrapolate() const { return extrapolate_; }
87 bool flatExtrapolation() const { return flatExtrapolation_; }
88 bool includeAtm() const { return includeAtm_; }
89 const std::vector<std::string>& tenors() const { return tenors_; }
90 const std::vector<std::string>& strikes() const { return strikes_; }
91 bool optionalQuotes() const { return optionalQuotes_; }
92 const QuantLib::DayCounter& dayCounter() const { return dayCounter_; }
93 const QuantLib::Natural& settleDays() const { return settleDays_; }
94 const QuantLib::Calendar& calendar() const { return calendar_; }
95 const QuantLib::BusinessDayConvention& businessDayConvention() const { return businessDayConvention_; }
96 const std::string& index() const { return index_; }
97 const QuantLib::Period& rateComputationPeriod() const { return rateComputationPeriod_; }
98 QuantLib::Size onCapSettlementDays() const { return onCapSettlementDays_; }
99 const std::string& discountCurve() const { return discountCurve_; }
101 const std::string& interpolateOn() const { return interpolateOn_; }
102 const std::string& timeInterpolation() const { return timeInterpolation_; }
103 const std::string& strikeInterpolation() const { return strikeInterpolation_; }
105 const std::vector<std::string>& atmTenors() const { return atmTenors_; }
107 Type type() const { return type_; }
108 const string& currency() const;
109 string indexTenor() const;
110 //
111 const std::string& proxySourceCurveId() const { return proxySourceCurveId_; }
112 const std::string& proxySourceIndex() const { return proxySourceIndex_; }
113 const std::string& proxyTargetIndex() const { return proxyTargetIndex_; };
114 const QuantLib::Period& proxySourceRateComputationPeriod() const { return proxySourceRateComputationPeriod_; }
115 const QuantLib::Period& proxyTargetRateComputationPeriod() const { return proxyTargetRateComputationPeriod_; }
116 //
117 const boost::optional<ParametricSmileConfiguration> parametricSmileConfiguration() const {
119 }
120 //
121 const ReportConfig& reportConfig() const { return reportConfig_; }
122 //@}
123
124 //! Convert VolatilityType \p type to string
125 std::string toString(VolatilityType type) const;
126
127private:
129 bool extrapolate_ = true;
131 bool includeAtm_ = false;
132 std::vector<std::string> tenors_;
133 std::vector<std::string> strikes_;
134 bool optionalQuotes_ = false;
135 QuantLib::DayCounter dayCounter_;
136 QuantLib::Natural settleDays_ = 0;
138 QuantLib::BusinessDayConvention businessDayConvention_ = Following;
139 std::string index_;
140 QuantLib::Period rateComputationPeriod_;
141 QuantLib::Size onCapSettlementDays_ = 0;
142 std::string discountCurve_;
144 std::string interpolateOn_;
148 std::vector<std::string> atmTenors_;
151 std::string extrapolation_;
152 std::string inputType_;
153 //
155 std::string proxySourceIndex_;
156 std::string proxyTargetIndex_;
159 //
160 boost::optional<ParametricSmileConfiguration> parametricSmileConfiguration_;
161 //
163
164 //! Populate required curve ids
166
167 //! Populate the quotes vector
168 void populateQuotes();
169
170 /*! Set the values of \c extrapolate_ and \c flatExtrapolation_ based on the value of \p extrapolation.
171 The \p extrapolation string can take the values \c "Linear", \c "Flat" or \c "None".
172 - \c "Linear" is for backwards compatibility and means extrapolation is on and flat extrapolation is off
173 - \c "Flat" means extrapolation is on and it is flat
174 - \c "None" means extrapolation is off
175 */
176 void configureExtrapolation(const std::string& extrapolation);
177
178 //! Set the value of \c volatilityType_ based on the value of \p type
179 void configureVolatilityType(const std::string& type);
180
181 //! Set the value of \c type_ i.e. the type of cap floor structure that is configured
182 void configureType();
183
184 //! Validate the configuration
185 void validate() const;
186};
187
188//! Imply QuantLib::VolatilityType from CapFloorVolatilityCurveConfig::VolatilityType
190
191} // namespace data
192} // namespace ore
Class for holding bootstrap configurations.
void populateRequiredCurveIds()
Populate required curve ids.
void configureVolatilityType(const std::string &type)
Set the value of volatilityType_ based on the value of type.
CapFloorVolatilityCurveConfig(const std::string &curveID, const std::string &curveDescription, const VolatilityType &volatilityType, bool extrapolate, bool flatExtrapolation, bool inlcudeAtm, const std::vector< std::string > &tenors, const std::vector< std::string > &strikes, const QuantLib::DayCounter &dayCounter, QuantLib::Natural settleDays, const QuantLib::Calendar &calendar, const QuantLib::BusinessDayConvention &businessDayConvention, const std::string &index, const QuantLib::Period &rateComputationPeriod, const QuantLib::Size onCapSettlementDays, const std::string &discountCurve, const std::string &interpolationMethod="BicubicSpline", const std::string &interpolateOn="TermVolatilities", const std::string &timeInterpolation="LinearFlat", const std::string &strikeInterpolation="LinearFlat", const std::vector< std::string > &atmTenors={}, const BootstrapConfig &bootstrapConfig=BootstrapConfig(), const string &inputType="TermVolatilities", const boost::optional< ParametricSmileConfiguration > &parametricSmileConfiguration=boost::none)
Detailed constructor.
void populateQuotes()
Populate the quotes vector.
Type
The type of structure that has been configured.
const boost::optional< ParametricSmileConfiguration > parametricSmileConfiguration() const
const QuantLib::Natural & settleDays() const
const std::vector< std::string > & tenors() const
const QuantLib::Period & proxyTargetRateComputationPeriod() const
void configureType()
Set the value of type_ i.e. the type of cap floor structure that is configured.
const QuantLib::BusinessDayConvention & businessDayConvention() const
const QuantLib::Calendar & calendar() const
XMLNode * toXML(XMLDocument &doc) const override
const QuantLib::DayCounter & dayCounter() const
VolatilityType
The type of volatility quotes that have been configured.
const std::vector< std::string > & atmTenors() const
QuantLib::BusinessDayConvention businessDayConvention_
const BootstrapConfig & bootstrapConfig() const
void configureExtrapolation(const std::string &extrapolation)
void validate() const
Validate the configuration.
const QuantLib::Period & proxySourceRateComputationPeriod() const
const VolatilityType & volatilityType() const
const QuantLib::Period & rateComputationPeriod() const
QuantExt::CapFloorTermVolSurfaceExact::InterpolationMethod interpolationMethod() const
const std::vector< std::string > & strikes() const
boost::optional< ParametricSmileConfiguration > parametricSmileConfiguration_
std::string toString(VolatilityType type) const
Convert VolatilityType type to string.
Base curve configuration.
Definition: curveconfig.hpp:41
const string & curveDescription() const
Definition: curveconfig.hpp:55
const string & curveID() const
Definition: curveconfig.hpp:54
QuoteType
Supported market quote types.
Small XML Document wrapper class.
Definition: xmlutils.hpp:65
Base curve configuration classes.
@ data
Definition: log.hpp:77
Market data representation.
VolatilityType volatilityType(CapFloorVolatilityCurveConfig::VolatilityType type)
Imply QuantLib::VolatilityType from CapFloorVolatilityCurveConfig::VolatilityType.
Serializable Credit Default Swap.
Definition: namespaces.docs:23
Class for holding parametric smile configurations.
md report and arbitrage check configuration