QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
ecb.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2009 Ferdinando Ametrano
5
6 This file is part of QuantLib, a free-software/open-source library
7 for financial quantitative analysts and developers - http://quantlib.org/
8
9 QuantLib is free software: you can redistribute it and/or modify it
10 under the terms of the QuantLib license. You should have received a
11 copy of the license along with this program; if not, please email
12 <quantlib-dev@lists.sf.net>. The license is also available online at
13 <http://quantlib.org/license.shtml>.
14
15 This program is distributed in the hope that it will be useful, but WITHOUT
16 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 FOR A PARTICULAR PURPOSE. See the license for more details.
18*/
19
24#ifndef quantlib_ecb_hpp
25#define quantlib_ecb_hpp
26
27#include <ql/time/date.hpp>
28#include <set>
29#include <vector>
30
31namespace QuantLib {
32
34 struct ECB {
35
36 static const std::set<Date>& knownDates();
37 static void addDate(const Date& d);
38 static void removeDate(const Date& d);
39
41 static Date date(Month m,
42 Year y) { return nextDate(Date(1, m, y) - 1); }
43
50 static Date date(const std::string& ecbCode,
51 const Date& referenceDate = Date());
52
59 static std::string code(const Date& ecbDate);
60
62 static Date nextDate(const Date& d = Date());
63
65 static Date nextDate(const std::string& ecbCode,
66 const Date& referenceDate = Date()) {
67 return nextDate(date(ecbCode, referenceDate));
68 }
69
71 static std::vector<Date> nextDates(const Date& d = Date());
72
74 static std::vector<Date> nextDates(const std::string& ecbCode,
75 const Date& referenceDate = Date()) {
76 return nextDates(date(ecbCode, referenceDate));
77 }
78
81 static bool isECBdate(const Date& d) {
82 Date date = nextDate(d-1);
83 return d==date;
84 }
85
87 static bool isECBcode(const std::string& in);
88
90 static std::string nextCode(const Date& d = Date()) {
91 return code(nextDate(d));
92 }
93
95 static std::string nextCode(const std::string& ecbCode);
96
97 };
98
99}
100
101#endif
Concrete date class.
Definition: date.hpp:125
Integer Year
Year number.
Definition: date.hpp:87
Month
Month names.
Definition: date.hpp:57
Definition: any.hpp:35
European Central Bank reserve maintenance dates.
Definition: ecb.hpp:34
static void removeDate(const Date &d)
Definition: ecb.cpp:90
static std::vector< Date > nextDates(const Date &d=Date())
next maintenance period start dates following the given date
Definition: ecb.cpp:202
static void addDate(const Date &d)
Definition: ecb.cpp:86
static std::string nextCode(const Date &d=Date())
next ECB code following the given date
Definition: ecb.hpp:90
static const std::set< Date > & knownDates()
Definition: ecb.cpp:82
static bool isECBcode(const std::string &in)
returns whether or not the given string is an ECB code
Definition: ecb.cpp:215
static std::vector< Date > nextDates(const std::string &ecbCode, const Date &referenceDate=Date())
next maintenance period start dates following the given code
Definition: ecb.hpp:74
static Date date(Month m, Year y)
maintenance period start date in the given month/year
Definition: ecb.hpp:41
static std::string code(const Date &ecbDate)
Definition: ecb.cpp:129
static Date nextDate(const Date &d=Date())
next maintenance period start date following the given date
Definition: ecb.cpp:190
static bool isECBdate(const Date &d)
Definition: ecb.hpp:81
static Date nextDate(const std::string &ecbCode, const Date &referenceDate=Date())
next maintenance period start date following the given ECB code
Definition: ecb.hpp:65