Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
infdkbuilder.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/model/inflation/infdkbuilder.hpp
20 \brief Builder for a Dodgson-Kainth inflation model component
21 \ingroup models
22*/
23
24#pragma once
25
30
31#include <map>
32#include <ostream>
33#include <vector>
34
35namespace ore {
36namespace data {
37
38/*! Builder for a Dodgson-Kainth inflation model component
39
40 This class is a utility to turn a Dodgson-Kainth inflation model component description into an inflation model
41 parameterization which can be used to instantiate a CrossAssetModel.
42
43 \ingroup models
44*/
46public:
47 /*! Constructor
48 \param market Market object
49 \param data Dodgson-Kainth inflation model description
50 \param configuration Market configuration to use
51 \param referenceCalibrationGrid The reference calibration grid
52 \param dontCalibrate Flag to use a dummy basecpi for the dependency market run
53 */
55 const QuantLib::ext::shared_ptr<ore::data::Market>& market,
56 const QuantLib::ext::shared_ptr<InfDkData>& data,
57 const std::string& configuration = Market::defaultConfiguration,
58 const std::string& referenceCalibrationGrid = "",
59 const bool dontCalibrate = false);
60
61 //! \name Inspectors
62 //@{
63 std::string infIndex() { return data_->index(); }
64 QuantLib::ext::shared_ptr<QuantExt::InfDkParametrization> parametrization() const;
65 std::vector<QuantLib::ext::shared_ptr<BlackCalibrationHelper>> optionBasket() const;
66 //@}
67
68 //! \name ModelBuilder interface
69 //@{
70 void forceRecalculate() override;
71 bool requiresRecalibration() const override;
72 //@}
73
74 void setCalibrationDone() const;
75
76private:
77 void performCalculations() const override;
78 Real optionStrikeValue(const Size j) const;
79 Date optionMaturityDate(const Size j) const;
80 void buildCapFloorBasket() const;
81
82 // checks whether inf vols have changed compared to cache and updates the cache if requested
83 bool volSurfaceChanged(const bool updateCache) const;
84
85 // input data
86 const QuantLib::ext::shared_ptr<ore::data::Market> market_;
87 const std::string configuration_;
88 const QuantLib::ext::shared_ptr<InfDkData> data_;
89 const std::string referenceCalibrationGrid_;
90
91 // computed
92 QuantLib::ext::shared_ptr<QuantExt::InfDkParametrization> parametrization_;
93
94 // which option in data->optionExpries() are actually in the basket?
95 mutable std::vector<bool> optionActive_;
96 mutable std::vector<QuantLib::ext::shared_ptr<BlackCalibrationHelper>> optionBasket_;
97 mutable QuantLib::Array optionExpiries_;
98
99 // market data
100 QuantLib::ext::shared_ptr<QuantLib::ZeroInflationIndex> inflationIndex_;
101 Handle<YieldTermStructure> rateCurve_;
102 QuantLib::Handle<QuantLib::CPIVolatilitySurface> infVol_;
103
104 // Cache the fx volatilities
105 mutable std::vector<QuantLib::Real> infPriceCache_;
106
107 // helper flag to process forRecalculate()
108 bool forceCalibration_ = false;
109
110 // helper flag for process the DependencyMarket
111 bool dontCalibrate_ = false;
112
113 // market observer
114 QuantLib::ext::shared_ptr<QuantExt::MarketObserver> marketObserver_;
115};
116
117} // namespace data
118} // namespace ore
QuantLib::ext::shared_ptr< QuantExt::InfDkParametrization > parametrization() const
QuantLib::ext::shared_ptr< QuantExt::InfDkParametrization > parametrization_
const std::string configuration_
void forceRecalculate() override
void performCalculations() const override
bool volSurfaceChanged(const bool updateCache) const
const QuantLib::ext::shared_ptr< InfDkData > data_
QuantLib::ext::shared_ptr< QuantExt::MarketObserver > marketObserver_
QuantLib::Array optionExpiries_
std::vector< QuantLib::ext::shared_ptr< BlackCalibrationHelper > > optionBasket() const
std::vector< QuantLib::Real > infPriceCache_
std::vector< QuantLib::ext::shared_ptr< BlackCalibrationHelper > > optionBasket_
void setCalibrationDone() const
bool requiresRecalibration() const override
QuantLib::Handle< QuantLib::CPIVolatilitySurface > infVol_
Handle< YieldTermStructure > rateCurve_
const QuantLib::ext::shared_ptr< ore::data::Market > market_
void buildCapFloorBasket() const
const std::string referenceCalibrationGrid_
std::vector< bool > optionActive_
Real optionStrikeValue(const Size j) const
QuantLib::ext::shared_ptr< QuantLib::ZeroInflationIndex > inflationIndex_
Date optionMaturityDate(const Size j) const
static const string defaultConfiguration
Default configuration label.
Definition: market.hpp:296
Dodgson Kainth inflation model component data for the cross asset model.
@ data
Definition: log.hpp:77
Base Market class.
Serializable Credit Default Swap.
Definition: namespaces.docs:23