Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
zeroinflationmodeltermstructure.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2020 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 qle/models/zeroinflationmodeltermstructure.hpp
20 \brief zero inflation term structure implied by a cross asset model
21 \ingroup models
22*/
23
24#ifndef quantext_zero_inflation_model_term_structure_hpp
25#define quantext_zero_inflation_model_term_structure_hpp
26
28#include <ql/termstructures/inflationtermstructure.hpp>
29
30namespace QuantExt {
31
32/*! Base class for cross asset model implied zero inflation term structures.
33
34 The termstructure has the reference date of the model's term structure at construction, but you can vary this as
35 well as the state. This purely time based variant is mainly here for performance reasons. Note that it does not
36 provide the full term structure interface and does not send notifications on reference time updates.
37
38 \ingroup models
39*/
40
41class ZeroInflationModelTermStructure : public QuantLib::ZeroInflationTermStructure {
42public:
43 /*! Constructor taking the cross asset model, \p model, and the index of the relevant inflation component within
44 the model, \p index.
45 */
46 ZeroInflationModelTermStructure(const QuantLib::ext::shared_ptr<CrossAssetModel>& model, QuantLib::Size index);
47
48 // Deprecated constructor with interpolated index, index is always flat and the coupon is responsible for interpolation
49 QL_DEPRECATED
50 ZeroInflationModelTermStructure(const QuantLib::ext::shared_ptr<CrossAssetModel>& model, QuantLib::Size index, bool indexIsInterpolated);
51
52 //! \name Observer interface
53 //@{
54 void update() override;
55 //@}
56
57 //! \name TermStructure interface
58 //@{
59 QuantLib::Date maxDate() const override;
60 QuantLib::Time maxTime() const override;
61 const QuantLib::Date& referenceDate() const override;
62 //@}
63
64 //! \name InflationTermStructure interface
65 //@{
66 QuantLib::Date baseDate() const override;
67 //@}
68
69 //! Set the reference date
70 virtual void referenceDate(const QuantLib::Date& d);
71
72 //! Set the current state variables
73 void state(const QuantLib::Array& s);
74
75 //! Set the current state and move the reference date to date \p d
76 void move(const QuantLib::Date& d, const QuantLib::Array& s);
77
78protected:
79 QuantLib::ext::shared_ptr<CrossAssetModel> model_;
80 QuantLib::Size index_;
81 QL_DEPRECATED bool indexIsInterpolated_;
82 // Hides referenceDate_ in TermStructure.
83 QuantLib::Date referenceDate_;
84 QuantLib::Time relativeTime_;
85 QuantLib::Array state_;
86
87 /*! Override this method to perform checks on the state variable array when the \c state and \c move methods are
88 called.
89 */
90 virtual void checkState() const {}
91};
92
93}
94
95#endif
ZeroInflationModelTermStructure(const QuantLib::ext::shared_ptr< CrossAssetModel > &model, QuantLib::Size index)
QL_DEPRECATED ZeroInflationModelTermStructure(const QuantLib::ext::shared_ptr< CrossAssetModel > &model, QuantLib::Size index, bool indexIsInterpolated)
virtual void referenceDate(const QuantLib::Date &d)
Set the reference date.
const QuantLib::Date & referenceDate() const override
void state(const QuantLib::Array &s)
Set the current state variables.
void move(const QuantLib::Date &d, const QuantLib::Array &s)
Set the current state and move the reference date to date d.
QuantLib::ext::shared_ptr< CrossAssetModel > model_
cross asset model