Coverage Report

Created: 2025-12-08 06:13

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/quantlib/ql/indexes/ibor/custom.hpp
Line
Count
Source
1
/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3
#ifndef quantlib_custom_ibor_hpp
4
#define quantlib_custom_ibor_hpp
5
6
#include <ql/indexes/iborindex.hpp>
7
8
namespace QuantLib {
9
10
    /*! LIBOR-like index that allows specifying custom calendars for value
11
        and maturity dates calculations:
12
13
        * valueDate() advances on the valueCalendar and adjusts on the
14
         maturityCalendar.
15
16
        * maturityDate() advances on the maturityCalendar.
17
18
        * fixingDate() goes back on the valueCalendar.
19
20
        Typical LIBOR indexes use:
21
22
        * fixingCalendar = valueCalendar = UK, maturityCalendar =
23
        JoinHolidays(UK, CurrencyCalendar) for non-EUR currencies.
24
25
        * fixingCalendar = JoinHolidays(UK, TARGET), valueCalendar =
26
        maturityCalendar = TARGET for EUR.
27
    */
28
    class CustomIborIndex : public IborIndex {
29
      public:
30
        CustomIborIndex(const std::string& familyName,
31
                        const Period& tenor,
32
                        Natural settlementDays,
33
                        const Currency& currency,
34
                        const Calendar& fixingCalendar,
35
                        Calendar  valueCalendar,
36
                        Calendar  maturityCalendar,
37
                        BusinessDayConvention convention,
38
                        bool endOfMonth,
39
                        const DayCounter& dayCounter,
40
                        const Handle<YieldTermStructure>& h = {});
41
        //! \name InterestRateIndex interface
42
        //@{
43
        Date fixingDate(const Date& valueDate) const override;
44
        Date valueDate(const Date& fixingDate) const override;
45
        Date maturityDate(const Date& valueDate) const override;
46
        // @}
47
        //! \name IborIndex interface
48
        //@{
49
        ext::shared_ptr<IborIndex> clone(const Handle<YieldTermStructure>& h) const override;
50
        // @}
51
        //! \name Other inspectors
52
        //@{
53
0
        Calendar valueCalendar() const { return valueCalendar_; }
54
0
        Calendar maturityCalendar() const { return maturityCalendar_; }
55
        // @}
56
      private:
57
        Calendar valueCalendar_;
58
        Calendar maturityCalendar_;
59
    };
60
61
}
62
63
#endif