Coverage Report

Created: 2025-08-28 06:30

/src/quantlib/ql/indexes/ibor/euribor.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
 <http://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/indexes/ibor/euribor.hpp>
22
#include <ql/time/calendars/target.hpp>
23
#include <ql/time/daycounters/actual360.hpp>
24
#include <ql/time/daycounters/actual365fixed.hpp>
25
#include <ql/currencies/europe.hpp>
26
27
namespace QuantLib {
28
29
    namespace {
30
31
0
        BusinessDayConvention euriborConvention(const Period& p) {
32
0
            switch (p.units()) {
33
0
              case Days:
34
0
              case Weeks:
35
0
                return Following;
36
0
              case Months:
37
0
              case Years:
38
0
                return ModifiedFollowing;
39
0
              default:
40
0
                QL_FAIL("invalid time units");
41
0
            }
42
0
        }
43
44
0
        bool euriborEOM(const Period& p) {
45
0
            switch (p.units()) {
46
0
              case Days:
47
0
              case Weeks:
48
0
                return false;
49
0
              case Months:
50
0
              case Years:
51
0
                return true;
52
0
              default:
53
0
                QL_FAIL("invalid time units");
54
0
            }
55
0
        }
56
57
    }
58
59
    Euribor::Euribor(const Period& tenor,
60
                     const Handle<YieldTermStructure>& h)
61
0
    : IborIndex("Euribor", tenor,
62
0
                2, // settlement days
63
0
                EURCurrency(), TARGET(),
64
0
                euriborConvention(tenor), euriborEOM(tenor),
65
0
                Actual360(), h) {
66
0
        QL_REQUIRE(this->tenor().units()!=Days,
67
0
                   "for daily tenors (" << this->tenor() <<
68
0
                   ") dedicated DailyTenor constructor must be used");
69
0
    }
70
71
    Euribor365::Euribor365(const Period& tenor,
72
                           const Handle<YieldTermStructure>& h)
73
0
    : IborIndex("Euribor365", tenor,
74
0
                2, // settlement days
75
0
                EURCurrency(), TARGET(),
76
0
                euriborConvention(tenor), euriborEOM(tenor),
77
0
                Actual365Fixed(), h) {
78
0
        QL_REQUIRE(this->tenor().units()!=Days,
79
0
                   "for daily tenors (" << this->tenor() <<
80
0
                   ") dedicated DailyTenor constructor must be used");
81
0
    }
82
83
}