Coverage Report

Created: 2025-08-11 06:28

/src/quantlib/ql/instruments/bonds/amortizingfixedratebond.hpp
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) 2008 Simon Ibbotson
5
6
 This file is part of QuantLib, a free-software/open-source library
7
 for financial quantitative analysts and developers - http://quantlib.org/
8
9
 QuantLib is free software: you can redistribute it and/or modify it
10
 under the terms of the QuantLib license.  You should have received a
11
 copy of the license along with this program; if not, please email
12
 <quantlib-dev@lists.sf.net>. The license is also available online at
13
 <http://quantlib.org/license.shtml>.
14
15
 This program is distributed in the hope that it will be useful, but WITHOUT
16
 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17
 FOR A PARTICULAR PURPOSE.  See the license for more details.
18
*/
19
20
/*! \file amortizingfixedratebond.hpp
21
    \brief amortizing fixed-rate bond
22
*/
23
24
#ifndef quantlib_amortizing_fixed_rate_bond_hpp
25
#define quantlib_amortizing_fixed_rate_bond_hpp
26
27
#include <ql/instruments/bond.hpp>
28
#include <ql/time/daycounter.hpp>
29
#include <ql/time/schedule.hpp>
30
#include <ql/interestrate.hpp>
31
32
namespace QuantLib {
33
34
    //! amortizing fixed-rate bond
35
    class AmortizingFixedRateBond : public Bond {
36
      public:
37
        AmortizingFixedRateBond(Natural settlementDays,
38
                                const std::vector<Real>& notionals,
39
                                Schedule schedule,
40
                                const std::vector<Rate>& coupons,
41
                                const DayCounter& accrualDayCounter,
42
                                BusinessDayConvention paymentConvention = Following,
43
                                const Date& issueDate = Date(),
44
                                const Period& exCouponPeriod = Period(),
45
                                const Calendar& exCouponCalendar = Calendar(),
46
                                BusinessDayConvention exCouponConvention = Unadjusted,
47
                                bool exCouponEndOfMonth = false,
48
                                const std::vector<Real>& redemptions = { 100.0 },
49
                                Integer paymentLag = 0);
50
51
0
        Frequency frequency() const { return frequency_; }
52
0
        const DayCounter& dayCounter() const { return dayCounter_; }
53
      protected:
54
        Frequency frequency_;
55
        DayCounter dayCounter_;
56
    };
57
58
    //! returns a schedule for French amortization
59
    Schedule sinkingSchedule(const Date& startDate,
60
                             const Period& bondLength,
61
                             const Frequency& frequency,
62
                             const Calendar& paymentCalendar);
63
64
    //! returns a sequence of notionals for French amortization
65
    std::vector<Real> sinkingNotionals(const Period& bondLength,
66
                                       const Frequency& frequency,
67
                                       Rate couponRate,
68
                                       Real initialNotional);
69
70
}
71
72
#endif