25#ifndef quantlib_cpicoupon_hpp
26#define quantlib_cpicoupon_hpp
36 class CPICouponPricer;
60 const Date& paymentDate,
62 const Date& startDate,
64 const ext::shared_ptr<ZeroInflationIndex>&
index,
74 const Date& paymentDate,
76 const Date& startDate,
78 const ext::shared_ptr<ZeroInflationIndex>&
index,
89 const Date& paymentDate,
91 const Date& startDate,
93 const ext::shared_ptr<ZeroInflationIndex>&
index,
107 const Date& paymentDate,
109 const Date& startDate,
111 const ext::shared_ptr<ZeroInflationIndex>&
index,
117 const Date& refPeriodStart =
Date(),
126 const Date& paymentDate,
128 const Date& startDate,
130 const ext::shared_ptr<ZeroInflationIndex>&
index,
136 const Date& refPeriodStart =
Date(),
146 const Date& paymentDate,
148 const Date& startDate,
150 const ext::shared_ptr<ZeroInflationIndex>&
index,
156 const Date& refPeriodStart =
Date(),
173 [[deprecated(
"Do not use this method. A spread doesn't make sense for this coupon.")]]
190 ext::shared_ptr<ZeroInflationIndex>
cpiIndex()
const;
219 [[deprecated(
"Do not use this data member. A spread doesn't make sense for this coupon.")]]
224 bool checkPricerImpl(
const ext::shared_ptr<InflationCouponPricer>&)
const override;
233 const ext::shared_ptr<ZeroInflationIndex>&
index,
239 const Date& paymentDate,
256 ext::shared_ptr<ZeroInflationIndex>
cpiIndex()
const;
280 ext::shared_ptr<ZeroInflationIndex> index,
282 const Period& observationLag);
295 [[deprecated(
"Do not use this method. A spread doesn't make sense for these coupons.")]]
300 [[deprecated(
"Do not use this method. A spread doesn't make sense for these coupons.")]]
309 bool endOfMonth =
false);
312 operator Leg()
const;
316 ext::shared_ptr<ZeroInflationIndex>
index_;
371 return ext::dynamic_pointer_cast<ZeroInflationIndex>(
index());
376 return ext::dynamic_pointer_cast<ZeroInflationIndex>(
index());
degenerate base class for the Acyclic Visitor pattern
Cash flow paying the performance of a CPI (zero inflation) index.
Date observationDate() const
ext::shared_ptr< ZeroInflationIndex > cpiIndex() const
CPI::InterpolationType interpolation_
Date baseDate() const override
you may not have a valid date
Real amount() const override
returns the amount of the cash flow
Real baseFixing() const override
value used on base date
Period observationLag() const
virtual Frequency frequency() const
Real indexFixing() const override
virtual CPI::InterpolationType interpolation() const
do you want linear/constant/as-index interpolation of future data?
Coupon paying the performance of a CPI (zero inflation) index
bool checkPricerImpl(const ext::shared_ptr< InflationCouponPricer > &) const override
makes sure you were given the correct type of pricer
void accept(AcyclicVisitor &) override
Rate baseCPI() const
base value for the CPI index
Rate indexFixing() const override
the index value observed (with a lag) at the end date
ext::shared_ptr< ZeroInflationIndex > cpiIndex() const
index used
CPI::InterpolationType observationInterpolation() const
how do you observe the index? as-is, flat, linear?
QL_DEPRECATED_DISABLE_WARNING ~CPICoupon() override=default
Rate indexRatio(Date d) const
the ratio between the index fixing at the passed date and the base CPI
Date baseDate() const
base date for the base fixing of the CPI index
Real accruedAmount(const Date &) const override
accrued amount at the given date
CPI::InterpolationType observationInterpolation_
Real fixedRate() const
fixed rate that will be inflated by the index ratio
Rate adjustedIndexGrowth() const
the ratio between the end index fixing and the base CPI
Helper class building a sequence of capped/floored CPI coupons.
CPILeg & withNotionals(Real notional)
BusinessDayConvention paymentAdjustment_
std::vector< Rate > caps_
CPILeg & withPaymentAdjustment(BusinessDayConvention)
BusinessDayConvention exCouponAdjustment_
CPILeg & withSubtractInflationNominal(bool)
Calendar paymentCalendar_
ext::shared_ptr< ZeroInflationIndex > index_
CPILeg & withBaseDate(const Date &baseDate)
CPILeg & withFixedRates(Real fixedRate)
CPILeg & withExCouponPeriod(const Period &, const Calendar &, BusinessDayConvention, bool endOfMonth=false)
std::vector< Real > notionals_
std::vector< Spread > spreads_
CPILeg & withCaps(Rate cap)
CPILeg & withPaymentDayCounter(const DayCounter &)
CPILeg & withPaymentCalendar(const Calendar &)
CPILeg & withSpreads(Spread spread)
CPILeg & withFloors(Rate floor)
std::vector< Real > fixedRates_
CPI::InterpolationType observationInterpolation_
Calendar exCouponCalendar_
std::vector< Rate > floors_
bool subtractInflationNominal_
CPILeg & withObservationInterpolation(CPI::InterpolationType)
DayCounter paymentDayCounter_
Date exCouponDate() const override
returns the date that the cash flow trades exCoupon
virtual Real nominal() const
const Date & accrualEndDate() const
end of the accrual period
Cash flow dependent on an index ratio.
virtual Real notional() const
virtual bool growthOnly() const
virtual ext::shared_ptr< Index > index() const
Base inflation-coupon class.
Rate rate() const override
accrued rate
Period observationLag() const
how the coupon observes the index
DayCounter dayCounter() const override
day counter for accrual calculation
const ext::shared_ptr< InflationIndex > & index() const
yoy inflation index
template class providing a null value for a given type.
Frequency
Frequency of events.
BusinessDayConvention
Business Day conventions.
Real Spread
spreads on interest rates
Cash flow dependent on an index ratio (NOT a coupon, i.e. no accruals)
Coupon paying a variable index-based rate.
base classes for inflation indexes
std::vector< ext::shared_ptr< CashFlow > > Leg
Sequence of cash-flows.
#define QL_DEPRECATED_DISABLE_WARNING
#define QL_DEPRECATED_ENABLE_WARNING
static Real laggedFixing(const ext::shared_ptr< ZeroInflationIndex > &index, const Date &date, const Period &observationLag, InterpolationType interpolationType)
interpolated inflation fixing
InterpolationType
when you observe an index, how do you interpolate between fixings?
@ AsIndex
same interpolation as index