Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
infjyparameterization.cpp
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
20#include <ql/utilities/dataformatters.hpp>
21
22using QuantLib::Array;
23using QuantLib::Parameter;
24using QuantLib::Real;
25using QuantLib::Size;
26using QuantLib::ZeroInflationIndex;
27using QuantLib::ZeroInflationTermStructure;
28
29namespace QuantExt {
30
32 QuantLib::ext::shared_ptr<Lgm1fParametrization<ZeroInflationTermStructure>> realRate,
33 QuantLib::ext::shared_ptr<FxBsParametrization> index,
34 QuantLib::ext::shared_ptr<ZeroInflationIndex> inflationIndex)
35 : Parametrization(realRate->currency(), realRate->name()),
36 realRate_(realRate), index_(index), inflationIndex_(inflationIndex) {}
37
38const Array& InfJyParameterization::parameterTimes(const Size i) const {
39 checkIndex(i);
40 if (i < 2) {
41 return realRate_->parameterTimes(i);
42 } else {
43 return index_->parameterTimes(0);
44 }
45}
46
47const QuantLib::ext::shared_ptr<Parameter> InfJyParameterization::parameter(const Size i) const {
48 checkIndex(i);
49 if (i < 2) {
50 return realRate_->parameter(i);
51 } else {
52 return index_->parameter(0);
53 }
54}
55
57 realRate_->update();
58 index_->update();
59}
60
61QuantLib::ext::shared_ptr<Lgm1fParametrization<ZeroInflationTermStructure>> InfJyParameterization::realRate() const {
62 return realRate_;
63}
64
65QuantLib::ext::shared_ptr<FxBsParametrization> InfJyParameterization::index() const {
66 return index_;
67}
68
69QuantLib::ext::shared_ptr<ZeroInflationIndex> InfJyParameterization::inflationIndex() const {
70 return inflationIndex_;
71}
72
73Real InfJyParameterization::direct(const Size i, const Real x) const {
74 checkIndex(i);
75 if (i < 2) {
76 return realRate_->direct(i, x);
77 } else {
78 return index_->direct(0, x);
79 }
80}
81
82Real InfJyParameterization::inverse(const Size i, const Real y) const {
83 checkIndex(i);
84 if (i < 2) {
85 return realRate_->inverse(i, y);
86 } else {
87 return index_->inverse(i, y);
88 }
89}
90
92 QL_REQUIRE(i < 3, "InfJyParameterization has 3 parameters but has been asked for its " << io::ordinal(i + 1));
93}
94
95}
96
const QuantLib::Array & parameterTimes(const QuantLib::Size i) const override
QuantLib::ext::shared_ptr< Lgm1fParametrization< QuantLib::ZeroInflationTermStructure > > realRate() const
QuantLib::Real inverse(const QuantLib::Size i, const QuantLib::Real y) const override
QuantLib::ext::shared_ptr< QuantLib::ZeroInflationIndex > inflationIndex() const
QuantLib::ext::shared_ptr< FxBsParametrization > index() const
InfJyParameterization(QuantLib::ext::shared_ptr< Lgm1fParametrization< QuantLib::ZeroInflationTermStructure > > realRate, QuantLib::ext::shared_ptr< FxBsParametrization > index, QuantLib::ext::shared_ptr< QuantLib::ZeroInflationIndex > inflationIndex)
QuantLib::ext::shared_ptr< FxBsParametrization > index_
void checkIndex(QuantLib::Size i) const
Check that the indexing.
const QuantLib::ext::shared_ptr< QuantLib::Parameter > parameter(const QuantLib::Size i) const override
QuantLib::Real direct(const QuantLib::Size i, const QuantLib::Real x) const override
QuantLib::ext::shared_ptr< Lgm1fParametrization< QuantLib::ZeroInflationTermStructure > > realRate_
QuantLib::ext::shared_ptr< QuantLib::ZeroInflationIndex > inflationIndex_
Jarrow Yildrim inflation parameterization.