QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.38
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 // JoinHolidays 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::fixingDate(const Date& valueDate) const {
80 return fixingCalendar().adjust(
82 Preceding);
83 }
84
85 Date EURLibor::valueDate(const Date& fixingDate) const {
86
88 "Fixing date " << fixingDate << " is not valid");
89
90 // http://www.bba.org.uk/bba/jsp/polopoly.jsp?d=225&a=1412 :
91 // In the case of EUR the Value Date shall be two TARGET
92 // business days after the Fixing Date.
94 }
95
96 Date EURLibor::maturityDate(const Date& valueDate) const {
97 // http://www.bba.org.uk/bba/jsp/polopoly.jsp?d=225&a=1412 :
98 // In the case of EUR only, maturity dates will be based on days in
99 // which the Target system is open.
101 }
102
103 ext::shared_ptr<IborIndex> EURLibor::clone(const Handle<YieldTermStructure>& h) const {
104 return ext::make_shared<EURLibor>(tenor(), h);
105 }
106
109 : IborIndex("EURLibor", 1*Days,
110 settlementDays,
111 EURCurrency(),
112 // http://www.bba.org.uk/bba/jsp/polopoly.jsp?d=225&a=1412 :
113 // no o/n or s/n fixings (as the case may be) will take place
114 // when the principal centre of the currency concerned is
115 // closed but London is open on the fixing day.
116 TARGET(),
117 eurliborConvention(1*Days), eurliborEOM(1*Days),
118 Actual360(), h) {}
119
120}
act/360 day counter
Actual/360 day count convention.
Definition: actual360.hpp:37
Date adjust(const Date &, BusinessDayConvention convention=Following) const
Definition: calendar.cpp:84
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:107
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:85
Calendar target_
Definition: eurlibor.hpp:60
Date maturityDate(const Date &valueDate) const override
Definition: eurlibor.cpp:96
ext::shared_ptr< IborIndex > clone(const Handle< YieldTermStructure > &h) const override
returns a copy of itself linked to a different forwarding curve
Definition: eurlibor.cpp:103
Date fixingDate(const Date &valueDate) const override
Definition: eurlibor.cpp:79
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
Calendar fixingCalendar() const override
returns the calendar defining valid fixing dates
bool isValidFixingDate(const Date &fixingDate) const override
returns TRUE if the fixing date is a valid one
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
QL_INTEGER Integer
integer number
Definition: types.hpp:35
Joint calendar.
Definition: any.hpp:37
Real target_
TARGET calendar.
UK calendars.