30 const Period& observationLag,
34 ext::shared_ptr<ZeroInflationIndex> zii,
37 const std::vector<Rate>& cStrikes,
38 const std::vector<Rate>& fStrikes,
39 const std::vector<Period>& cfMaturities,
43 zii_(
std::move(zii)), interpolationType_(interpolationType), nominalTS_(
std::move(yts)),
44 cStrikes_(cStrikes), fStrikes_(fStrikes), cfMaturities_(cfMaturities),
45 cPrice_(cPrice), fPrice_(fPrice), nominal_(nominal), bdc_(bdc),
46 observationLag_(observationLag), baseRate_(baseRate) {
49 QL_REQUIRE(!
zii_->zeroInflationTermStructure().empty(),
"ZITS missing from index");
57 "floor strikes vs floor price rows not equal");
59 "cap strikes vs cap price rows not equal");
61 "maturities vs floor price columns not equal");
63 "maturities vs cap price columns not equal");
69 QL_REQUIRE( cfMaturities[j] > cfMaturities[j-1],
70 "non-increasing maturities");
74 "non-positive floor price: " <<
fPrice_[i][j] );
77 "non-increasing floor prices");
82 "non-positive cap price: " <<
cPrice_[i][j] );
85 "non-decreasing cap prices: "
101 Rate k = cStrikes[i];
102 if (k > maxFstrike + eps)
cfStrikes_.push_back(k);
109 "cfStrikes not increasing");
121 return T > 0.0 ? std::pow(F1 / F0, 1 /
T) - 1.0 :
baseRate();
virtual Date cpiOptionDateFromTenor(const Period &p) const
std::vector< Rate > cfStrikes_
std::vector< Period > cfMaturities_
std::vector< Rate > fStrikes_
Handle< YieldTermStructure > nominalTS_
std::vector< Rate > cStrikes_
virtual Rate baseRate() const
Rate atmRate(Date maturity) const
CPICapFloorTermPriceSurface(Real nominal, Real baseRate, const Period &observationLag, const Calendar &cal, const BusinessDayConvention &bdc, const DayCounter &dc, ext::shared_ptr< ZeroInflationIndex > zii, CPI::InterpolationType interpolationType, Handle< YieldTermStructure > yts, const std::vector< Rate > &cStrikes, const std::vector< Rate > &fStrikes, const std::vector< Period > &cfMaturities, const Matrix &cPrice, const Matrix &fPrice)
virtual Real capPrice(const Period &d, Rate k) const
ext::shared_ptr< ZeroInflationIndex > zii_
virtual Real price(const Period &d, Rate k) const
CPI::InterpolationType interpolationType_
virtual BusinessDayConvention businessDayConvention() const
virtual Real floorPrice(const Period &d, Rate k) const
Date adjust(const Date &, BusinessDayConvention convention=Following) const
Shared handle to an observable.
Matrix used in linear algebra.
Basic term-structure functionality.
virtual const Date & referenceDate() const
the date at which discount = 1.0 and/or variance = 0.0
virtual Calendar calendar() const
the calendar used for reference and/or option date calculation
virtual DayCounter dayCounter() const
the day counter used for date/time conversion
cpi inflation cap and floor term price structure.
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
BusinessDayConvention
Business Day conventions.
Real Time
continuous quantity with 1-year units
std::size_t Size
size of a container
bool isInterpolated(const QuantLib::CPI::InterpolationType &type=QuantLib::CPI::AsIndex)
Time inflationYearFraction(Frequency f, bool indexIsInterpolated, const DayCounter &dayCounter, const Date &d1, const Date &d2)
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?