21#include <ql/cashflows/cashflows.hpp>
22#include <ql/cashflows/cashflowvectors.hpp>
23#include <ql/cashflows/couponpricer.hpp>
24#include <ql/cashflows/cpicoupon.hpp>
25#include <ql/cashflows/fixedratecoupon.hpp>
26#include <ql/cashflows/iborcoupon.hpp>
27#include <ql/cashflows/simplecashflow.hpp>
28#include <ql/indexes/inflationindex.hpp>
29#include <ql/instruments/cpiswap.hpp>
30#include <ql/termstructures/yieldtermstructure.hpp>
31#include <ql/time/schedule.hpp>
39 bool subtractInflationNominal,
46 ext::shared_ptr<IborIndex> floatIndex,
53 const Period& observationLag,
54 ext::shared_ptr<ZeroInflationIndex> fixedIndex,
56 Real inflationNominal)
57 :
Swap(2), type_(type), nominal_(nominal), subtractInflationNominal_(subtractInflationNominal),
58 spread_(spread), floatDayCount_(
std::move(floatDayCount)),
59 floatSchedule_(
std::move(floatSchedule)), floatPaymentRoll_(floatPaymentRoll),
60 fixingDays_(fixingDays), floatIndex_(
std::move(floatIndex)), fixedRate_(fixedRate),
61 baseCPI_(baseCPI), fixedDayCount_(
std::move(fixedDayCount)),
62 fixedSchedule_(
std::move(fixedSchedule)), fixedPaymentRoll_(fixedPaymentRoll),
63 fixedIndex_(
std::move(fixedIndex)), observationLag_(observationLag),
64 observationInterpolation_(observationInterpolation) {
92 payNotional = floatingLeg.back()->date();
96 ext::shared_ptr<CashFlow> nf(
new SimpleCashFlow(floatAmount, payNotional));
97 floatingLeg.push_back(nf);
111 Leg::const_iterator i;
116 for (i = floatingLeg.begin(); i < floatingLeg.end(); ++i) {
121 legs_[1] = floatingLeg;
178 static const Spread basisPoint = 1.0e-4;
Helper class building a sequence of capped/floored CPI coupons.
CPILeg & withNotionals(Real notional)
CPILeg & withPaymentAdjustment(BusinessDayConvention)
CPILeg & withSubtractInflationNominal(bool)
CPILeg & withFixedRates(Real fixedRate)
CPILeg & withPaymentDayCounter(const DayCounter &)
CPILeg & withObservationInterpolation(CPI::InterpolationType)
Arguments for swap calculation
void validate() const override
Results from swap calculation
ext::shared_ptr< IborIndex > floatIndex_
BusinessDayConvention fixedPaymentRoll_
virtual Rate fairRate() const
BusinessDayConvention floatPaymentRoll_
ext::shared_ptr< ZeroInflationIndex > fixedIndex_
DayCounter fixedDayCount_
CPISwap(Type type, Real nominal, bool subtractInflationNominal, Spread spread, DayCounter floatDayCount, Schedule floatSchedule, const BusinessDayConvention &floatRoll, Natural fixingDays, ext::shared_ptr< IborIndex > floatIndex, Rate fixedRate, Real baseCPI, DayCounter fixedDayCount, Schedule fixedSchedule, const BusinessDayConvention &fixedRoll, const Period &observationLag, ext::shared_ptr< ZeroInflationIndex > fixedIndex, CPI::InterpolationType observationInterpolation=CPI::AsIndex, Real inflationNominal=Null< Real >())
DayCounter floatDayCount_
virtual Spread fairSpread() const
virtual Real floatLegNPV() const
virtual Real inflationNominal() const
virtual const Leg & cpiLeg() const
void setupArguments(PricingEngine::arguments *args) const override
for simple case sufficient to copy base class
CPI::InterpolationType observationInterpolation_
void setupExpired() const override
void fetchResults(const PricingEngine::results *) const override
virtual bool subtractInflationNominal() const
bool subtractInflationNominal_
virtual Real fixedLegNPV() const
Date adjust(const Date &, BusinessDayConvention convention=Following) const
helper class building a sequence of capped/floored ibor-rate coupons
IborLeg & withSpreads(Spread spread)
IborLeg & withPaymentAdjustment(BusinessDayConvention)
IborLeg & withPaymentDayCounter(const DayCounter &)
IborLeg & withNotionals(Real notional)
IborLeg & withFixingDays(Natural fixingDays)
void calculate() const override
template class providing a null value for a given type.
std::pair< iterator, bool > registerWith(const ext::shared_ptr< Observable > &)
const Calendar & calendar() const
void validate() const override
void setupArguments(PricingEngine::arguments *) const override
std::vector< Real > legNPV_
std::vector< Real > legBPS_
void setupExpired() const override
void fetchResults(const PricingEngine::results *) const override
std::vector< Real > payer_
BusinessDayConvention
Business Day conventions.
unsigned QL_INTEGER Natural
positive integer
Real Spread
spreads on interest rates
std::vector< ext::shared_ptr< CashFlow > > Leg
Sequence of cash-flows.
InterpolationType
when you observe an index, how do you interpolate between fixings?