1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
|
/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
Copyright (C) 2007, 2009 Chris Kenyon
Copyright (C) 2007 StatPro Italia srl
This file is part of QuantLib, a free-software/open-source library
for financial quantitative analysts and developers - http://quantlib.org/
QuantLib is free software: you can redistribute it and/or modify it
under the terms of the QuantLib license. You should have received a
copy of the license along with this program; if not, please email
<quantlib-dev@lists.sf.net>. The license is also available online at
<https://www.quantlib.org/license.shtml>.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the license for more details.
*/
/*! \file inflationhelpers.hpp
\brief Bootstrap helpers for inflation term structures
*/
#ifndef quantlib_inflation_helpers_hpp
#define quantlib_inflation_helpers_hpp
#include <ql/instruments/yearonyearinflationswap.hpp>
#include <ql/instruments/zerocouponinflationswap.hpp>
#include <ql/termstructures/bootstraphelper.hpp>
#include <ql/termstructures/inflationtermstructure.hpp>
namespace QuantLib {
//! Zero-coupon inflation-swap bootstrap helper
class ZeroCouponInflationSwapHelper
: public RelativeDateBootstrapHelper<ZeroInflationTermStructure> {
public:
ZeroCouponInflationSwapHelper(
const Handle<Quote>& quote,
const Period& swapObsLag, // lag on swap observation of index
const Date& maturity,
Calendar calendar, // index may have null calendar as valid on every day
BusinessDayConvention paymentConvention,
DayCounter dayCounter,
const ext::shared_ptr<ZeroInflationIndex>& zii,
CPI::InterpolationType observationInterpolation);
ZeroCouponInflationSwapHelper(
const Handle<Quote>& quote,
const Period& swapObsLag, // lag on swap observation of index
const Date& startDate,
const Date& endDate,
Calendar calendar, // index may have null calendar as valid on every day
BusinessDayConvention paymentConvention,
DayCounter dayCounter,
const ext::shared_ptr<ZeroInflationIndex>& zii,
CPI::InterpolationType observationInterpolation);
/*! \deprecated Use the overload that does not take a nominal curve.
Deprecated in version 1.39.
*/
[[deprecated("Use the overload that does not take a nominal curve.")]]
ZeroCouponInflationSwapHelper(
const Handle<Quote>& quote,
const Period& swapObsLag,
const Date& maturity,
Calendar calendar,
BusinessDayConvention paymentConvention,
DayCounter dayCounter,
const ext::shared_ptr<ZeroInflationIndex>& zii,
CPI::InterpolationType observationInterpolation,
Handle<YieldTermStructure> nominalTermStructure);
void setTermStructure(ZeroInflationTermStructure*) override;
Real impliedQuote() const override;
//! \name inspectors
//@{
// NOLINTNEXTLINE(cppcoreguidelines-noexcept-swap,performance-noexcept-swap)
ext::shared_ptr<ZeroCouponInflationSwap> swap() const { return zciis_; }
//@}
protected:
void initializeDates() override;
Period swapObsLag_;
Date startDate_, maturity_;
Calendar calendar_;
BusinessDayConvention paymentConvention_;
DayCounter dayCounter_;
ext::shared_ptr<ZeroInflationIndex> zii_;
CPI::InterpolationType observationInterpolation_;
ext::shared_ptr<ZeroCouponInflationSwap> zciis_;
Handle<YieldTermStructure> nominalTermStructure_;
RelinkableHandle<ZeroInflationTermStructure> termStructureHandle_;
private:
ZeroCouponInflationSwapHelper(
const Handle<Quote>& quote,
const Period& swapObsLag,
const Date& startDate,
const Date& endDate,
Calendar calendar,
BusinessDayConvention paymentConvention,
DayCounter dayCounter,
const ext::shared_ptr<ZeroInflationIndex>& zii,
CPI::InterpolationType observationInterpolation,
Handle<YieldTermStructure> nominalTermStructure);
};
//! Year-on-year inflation-swap bootstrap helper
class YearOnYearInflationSwapHelper
: public RelativeDateBootstrapHelper<YoYInflationTermStructure> {
public:
YearOnYearInflationSwapHelper(const Handle<Quote>& quote,
const Period& swapObsLag,
const Date& maturity,
Calendar calendar,
BusinessDayConvention paymentConvention,
DayCounter dayCounter,
const ext::shared_ptr<YoYInflationIndex>& yii,
CPI::InterpolationType interpolation,
Handle<YieldTermStructure> nominalTermStructure);
YearOnYearInflationSwapHelper(const Handle<Quote>& quote,
const Period& swapObsLag,
const Date& startDate,
const Date& endDate,
Calendar calendar,
BusinessDayConvention paymentConvention,
DayCounter dayCounter,
const ext::shared_ptr<YoYInflationIndex>& yii,
CPI::InterpolationType interpolation,
Handle<YieldTermStructure> nominalTermStructure);
void setTermStructure(YoYInflationTermStructure*) override;
Real impliedQuote() const override;
//! \name inspectors
//@{
// NOLINTNEXTLINE(cppcoreguidelines-noexcept-swap,performance-noexcept-swap)
ext::shared_ptr<YearOnYearInflationSwap> swap() const { return yyiis_; }
//@}
protected:
void initializeDates() override;
Period swapObsLag_;
Date startDate_, maturity_;
Calendar calendar_;
BusinessDayConvention paymentConvention_;
DayCounter dayCounter_;
ext::shared_ptr<YoYInflationIndex> yii_;
CPI::InterpolationType interpolation_;
ext::shared_ptr<YearOnYearInflationSwap> yyiis_;
Handle<YieldTermStructure> nominalTermStructure_;
RelinkableHandle<YoYInflationTermStructure> termStructureHandle_;
};
}
#endif
|