23#ifndef quantext_cpicoupon_hpp
24#define quantext_cpicoupon_hpp
26#include <ql/cashflows/cpicoupon.hpp>
27#include <ql/instruments/cpicapfloor.hpp>
28#include <ql/time/schedule.hpp>
33class InflationCashFlowPricer;
38 const Date& paymentDate, Real nominal,
const Date& startDate,
const Date& endDate,
39 const ext::shared_ptr<ZeroInflationIndex>& index,
const Period& observationLag,
40 CPI::InterpolationType observationInterpolation,
const DayCounter& dayCounter,
42 const Date& refPeriodStart = Date(),
const Date& refPeriodEnd = Date(),
43 const Date& exCouponDate = Date(),
bool subtractInflationNominal =
false)
44 :
QuantLib::
CPICoupon(baseCPI, paymentDate, nominal, startDate, endDate, index, observationLag,
45 observationInterpolation, dayCounter, fixedRate, refPeriodStart,
46 refPeriodEnd, exCouponDate),
51 const Date& paymentDate, Real nominal,
const Date& startDate,
const Date& endDate,
52 const ext::shared_ptr<ZeroInflationIndex>& index,
const Period& observationLag,
53 CPI::InterpolationType observationInterpolation,
const DayCounter& dayCounter,
55 const Date& refPeriodStart = Date(),
const Date& refPeriodEnd = Date(),
56 const Date& exCouponDate = Date(),
bool subtractInflationNominal =
false)
57 :
QuantLib::
CPICoupon(baseCPI, baseDate, paymentDate, nominal, startDate, endDate, index,
59 observationInterpolation, dayCounter, fixedRate, refPeriodStart, refPeriodEnd,
63 virtual Rate
rate()
const override;
77 Period observationLag = 0 * Days, Rate cap = Null<Rate>(), Rate floor = Null<Rate>());
79 virtual Real
amount()
const override;
80 void setPricer(
const ext::shared_ptr<InflationCashFlowPricer>& pricer);
93 ext::shared_ptr<InflationCashFlowPricer>
pricer_;
102 Rate cap = Null<Rate>(), Rate floor = Null<Rate>());
103 virtual Rate
rate()
const override;
114 virtual void accept(AcyclicVisitor& v)
override;
121 virtual void setCommon(Rate cap, Rate floor);
140 CPILeg(
const Schedule& schedule,
const ext::shared_ptr<ZeroInflationIndex>& index,
141 const Handle<YieldTermStructure>& rateCurve,
const Real baseCPI,
const Period& observationLag);
165 operator Leg()
const;
169 ext::shared_ptr<ZeroInflationIndex>
index_;
virtual Rate rate() const override
bool subtractInflationNotional()
CPICoupon(Real baseCPI, const Date &baseDate, const Date &paymentDate, Real nominal, const Date &startDate, const Date &endDate, const ext::shared_ptr< ZeroInflationIndex > &index, const Period &observationLag, CPI::InterpolationType observationInterpolation, const DayCounter &dayCounter, Real fixedRate, const Date &refPeriodStart=Date(), const Date &refPeriodEnd=Date(), const Date &exCouponDate=Date(), bool subtractInflationNominal=false)
bool subtractInflationNominal_
CPICoupon(Real baseCPI, const Date &paymentDate, Real nominal, const Date &startDate, const Date &endDate, const ext::shared_ptr< ZeroInflationIndex > &index, const Period &observationLag, CPI::InterpolationType observationInterpolation, const DayCounter &dayCounter, Real fixedRate, const Date &refPeriodStart=Date(), const Date &refPeriodEnd=Date(), const Date &exCouponDate=Date(), bool subtractInflationNominal=false)
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 & withFinalFlowCap(Rate cap)
CPILeg & withSubtractInflationNominal(bool)
Calendar paymentCalendar_
CPILeg & withFixingDays(Natural fixingDays)
CPILeg & withObservationLag(const Period &observationLag)
ext::shared_ptr< ZeroInflationIndex > index_
CPILeg & withBaseDate(const Date &baseDate)
CPILeg & withFixedRates(Real fixedRate)
CPILeg & withFinalFlowFloor(Rate floor)
CPILeg & withExCouponPeriod(const Period &, const Calendar &, BusinessDayConvention, bool endOfMonth=false)
std::vector< Real > notionals_
CPILeg & withCaps(Rate cap)
Handle< YieldTermStructure > rateCurve_
CPILeg & withPaymentDayCounter(const DayCounter &)
CPILeg & withStartDate(const Date &startDate)
CPILeg & withPaymentCalendar(const Calendar &)
CPILeg & withFloors(Rate floor)
std::vector< Real > fixedRates_
std::vector< Natural > fixingDays_
CPI::InterpolationType observationInterpolation_
bool subtractInflationNominalAllCoupons_
Calendar exCouponCalendar_
CPILeg & withSubtractInflationNominalAllCoupons(bool subtractInflationNominalAllCoupons)
std::vector< Rate > floors_
CPILeg & withPaymentLag(Natural lag)
bool subtractInflationNominal_
CPILeg & withObservationInterpolation(CPI::InterpolationType)
DayCounter paymentDayCounter_
Capped or floored CPI cashflow.
ext::shared_ptr< CPICashFlow > underlying_
ext::shared_ptr< CPICashFlow > underlying() const
void setPricer(const ext::shared_ptr< InflationCashFlowPricer > &pricer)
ext::shared_ptr< CPICapFloor > cpiCap_
void setCommon(Rate cap, Rate floor)
ext::shared_ptr< InflationCashFlowPricer > pricer_
virtual Real amount() const override
ext::shared_ptr< CPICapFloor > cpiFloor_
Capped or floored CPI coupon.
ext::shared_ptr< CPICapFloor > cpiCap_
virtual void setCommon(Rate cap, Rate floor)
virtual Rate rate() const override
ext::shared_ptr< CPICoupon > underlying() const
ext::shared_ptr< CPICoupon > underlying_
virtual void accept(AcyclicVisitor &v) override
ext::shared_ptr< CPICapFloor > cpiFloor_