QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
euribor.cpp
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
27namespace QuantLib {
28
29 namespace {
30
31 BusinessDayConvention euriborConvention(const Period& p) {
32 switch (p.units()) {
33 case Days:
34 case Weeks:
35 return Following;
36 case Months:
37 case Years:
38 return ModifiedFollowing;
39 default:
40 QL_FAIL("invalid time units");
41 }
42 }
43
44 bool euriborEOM(const Period& p) {
45 switch (p.units()) {
46 case Days:
47 case Weeks:
48 return false;
49 case Months:
50 case Years:
51 return true;
52 default:
53 QL_FAIL("invalid time units");
54 }
55 }
56
57 }
58
61 : IborIndex("Euribor", tenor,
62 2, // settlement days
64 euriborConvention(tenor), euriborEOM(tenor),
65 Actual360(), h) {
66 QL_REQUIRE(this->tenor().units()!=Days,
67 "for daily tenors (" << this->tenor() <<
68 ") dedicated DailyTenor constructor must be used");
69 }
70
73 : IborIndex("Euribor365", tenor,
74 2, // settlement days
76 euriborConvention(tenor), euriborEOM(tenor),
77 Actual365Fixed(), h) {
78 QL_REQUIRE(this->tenor().units()!=Days,
79 "for daily tenors (" << this->tenor() <<
80 ") dedicated DailyTenor constructor must be used");
81 }
82
83}
Actual/360 day count convention.
Definition: actual360.hpp:37
Actual/365 (Fixed) day count convention.
European Euro.
Definition: europe.hpp:123
Euribor365(const Period &tenor, const Handle< YieldTermStructure > &h={})
Definition: euribor.cpp:71
Euribor(const Period &tenor, const Handle< YieldTermStructure > &h={})
Definition: euribor.cpp:59
Shared handle to an observable.
Definition: handle.hpp:41
base class for Inter-Bank-Offered-Rate indexes (e.g. Libor, etc.)
Definition: iborindex.hpp:35
TARGET calendar
Definition: target.hpp:50
BusinessDayConvention
Business Day conventions.
Definition: any.hpp:35