QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
eurlibor.cpp
Go to the documentation of this file.
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
27
28namespace QuantLib {
29
30 namespace {
31
32 BusinessDayConvention eurliborConvention(const Period& p) {
33 switch (p.units()) {
34 case Days:
35 case Weeks:
36 return Following;
37 case Months:
38 case Years:
39 return ModifiedFollowing;
40 default:
41 QL_FAIL("invalid time units");
42 }
43 }
44
45 bool eurliborEOM(const Period& p) {
46 switch (p.units()) {
47 case Days:
48 case Weeks:
49 return false;
50 case Months:
51 case Years:
52 return true;
53 default:
54 QL_FAIL("invalid time units");
55 }
56 }
57
58 }
59
62 : IborIndex("EURLibor", tenor,
63 2,
65 // http://www.bba.org.uk/bba/jsp/polopoly.jsp?d=225&a=1412 :
66 // JoinBusinessDays is the fixing calendar for
67 // all indexes but o/n
69 TARGET(),
71 eurliborConvention(tenor), eurliborEOM(tenor),
72 Actual360(), h),
73 target_(TARGET()) {
74 QL_REQUIRE(this->tenor().units()!=Days,
75 "for daily tenors (" << this->tenor() <<
76 ") dedicated DailyTenor constructor must be used");
77 }
78
79 Date EURLibor::valueDate(const Date& fixingDate) const {
80
82 "Fixing date " << fixingDate << " is not valid");
83
84 // http://www.bba.org.uk/bba/jsp/polopoly.jsp?d=225&a=1412 :
85 // In the case of EUR the Value Date shall be two TARGET
86 // business days after the Fixing Date.
88 }
89
90 Date EURLibor::maturityDate(const Date& valueDate) const {
91 // http://www.bba.org.uk/bba/jsp/polopoly.jsp?d=225&a=1412 :
92 // In the case of EUR only, maturity dates will be based on days in
93 // which the Target system is open.
95 }
96
99 : IborIndex("EURLibor", 1*Days,
100 settlementDays,
101 EURCurrency(),
102 // http://www.bba.org.uk/bba/jsp/polopoly.jsp?d=225&a=1412 :
103 // no o/n or s/n fixings (as the case may be) will take place
104 // when the principal centre of the currency concerned is
105 // closed but London is open on the fixing day.
106 TARGET(),
107 eurliborConvention(1*Days), eurliborEOM(1*Days),
108 Actual360(), h) {}
109
110}
act/360 day counter
Actual/360 day count convention.
Definition: actual360.hpp:37
Date advance(const Date &, Integer n, TimeUnit unit, BusinessDayConvention convention=Following, bool endOfMonth=false) const
Definition: calendar.cpp:130
DailyTenorEURLibor(Natural settlementDays, const Handle< YieldTermStructure > &h={})
Definition: eurlibor.cpp:97
Concrete date class.
Definition: date.hpp:125
European Euro.
Definition: europe.hpp:123
EURLibor(const Period &tenor, const Handle< YieldTermStructure > &h={})
Definition: eurlibor.cpp:60
Date valueDate(const Date &fixingDate) const override
Definition: eurlibor.cpp:79
Calendar target_
Definition: eurlibor.hpp:55
Date maturityDate(const Date &valueDate) const override
Definition: eurlibor.cpp:90
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
bool endOfMonth() const
Definition: iborindex.hpp:54
BusinessDayConvention convention_
Definition: iborindex.hpp:65
bool isValidFixingDate(const Date &fixingDate) const override
returns TRUE if the fixing date is a valid one
Date fixingDate(const Date &valueDate) const
TARGET calendar
Definition: target.hpp:50
United Kingdom calendars.
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
Definition: errors.hpp:117
#define QL_FAIL(message)
throw an error (possibly with file and line information)
Definition: errors.hpp:92
EUR LIBOR rate
European currencies.
BusinessDayConvention
Business Day conventions.
unsigned QL_INTEGER Natural
positive integer
Definition: types.hpp:43
Joint calendar.
Definition: any.hpp:35
Real target_
TARGET calendar.
UK calendars.