Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
spreadedinflationcurve.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 spreadedinflationcurve.hpp
20 \brief spreaded inflation term structure
21 \ingroup termstructures
22*/
23
24#pragma once
25
26#include <ql/math/interpolations/loginterpolation.hpp>
27#include <ql/patterns/lazyobject.hpp>
28#include <ql/termstructures/inflationtermstructure.hpp>
29
30#include <boost/make_shared.hpp>
31
32namespace QuantExt {
33using namespace QuantLib;
34
35class SpreadedZeroInflationCurve : public ZeroInflationTermStructure, public LazyObject {
36public:
37 //! times should be consistent with reference ts day counter
38 SpreadedZeroInflationCurve(const Handle<ZeroInflationTermStructure>& referenceCurve, const std::vector<Time>& times,
39 const std::vector<Handle<Quote>>& quotes);
40
41 Date maxDate() const override;
42 void update() override;
43 const Date& referenceDate() const override;
44
45 Calendar calendar() const override;
46 Natural settlementDays() const override;
47
48 Date baseDate() const override;
49
50protected:
51 void performCalculations() const override;
52 Rate zeroRateImpl(Time t) const override;
53
54private:
55 Handle<ZeroInflationTermStructure> referenceCurve_;
56 std::vector<Time> times_;
57 std::vector<Handle<Quote>> quotes_;
58 mutable std::vector<Real> data_;
59 QuantLib::ext::shared_ptr<Interpolation> interpolation_;
60};
61
62class SpreadedYoYInflationCurve : public YoYInflationTermStructure, public LazyObject {
63public:
64 //! times should be consistent with reference ts day counter
65 SpreadedYoYInflationCurve(const Handle<YoYInflationTermStructure>& referenceCurve, const std::vector<Time>& times,
66 const std::vector<Handle<Quote>>& quotes);
67
68 Date maxDate() const override;
69 void update() override;
70 const Date& referenceDate() const override;
71
72 Calendar calendar() const override;
73 Natural settlementDays() const override;
74
75 Date baseDate() const override;
76
77protected:
78 void performCalculations() const override;
79 Rate yoyRateImpl(Time t) const override;
80
81private:
82 Handle<YoYInflationTermStructure> referenceCurve_;
83 std::vector<Time> times_;
84 std::vector<Handle<Quote>> quotes_;
85 mutable std::vector<Real> data_;
86 QuantLib::ext::shared_ptr<Interpolation> interpolation_;
87};
88
89} // namespace QuantExt
const Date & referenceDate() const override
Handle< YoYInflationTermStructure > referenceCurve_
std::vector< Handle< Quote > > quotes_
QuantLib::ext::shared_ptr< Interpolation > interpolation_
const Date & referenceDate() const override
std::vector< Handle< Quote > > quotes_
Handle< ZeroInflationTermStructure > referenceCurve_
QuantLib::ext::shared_ptr< Interpolation > interpolation_