34 return out <<
"YoYInflationCap";
36 return out <<
"YoYInflationFloor";
38 return out <<
"YoYInflationCollar";
46 std::vector<Rate> capRates,
47 std::vector<Rate> floorRates)
48 : type_(type), yoyLeg_(
std::move(yoyLeg)), capRates_(
std::move(capRates)),
49 floorRates_(
std::move(floorRates)) {
62 Leg::const_iterator i;
71 const std::vector<Rate>& strikes)
72 : type_(type), yoyLeg_(
std::move(yoyLeg)) {
73 QL_REQUIRE(!strikes.empty(),
"no strikes given");
85 QL_FAIL(
"only Cap/Floor types allowed in this constructor");
87 Leg::const_iterator i;
96 if (!
yoyLeg_[i-1]->hasOccurred())
109 ext::shared_ptr<YoYInflationCoupon>
111 ext::shared_ptr<CashFlow> lastCF(
yoyLeg_.back());
113 ext::dynamic_pointer_cast<YoYInflationCoupon>(lastCF);
119 io::ordinal(i+1) <<
" optionlet does not exist, only " <<
123 std::vector<Rate> cap, floor;
129 return ext::make_shared<YoYInflationCapFloor>(
type(),
151 for (
Size i=0; i<
n; ++i) {
152 ext::shared_ptr<YoYInflationCoupon> coupon =
153 ext::dynamic_pointer_cast<YoYInflationCoupon>(
155 QL_REQUIRE(coupon,
"non-YoYInflationCoupon given");
164 Spread spread = coupon->spread();
165 Real gearing = coupon->gearing();
183 "number of start dates (" <<
startDates.size()
184 <<
") different from that of pay dates ("
187 "number of start dates (" <<
startDates.size()
188 <<
") different from that of accrual times ("
192 "number of start dates (" <<
startDates.size()
193 <<
") different from that of cap rates ("
197 "number of start dates (" <<
startDates.size()
198 <<
") different from that of floor rates ("
201 "number of start dates (" <<
startDates.size()
202 <<
") different from that of gearings ("
205 "number of start dates (" <<
startDates.size()
206 <<
") different from that of spreads ("
209 "number of start dates (" <<
startDates.size()
210 <<
") different from that of nominals ("
Cash-flow analysis functions.
static Date maturityDate(const Leg &leg)
static Date startDate(const Leg &leg)
static Rate atmRate(const Leg &leg, const YieldTermStructure &discountCurve, bool includeSettlementDateFlows, Date settlementDate=Date(), Date npvDate=Date(), Real npv=Null< Real >())
At-the-money rate of the cash flows.
template class providing a null value for a given type.
std::pair< iterator, bool > registerWith(const ext::shared_ptr< Observable > &)
static Settings & instance()
access to the unique instance
virtual const Date & referenceDate() const
the date at which discount = 1.0 and/or variance = 0.0
Interest-rate term structure.
Arguments for YoY Inflation cap/floor calculation
YoYInflationCapFloor::Type type
std::vector< Time > accrualTimes
std::vector< Date > startDates
std::vector< Real > gearings
std::vector< Rate > floorRates
std::vector< Real > nominals
std::vector< Rate > capRates
std::vector< Date > fixingDates
std::vector< Date > payDates
std::vector< Real > spreads
void validate() const override
void setupArguments(PricingEngine::arguments *) const override
const Leg & yoyLeg() const
bool isExpired() const override
returns whether the instrument might have value greater than zero.
const std::vector< Rate > & capRates() const
ext::shared_ptr< YoYInflationCoupon > lastYoYInflationCoupon() const
virtual Rate atmRate(const YieldTermStructure &discountCurve) const
Date maturityDate() const
const std::vector< Rate > & floorRates() const
std::vector< Rate > capRates_
std::vector< Rate > floorRates_
YoYInflationCapFloor(Type type, Leg yoyLeg, std::vector< Rate > capRates, std::vector< Rate > floorRates)
ext::shared_ptr< YoYInflationCapFloor > optionlet(Size n) const
Returns the n-th optionlet as a cap/floor with only one cash flow.
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
#define QL_FAIL(message)
throw an error (possibly with file and line information)
detail::ordinal_holder ordinal(Size)
outputs naturals as 1st, 2nd, 3rd...
QL_INTEGER Integer
integer number
Real Spread
spreads on interest rates
std::size_t Size
size of a container
inflation cap and floor class, just year-on-year variety for now
std::ostream & operator<<(std::ostream &out, GFunctionFactory::YieldCurveModel type)
std::vector< ext::shared_ptr< CashFlow > > Leg
Sequence of cash-flows.
Safe (bracketed) Newton 1-D solver.