/src/quantlib/ql/instruments/bonds/floatingratebond.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | |
3 | | /* |
4 | | Copyright (C) 2007 Ferdinando Ametrano |
5 | | Copyright (C) 2007 Chiara Fornarola |
6 | | |
7 | | This file is part of QuantLib, a free-software/open-source library |
8 | | for financial quantitative analysts and developers - http://quantlib.org/ |
9 | | |
10 | | QuantLib is free software: you can redistribute it and/or modify it |
11 | | under the terms of the QuantLib license. You should have received a |
12 | | copy of the license along with this program; if not, please email |
13 | | <quantlib-dev@lists.sf.net>. The license is also available online at |
14 | | <https://www.quantlib.org/license.shtml>. |
15 | | |
16 | | This program is distributed in the hope that it will be useful, but WITHOUT |
17 | | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
18 | | FOR A PARTICULAR PURPOSE. See the license for more details. |
19 | | */ |
20 | | |
21 | | #include <ql/instruments/bonds/floatingratebond.hpp> |
22 | | #include <ql/cashflows/iborcoupon.hpp> |
23 | | #include <ql/cashflows/simplecashflow.hpp> |
24 | | #include <ql/time/schedule.hpp> |
25 | | #include <ql/indexes/swapindex.hpp> |
26 | | #include <ql/indexes/iborindex.hpp> |
27 | | |
28 | | namespace QuantLib { |
29 | | |
30 | | FloatingRateBond::FloatingRateBond( |
31 | | Natural settlementDays, |
32 | | Real faceAmount, |
33 | | Schedule schedule, |
34 | | const ext::shared_ptr<IborIndex>& iborIndex, |
35 | | const DayCounter& paymentDayCounter, |
36 | | BusinessDayConvention paymentConvention, |
37 | | Natural fixingDays, |
38 | | const std::vector<Real>& gearings, |
39 | | const std::vector<Spread>& spreads, |
40 | | const std::vector<Rate>& caps, |
41 | | const std::vector<Rate>& floors, |
42 | | bool inArrears, |
43 | | Real redemption, |
44 | | const Date& issueDate, |
45 | | const Period& exCouponPeriod, |
46 | | const Calendar& exCouponCalendar, |
47 | | const BusinessDayConvention exCouponConvention, |
48 | | bool exCouponEndOfMonth) |
49 | 0 | : Bond(settlementDays, schedule.calendar(), issueDate) { |
50 | |
|
51 | 0 | maturityDate_ = schedule.endDate(); |
52 | |
|
53 | 0 | cashflows_ = IborLeg(std::move(schedule), iborIndex) |
54 | 0 | .withNotionals(faceAmount) |
55 | 0 | .withPaymentDayCounter(paymentDayCounter) |
56 | 0 | .withPaymentAdjustment(paymentConvention) |
57 | 0 | .withFixingDays(fixingDays) |
58 | 0 | .withGearings(gearings) |
59 | 0 | .withSpreads(spreads) |
60 | 0 | .withCaps(caps) |
61 | 0 | .withFloors(floors) |
62 | 0 | .inArrears(inArrears) |
63 | 0 | .withExCouponPeriod(exCouponPeriod, exCouponCalendar, exCouponConvention, exCouponEndOfMonth); |
64 | |
|
65 | 0 | addRedemptionsToCashflows(std::vector<Real>(1, redemption)); |
66 | |
|
67 | 0 | QL_ENSURE(!cashflows().empty(), "bond with no cashflows!"); |
68 | 0 | QL_ENSURE(redemptions_.size() == 1, "multiple redemptions created"); |
69 | | |
70 | 0 | registerWith(iborIndex); |
71 | 0 | } Unexecuted instantiation: QuantLib::FloatingRateBond::FloatingRateBond(unsigned int, double, QuantLib::Schedule, boost::shared_ptr<QuantLib::IborIndex> const&, QuantLib::DayCounter const&, QuantLib::BusinessDayConvention, unsigned int, std::__1::vector<double, std::__1::allocator<double> > const&, std::__1::vector<double, std::__1::allocator<double> > const&, std::__1::vector<double, std::__1::allocator<double> > const&, std::__1::vector<double, std::__1::allocator<double> > const&, bool, double, QuantLib::Date const&, QuantLib::Period const&, QuantLib::Calendar const&, QuantLib::BusinessDayConvention, bool) Unexecuted instantiation: QuantLib::FloatingRateBond::FloatingRateBond(unsigned int, double, QuantLib::Schedule, boost::shared_ptr<QuantLib::IborIndex> const&, QuantLib::DayCounter const&, QuantLib::BusinessDayConvention, unsigned int, std::__1::vector<double, std::__1::allocator<double> > const&, std::__1::vector<double, std::__1::allocator<double> > const&, std::__1::vector<double, std::__1::allocator<double> > const&, std::__1::vector<double, std::__1::allocator<double> > const&, bool, double, QuantLib::Date const&, QuantLib::Period const&, QuantLib::Calendar const&, QuantLib::BusinessDayConvention, bool) |
72 | | |
73 | | } |