37 const Date& startDate,
40 const ext::shared_ptr<IborIndex>& iborIndex,
43 const Date& refPeriodStart,
44 const Date& refPeriodEnd,
47 const Date& exCouponDate)
49 fixingDays, iborIndex, gearing, spread,
50 refPeriodStart, refPeriodEnd,
51 dayCounter, isInArrears, exCouponDate),
52 iborIndex_(iborIndex) {
57 auto p = ext::dynamic_pointer_cast<IborCouponPricer>(
pricer_);
58 QL_REQUIRE(p,
"IborCoupon: pricer not set or not derived from IborCouponPricer");
59 p->initializeCachedData(*
this);
147 usingAtParCoupons_ =
false;
151 return usingAtParCoupons_;
200 gearings_ = std::vector<Real>(1,gearing);
210 spreads_ = std::vector<Spread>(1,spread);
220 caps_ = std::vector<Rate>(1,cap);
230 floors_ = std::vector<Rate>(1,floor);
270 IborLeg::operator
Leg()
const {
272 Leg leg = FloatingLeg<IborIndex, IborCoupon, CappedFlooredIborCoupon>(
273 schedule_, notionals_, index_, paymentDayCounter_,
274 paymentAdjustment_, fixingDays_, gearings_, spreads_,
276 exCouponPeriod_, exCouponCalendar_, exCouponAdjustment_, exCouponEndOfMonth_);
278 if (caps_.empty() && floors_.empty() && !inArrears_) {
279 ext::shared_ptr<IborCouponPricer> pricer = ext::make_shared<BlackIborCouponPricer>(
282 Handle<Quote>(ext::make_shared<SimpleQuote>(1.0)), useIndexedCoupons_);
Floating rate coupon with additional cap/floor.
Cash flow vector builders.
degenerate base class for the Acyclic Visitor pattern
base floating-rate coupon class
virtual Date fixingDate() const
fixing date
ext::shared_ptr< InterestRateIndex > index_
virtual void setPricer(const ext::shared_ptr< FloatingRateCouponPricer > &)
ext::shared_ptr< FloatingRateCouponPricer > pricer_
void accept(AcyclicVisitor &) override
const ext::shared_ptr< InterestRateIndex > & index() const
floating index
ext::shared_ptr< FloatingRateCouponPricer > pricer() const
Shared handle to an observable.
bool usingAtParCoupons() const
void createIndexedCoupons()
When called, IborCoupons are created as par coupons instead of indexed coupons.
void createAtParCoupons()
When called, IborCoupons are created as indexed coupons instead of par coupons.
void initializeCachedData() const
Time spanningTimeIndexMaturity() const
Period underlying the index fixing, as a year fraction.
Rate indexFixing() const override
fixing of the underlying index
Time spanningTimeIndexMaturity_
ext::shared_ptr< IborIndex > iborIndex_
void accept(AcyclicVisitor &) override
const Date & fixingValueDate() const
Start of the deposit period underlying the index fixing.
void setPricer(const ext::shared_ptr< FloatingRateCouponPricer > &) override
IborCoupon(const Date &paymentDate, Real nominal, const Date &startDate, const Date &endDate, Natural fixingDays, const ext::shared_ptr< IborIndex > &index, Real gearing=1.0, Spread spread=0.0, const Date &refPeriodStart=Date(), const Date &refPeriodEnd=Date(), const DayCounter &dayCounter=DayCounter(), bool isInArrears=false, const Date &exCouponDate=Date())
bool cachedDataIsInitialized_
const Date & fixingEndDate() const
End of the deposit period underlying the coupon fixing.
const Date & fixingMaturityDate() const
End of the deposit period underlying the index fixing.
Date fixingDate() const override
fixing date
Time spanningTime() const
Period underlying the coupon fixing, as a year fraction.
helper class building a sequence of capped/floored ibor-rate coupons
IborLeg & withSpreads(Spread spread)
BusinessDayConvention paymentAdjustment_
std::vector< Rate > caps_
IborLeg & withPaymentCalendar(const Calendar &)
BusinessDayConvention exCouponAdjustment_
IborLeg & withPaymentAdjustment(BusinessDayConvention)
Calendar paymentCalendar_
IborLeg(Schedule schedule, ext::shared_ptr< IborIndex > index)
ext::optional< bool > useIndexedCoupons_
std::vector< Real > notionals_
std::vector< Spread > spreads_
IborLeg & withPaymentDayCounter(const DayCounter &)
IborLeg & inArrears(bool flag=true)
IborLeg & withFloors(Rate floor)
IborLeg & withNotionals(Real notional)
std::vector< Natural > fixingDays_
IborLeg & withGearings(Real gearing)
IborLeg & withPaymentLag(Integer lag)
Calendar exCouponCalendar_
std::vector< Rate > floors_
IborLeg & withZeroPayments(bool flag=true)
IborLeg & withExCouponPeriod(const Period &, const Calendar &, BusinessDayConvention, bool endOfMonth=false)
IborLeg & withCaps(Rate cap)
IborLeg & withIndexedCoupons(ext::optional< bool > b=true)
IborLeg & withFixingDays(Natural fixingDays)
IborLeg & withAtParCoupons(bool b=true)
std::vector< Real > gearings_
DayCounter paymentDayCounter_
ext::shared_ptr< IborIndex > index_
template class providing a null value for a given type.
static Settings & instance()
access to the unique instance
Visitor for a specific class
virtual void visit(T &)=0
Calendar paymentCalendar_
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
std::function< Real(Real)> b
BusinessDayConvention
Business Day conventions.
Real Time
continuous quantity with 1-year units
unsigned QL_INTEGER Natural
positive integer
QL_INTEGER Integer
integer number
Real Spread
spreads on interest rates
Coupon paying a Libor-type index.
base class for interest rate indexes
void setCouponPricer(const Leg &leg, const ext::shared_ptr< FloatingRateCouponPricer > &pricer)
std::vector< ext::shared_ptr< CashFlow > > Leg
Sequence of cash-flows.
Maps optional to either the boost or std implementation.
ext::shared_ptr< BlackVolTermStructure > v
Interest-rate term structure.