25#ifndef quantlib_cpicoupon_hpp
26#define quantlib_cpicoupon_hpp
36 class CPICouponPricer;
61 const Date& paymentDate,
63 const Date& startDate,
65 const ext::shared_ptr<ZeroInflationIndex>&
index,
78 const Date& paymentDate,
80 const Date& startDate,
82 const ext::shared_ptr<ZeroInflationIndex>&
index,
96 const Date& paymentDate,
98 const Date& startDate,
100 const ext::shared_ptr<ZeroInflationIndex>&
index,
105 const Date& refPeriodStart =
Date(),
129 ext::shared_ptr<ZeroInflationIndex>
cpiIndex()
const;
158 bool checkPricerImpl(
const ext::shared_ptr<InflationCouponPricer>&)
const override;
167 const ext::shared_ptr<ZeroInflationIndex>&
index,
173 const Date& paymentDate,
190 ext::shared_ptr<ZeroInflationIndex>
cpiIndex()
const;
212 ext::shared_ptr<ZeroInflationIndex> index,
214 const Period& observationLag);
231 bool endOfMonth =
false);
234 operator Leg()
const;
238 ext::shared_ptr<ZeroInflationIndex>
index_;
284 return ext::dynamic_pointer_cast<ZeroInflationIndex>(
index());
289 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 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
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?
void accept(AcyclicVisitor &) override
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_
CPILeg & withCaps(Rate cap)
CPILeg & withPaymentDayCounter(const DayCounter &)
CPILeg & withPaymentCalendar(const Calendar &)
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
Frequency
Frequency of events.
BusinessDayConvention
Business Day conventions.
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.
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