31 ext::shared_ptr<CashFlow>
32 compoundedSubPeriodicCoupon(
const Date& paymentDate,
33 const Date& startDate,
34 const Date& maturityDate,
36 const ext::shared_ptr<IborIndex>& index) {
37 Schedule schedule = MakeSchedule()
40 .withTenor(index->tenor())
41 .withCalendar(index->fixingCalendar())
42 .withConvention(index->businessDayConvention())
44 .endOfMonth(index->endOfMonth());
45 auto floatCpn = ext::make_shared<MultipleResetsCoupon>(
46 paymentDate, nominal, schedule, index->fixingDays(), index);
47 floatCpn->setPricer(ext::make_shared<CompoundingMultipleResetsPricer>());
55 const Date& startDate,
56 const Date& maturityDate,
57 ext::shared_ptr<IborIndex> iborIndex,
61 :
Swap(2), type_(type), baseNominal_(baseNominal), iborIndex_(
std::move(iborIndex)),
62 startDate_(startDate), maturityDate_(maturityDate) {
67 <<
") later than or equal to maturity date ("
74 for (
auto i =
legs_[1].begin(); i <
legs_[1].end(); ++i)
87 QL_FAIL(
"unknown zero coupon swap type");
93 const Date& startDate,
94 const Date& maturityDate,
96 ext::shared_ptr<IborIndex> iborIndex,
104 std::move(iborIndex),
115 const Date& startDate,
116 const Date& maturityDate,
119 ext::shared_ptr<IborIndex> iborIndex,
127 std::move(iborIndex),
133 legs_[0].push_back(ext::shared_ptr<CashFlow>(
Date advance(const Date &, Integer n, TimeUnit unit, BusinessDayConvention convention=Following, bool endOfMonth=false) const
Coupon paying a fixed interest rate
Concrete interest rate class.
static InterestRate impliedRate(Real compound, const DayCounter &resultDC, Compounding comp, Frequency freq, Time t)
implied interest rate for a given compound factor at a given time.
std::pair< iterator, bool > registerWith(const ext::shared_ptr< Observable > &)
DiscountFactor endDiscounts(Size j) const
const Leg & leg(Size j) const
Real legNPV(Size j) const
std::vector< Real > payer_
Zero-coupon interest rate swap.
Rate fairFixedRate(const DayCounter &dayCounter) const
ZeroCouponSwap(Type type, Real baseNominal, const Date &startDate, const Date &maturityDate, Real fixedPayment, ext::shared_ptr< IborIndex > iborIndex, const Calendar &paymentCalendar, BusinessDayConvention paymentConvention=Following, Natural paymentDelay=0)
const Leg & floatingLeg() const
just one cashflow in each leg
Date startDate() const override
Real fixedPayment() const
ext::shared_ptr< IborIndex > iborIndex_
const Leg & fixedLeg() const
just one cashflow in each leg
Date maturityDate() const override
Real floatingLegNPV() const
Real fairFixedPayment() const
#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)
Coupon paying a fixed annual rate.
BusinessDayConvention
Business Day conventions.
unsigned QL_INTEGER Natural
positive integer
base class for Inter-Bank-Offered-Rate indexes
Coupon compounding or averaging multiple fixings.
std::vector< ext::shared_ptr< CashFlow > > Leg
Sequence of cash-flows.
Zero-coupon interest rate swap.