Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
dkimpliedzeroinflationtermstructure.cpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2017 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
21using QuantLib::Date;
22using QuantLib::Size;
23using QuantLib::Time;
24
25namespace QuantExt {
26
28 const QuantLib::ext::shared_ptr<CrossAssetModel>& model, Size index)
29 : ZeroInflationModelTermStructure(model, index) {}
30
31QL_DEPRECATED_DISABLE_WARNING
32DkImpliedZeroInflationTermStructure::DkImpliedZeroInflationTermStructure(
33 const QuantLib::ext::shared_ptr<CrossAssetModel>& model, Size index, bool indexIsInterpolated)
34 : ZeroInflationModelTermStructure(model, index, indexIsInterpolated) {}
35QL_DEPRECATED_ENABLE_WARNING
36
37Real DkImpliedZeroInflationTermStructure::zeroRateImpl(Time t) const {
38 QL_REQUIRE(t >= 0.0, "DkImpliedZeroInflationTermStructure::zeroRateImpl: negative time (" << t << ") given");
39 auto p = model_->infdkI(index_, relativeTime_, relativeTime_ + t, state_[0], state_[1]);
40 return std::pow(p.second, 1 / t) - 1;
41}
42
43void DkImpliedZeroInflationTermStructure::checkState() const {
44 // For DK, expect the state to be two variables i.e. z_I and y_I.
45 QL_REQUIRE(state_.size() == 2, "DkImpliedZeroInflationTermStructure: expected state to have " <<
46 "two elements but got " << state_.size());
47}
48
49}
DkImpliedZeroInflationTermStructure(const QuantLib::ext::shared_ptr< CrossAssetModel > &model, QuantLib::Size index)
zero inflation term structure implied by a Dodgson Kainth (DK) model