Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
capfloorvolcurve.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/marketdata/capfloorvolcurve.hpp
20 \brief Build optionlet volatility structures from cap floor configurations
21 \ingroup curves
22*/
23
24#pragma once
25
30#include <ql/termstructures/volatility/optionlet/optionletvolatilitystructure.hpp>
31#include <ql/termstructures/volatility/optionlet/strippedoptionlet.hpp>
35
36namespace ore {
37namespace data {
38
39/*! Class for building optionlet volatility structures from cap floor configurations
40 \ingroup curves
41*/
43
44public:
45 //! Default constructor
47
48 //! Detailed constructor
50 const QuantLib::Date& asof, const CapFloorVolatilityCurveSpec& spec, const Loader& loader,
51 const CurveConfigurations& curveConfigs, QuantLib::ext::shared_ptr<QuantLib::IborIndex> iborIndex,
52 QuantLib::Handle<QuantLib::YieldTermStructure> discountCurve, const QuantLib::ext::shared_ptr<IborIndex> sourceIndex,
53 const QuantLib::ext::shared_ptr<IborIndex> targetIndex,
54 const std::map<std::string, std::pair<QuantLib::ext::shared_ptr<ore::data::CapFloorVolCurve>,
55 std::pair<std::string, QuantLib::Period>>>& requiredCapFloorVolCurves,
56 const bool buildCalibrationInfo);
57
58 //! \name Inspectors
59 //@{
60 //! The cap floor curve specification
61 const CapFloorVolatilityCurveSpec& spec() const { return spec_; }
62
63 //! The result of building the optionlet structure that has been configured
64 const QuantLib::ext::shared_ptr<QuantLib::OptionletVolatilityStructure>& capletVolStructure() const { return capletVol_; }
65 QuantLib::ext::shared_ptr<IrVolCalibrationInfo> calibrationInfo() const { return calibrationInfo_; }
66 //@}
67
68private:
70 QuantLib::ext::shared_ptr<QuantLib::OptionletVolatilityStructure> capletVol_;
71 QuantLib::ext::shared_ptr<IrVolCalibrationInfo> calibrationInfo_;
72
73 //! Build ATM optionlet curve from term vol
74 void termAtmOptCurve(const QuantLib::Date& asof, CapFloorVolatilityCurveConfig& config, const Loader& loader,
75 QuantLib::ext::shared_ptr<QuantLib::IborIndex> iborIndex,
76 QuantLib::Handle<QuantLib::YieldTermStructure> discountCurve, QuantLib::Real shift);
77
78 //! Build optionlet surface from term vol
79 void termOptSurface(const QuantLib::Date& asof, CapFloorVolatilityCurveConfig& config, const Loader& loader,
80 QuantLib::ext::shared_ptr<QuantLib::IborIndex> iborIndex,
81 QuantLib::Handle<QuantLib::YieldTermStructure> discountCurve, QuantLib::Real shift);
82
83 //! Build ATM optionlet curve from optionlet vol
84 void optAtmOptCurve(const QuantLib::Date& asof, CapFloorVolatilityCurveConfig& config, const Loader& loader,
85 QuantLib::ext::shared_ptr<QuantLib::IborIndex> iborIndex,
86 QuantLib::Handle<QuantLib::YieldTermStructure> discountCurve, QuantLib::Real shift);
87
88 //! Build optionlet surface from optionlet vol
89 void optOptSurface(const QuantLib::Date& asof, CapFloorVolatilityCurveConfig& config, const Loader& loader,
90 QuantLib::ext::shared_ptr<QuantLib::IborIndex> iborIndex,
91 QuantLib::Handle<QuantLib::YieldTermStructure> discountCurve, QuantLib::Real shift);
92
93 //! Build a cap floor term volatility surface
94 QuantLib::ext::shared_ptr<QuantExt::CapFloorTermVolSurface>
95 capSurface(const QuantLib::Date& asof, CapFloorVolatilityCurveConfig& config, const Loader& loader) const;
96
97 //! Build an ATM cap floor term volatility curve
98 QuantLib::ext::shared_ptr<QuantExt::CapFloorTermVolCurve>
99 atmCurve(const QuantLib::Date& asof, CapFloorVolatilityCurveConfig& config, const Loader& loader) const;
100
101 //! Build proxy curve
102 void buildProxyCurve(
103 const CapFloorVolatilityCurveConfig& config, const QuantLib::ext::shared_ptr<IborIndex>& sourceIndex,
104 const QuantLib::ext::shared_ptr<IborIndex>& targetIndex,
105 const std::map<std::string, std::pair<QuantLib::ext::shared_ptr<ore::data::CapFloorVolCurve>,
106 std::pair<std::string, QuantLib::Period>>>& requiredCapFloorVolCurves);
107
108 //! Get a shift quote value from the configured quotes
109 Real shiftQuote(const QuantLib::Date& asof, CapFloorVolatilityCurveConfig& config, const Loader& loader) const;
110
111 //! Transform QuantExt::OptionletStripper to QuantLib::StrippedOptionlet
112 QuantLib::ext::shared_ptr<QuantLib::StrippedOptionlet> transform(const QuantExt::OptionletStripper& os) const;
113
114 //! Create a stripped optionlet curve from ATM optionlet dates and optionlet vols
115 QuantLib::ext::shared_ptr<QuantLib::StrippedOptionlet>
116 transform(const QuantLib::Date& asof, std::vector<QuantLib::Date> dates,
117 const std::vector<QuantLib::Volatility>& volatilities, QuantLib::Natural settleDays,
118 const QuantLib::Calendar& cal, QuantLib::BusinessDayConvention bdc,
119 QuantLib::ext::shared_ptr<QuantLib::IborIndex> iborIndex, const QuantLib::DayCounter& dc,
120 QuantLib::VolatilityType type, QuantLib::Real displacement) const;
121
122 //! Generate fixing days from end date for optionlet vol
123 vector<Date> populateFixingDates(const QuantLib::Date& asof, CapFloorVolatilityCurveConfig& config,
124 QuantLib::ext::shared_ptr<QuantLib::IborIndex> iborIndex, const vector<Period>& configTenors);
125
126 //! Build calibration info
127 void buildCalibrationInfo(const Date& asof, const CurveConfigurations& curveConfigs,
128 const QuantLib::ext::shared_ptr<CapFloorVolatilityCurveConfig> config,
129 const QuantLib::ext::shared_ptr<IborIndex>& iborIndex);
130};
131
132} // namespace data
133} // namespace ore
Real shiftQuote(const QuantLib::Date &asof, CapFloorVolatilityCurveConfig &config, const Loader &loader) const
Get a shift quote value from the configured quotes.
CapFloorVolCurve(const QuantLib::Date &asof, const CapFloorVolatilityCurveSpec &spec, const Loader &loader, const CurveConfigurations &curveConfigs, QuantLib::ext::shared_ptr< QuantLib::IborIndex > iborIndex, QuantLib::Handle< QuantLib::YieldTermStructure > discountCurve, const QuantLib::ext::shared_ptr< IborIndex > sourceIndex, const QuantLib::ext::shared_ptr< IborIndex > targetIndex, const std::map< std::string, std::pair< QuantLib::ext::shared_ptr< ore::data::CapFloorVolCurve >, std::pair< std::string, QuantLib::Period > > > &requiredCapFloorVolCurves, const bool buildCalibrationInfo)
Detailed constructor.
QuantLib::ext::shared_ptr< IrVolCalibrationInfo > calibrationInfo_
QuantLib::ext::shared_ptr< QuantLib::StrippedOptionlet > transform(const QuantExt::OptionletStripper &os) const
Transform QuantExt::OptionletStripper to QuantLib::StrippedOptionlet.
QuantLib::ext::shared_ptr< QuantExt::CapFloorTermVolSurface > capSurface(const QuantLib::Date &asof, CapFloorVolatilityCurveConfig &config, const Loader &loader) const
Build a cap floor term volatility surface.
CapFloorVolCurve()
Default constructor.
void buildCalibrationInfo(const Date &asof, const CurveConfigurations &curveConfigs, const QuantLib::ext::shared_ptr< CapFloorVolatilityCurveConfig > config, const QuantLib::ext::shared_ptr< IborIndex > &iborIndex)
Build calibration info.
QuantLib::ext::shared_ptr< IrVolCalibrationInfo > calibrationInfo() const
QuantLib::ext::shared_ptr< QuantExt::CapFloorTermVolCurve > atmCurve(const QuantLib::Date &asof, CapFloorVolatilityCurveConfig &config, const Loader &loader) const
Build an ATM cap floor term volatility curve.
QuantLib::ext::shared_ptr< QuantLib::StrippedOptionlet > transform(const QuantLib::Date &asof, std::vector< QuantLib::Date > dates, const std::vector< QuantLib::Volatility > &volatilities, QuantLib::Natural settleDays, const QuantLib::Calendar &cal, QuantLib::BusinessDayConvention bdc, QuantLib::ext::shared_ptr< QuantLib::IborIndex > iborIndex, const QuantLib::DayCounter &dc, QuantLib::VolatilityType type, QuantLib::Real displacement) const
Create a stripped optionlet curve from ATM optionlet dates and optionlet vols.
void termOptSurface(const QuantLib::Date &asof, CapFloorVolatilityCurveConfig &config, const Loader &loader, QuantLib::ext::shared_ptr< QuantLib::IborIndex > iborIndex, QuantLib::Handle< QuantLib::YieldTermStructure > discountCurve, QuantLib::Real shift)
Build optionlet surface from term vol.
CapFloorVolatilityCurveSpec spec_
void optOptSurface(const QuantLib::Date &asof, CapFloorVolatilityCurveConfig &config, const Loader &loader, QuantLib::ext::shared_ptr< QuantLib::IborIndex > iborIndex, QuantLib::Handle< QuantLib::YieldTermStructure > discountCurve, QuantLib::Real shift)
Build optionlet surface from optionlet vol.
const CapFloorVolatilityCurveSpec & spec() const
The cap floor curve specification.
void termAtmOptCurve(const QuantLib::Date &asof, CapFloorVolatilityCurveConfig &config, const Loader &loader, QuantLib::ext::shared_ptr< QuantLib::IborIndex > iborIndex, QuantLib::Handle< QuantLib::YieldTermStructure > discountCurve, QuantLib::Real shift)
Build ATM optionlet curve from term vol.
void optAtmOptCurve(const QuantLib::Date &asof, CapFloorVolatilityCurveConfig &config, const Loader &loader, QuantLib::ext::shared_ptr< QuantLib::IborIndex > iborIndex, QuantLib::Handle< QuantLib::YieldTermStructure > discountCurve, QuantLib::Real shift)
Build ATM optionlet curve from optionlet vol.
QuantLib::ext::shared_ptr< QuantLib::OptionletVolatilityStructure > capletVol_
const QuantLib::ext::shared_ptr< QuantLib::OptionletVolatilityStructure > & capletVolStructure() const
The result of building the optionlet structure that has been configured.
vector< Date > populateFixingDates(const QuantLib::Date &asof, CapFloorVolatilityCurveConfig &config, QuantLib::ext::shared_ptr< QuantLib::IborIndex > iborIndex, const vector< Period > &configTenors)
Generate fixing days from end date for optionlet vol.
void buildProxyCurve(const CapFloorVolatilityCurveConfig &config, const QuantLib::ext::shared_ptr< IborIndex > &sourceIndex, const QuantLib::ext::shared_ptr< IborIndex > &targetIndex, const std::map< std::string, std::pair< QuantLib::ext::shared_ptr< ore::data::CapFloorVolCurve >, std::pair< std::string, QuantLib::Period > > > &requiredCapFloorVolCurves)
Build proxy curve.
Cap/Floor Volatility curve description.
Definition: curvespec.hpp:239
Container class for all Curve Configurations.
Market data loader base class.
Definition: loader.hpp:47
Curve configuration repository.
Curve requirements specification.
Market Datum Loader Interface.
@ data
Definition: log.hpp:77
Serializable Credit Default Swap.
Definition: namespaces.docs:23
vector< string > curveConfigs
a container holding information on calibration results during the t0 market build