19#include <ql/cashflows/couponpricer.hpp>
20#include <ql/indexes/interestrateindex.hpp>
21#include <ql/termstructures/yieldtermstructure.hpp>
27 const QuantLib::ext::shared_ptr<Coupon>& previousCoupon,
const Date& paymentDate,
28 const Date& startDate,
const Date& endDate, Natural fixingDays,
29 const QuantLib::ext::shared_ptr<InterestRateIndex>& index, Real gearing,
30 Spread spread,
const Date& refPeriodStart,
const Date& refPeriodEnd,
31 const DayCounter& dayCounter,
bool isInArrears)
32 :
Coupon(paymentDate, 0.0, startDate, endDate, refPeriodStart, refPeriodEnd), annuity_(annuity),
33 underflow_(underflow), previousCoupon_(previousCoupon), fixingDays_(fixingDays), index_(index), gearing_(gearing),
34 spread_(spread), dayCounter_(dayCounter), isInArrears_(isInArrears) {
39 QL_REQUIRE(previousCoupon,
"Non-empty previous coupon required for FloatingAnnuityCoupon");
40 registerWith(previousCoupon);
42 registerWith(Settings::instance().evaluationDate());
48 QuantLib::ext::shared_ptr<FloatingAnnuityCoupon> c = QuantLib::ext::dynamic_pointer_cast<FloatingAnnuityCoupon>(
previousCoupon_);
77 if (d <= accrualStartDate_ || d > paymentDate_) {
81 dayCounter().yearFraction(accrualStartDate_, std::min(d, accrualEndDate_), refPeriodStart_,
90 Date refDate =
isInArrears_ ? accrualEndDate_ : accrualStartDate_;
91 return index_->fixingCalendar().advance(refDate, -
static_cast<Integer
>(
fixingDays_), Days, Preceding);
97 return amount() * discountingCurve->discount(date());
101 Visitor<FloatingAnnuityCoupon>* v1 =
dynamic_cast<Visitor<FloatingAnnuityCoupon>*
>(&v);
void performCalculations() const override
QuantLib::ext::shared_ptr< Coupon > previousCoupon_
const QuantLib::ext::shared_ptr< InterestRateIndex > & index() const
QuantLib::ext::shared_ptr< InterestRateIndex > index_
FloatingAnnuityCoupon(Real annuity, bool underflow, const QuantLib::ext::shared_ptr< Coupon > &previousCoupon, const Date &paymentDate, const Date &startDate, const Date &endDate, Natural fixingDays, const QuantLib::ext::shared_ptr< InterestRateIndex > &index, Real gearing=1.0, Spread spread=0.0, const Date &refPeriodStart=Date(), const Date &refPeriodEnd=Date(), const DayCounter &dayCounter=DayCounter(), bool isInArrears=false)
Rate rate() const override
Rate amount() const override
virtual void accept(AcyclicVisitor &) override
Rate nominal() const override
DayCounter dayCounter() const override
Real price(const Handle< YieldTermStructure > &discountingCurve) const
Real accruedAmount(const Date &d) const override
Rate previousNominal() const
Coupon paying a Libor-type index.