Coverage Report

Created: 2026-03-11 06:44

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/quantlib/ql/instruments/bonds/fixedratebond.hpp
Line
Count
Source
1
/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3
/*
4
 Copyright (C) 2004 Jeff Yu
5
 Copyright (C) 2004 M-Dimension Consulting Inc.
6
 Copyright (C) 2005 StatPro Italia srl
7
 Copyright (C) 2007, 2008, 2010 Ferdinando Ametrano
8
 Copyright (C) 2009 Piter Dias
9
10
 This file is part of QuantLib, a free-software/open-source library
11
 for financial quantitative analysts and developers - http://quantlib.org/
12
13
 QuantLib is free software: you can redistribute it and/or modify it
14
 under the terms of the QuantLib license.  You should have received a
15
 copy of the license along with this program; if not, please email
16
 <quantlib-dev@lists.sf.net>. The license is also available online at
17
 <https://www.quantlib.org/license.shtml>.
18
19
 This program is distributed in the hope that it will be useful, but WITHOUT
20
 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
21
 FOR A PARTICULAR PURPOSE.  See the license for more details.
22
*/
23
24
/*! \file fixedratebond.hpp
25
    \brief fixed-rate bond
26
*/
27
28
#ifndef quantlib_fixed_rate_bond_hpp
29
#define quantlib_fixed_rate_bond_hpp
30
31
#include <ql/instruments/bond.hpp>
32
#include <ql/time/dategenerationrule.hpp>
33
#include <ql/time/daycounter.hpp>
34
#include <ql/interestrate.hpp>
35
36
namespace QuantLib {
37
38
    class Schedule;
39
40
    //! fixed-rate bond
41
    /*! \ingroup instruments
42
43
        \test calculations are tested by checking results against
44
              cached values.
45
    */
46
    class FixedRateBond : public Bond {
47
      public:
48
        //! simple annual compounding coupon rates
49
        FixedRateBond(Natural settlementDays,
50
                      Real faceAmount,
51
                      Schedule schedule,
52
                      const std::vector<Rate>& coupons,
53
                      const DayCounter& accrualDayCounter,
54
                      BusinessDayConvention paymentConvention = Following,
55
                      Real redemption = 100.0,
56
                      const Date& issueDate = Date(),
57
                      const Calendar& paymentCalendar = Calendar(),
58
                      const Period& exCouponPeriod = Period(),
59
                      const Calendar& exCouponCalendar = Calendar(),
60
                      BusinessDayConvention exCouponConvention = Unadjusted,
61
                      bool exCouponEndOfMonth = false,
62
                      const DayCounter& firstPeriodDayCounter = DayCounter());
63
64
0
        Frequency frequency() const { return frequency_; }
65
0
        const DayCounter& dayCounter() const { return dayCounter_; }
66
0
        const DayCounter& firstPeriodDayCounter() const { return firstPeriodDayCounter_; }
67
      protected:
68
        Frequency frequency_;
69
        DayCounter dayCounter_;
70
        DayCounter firstPeriodDayCounter_;
71
    };
72
73
}
74
75
#endif