/usr/include/ql/time/ecb.hpp is in libquantlib0-dev 1.12-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
Copyright (C) 2009 Ferdinando Ametrano
This file is part of QuantLib, a free-software/open-source library
for financial quantitative analysts and developers - http://quantlib.org/
QuantLib is free software: you can redistribute it and/or modify it
under the terms of the QuantLib license. You should have received a
copy of the license along with this program; if not, please email
<quantlib-dev@lists.sf.net>. The license is also available online at
<http://quantlib.org/license.shtml>.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the license for more details.
*/
/*! \file ecb.hpp
\brief European Central Bank reserve maintenance date functions
*/
#ifndef quantlib_ecb_hpp
#define quantlib_ecb_hpp
#include <ql/time/date.hpp>
#include <set>
#include <vector>
namespace QuantLib {
//! European Central Bank reserve maintenance dates
struct ECB {
static const std::set<Date>& knownDates();
static void addDate(const Date& d);
static void removeDate(const Date& d);
//! maintenance period start date in the given month/year
static Date date(Month m,
Year y) { return nextDate(Date(1, m, y) - 1); }
/*! returns the ECB date for the given ECB code
(e.g. March xxth, 2013 for MAR10).
\warning It raises an exception if the input
string is not an ECB code
*/
static Date date(const std::string& ecbCode,
const Date& referenceDate = Date());
/*! returns the ECB code for the given date
(e.g. MAR10 for March xxth, 2010).
\warning It raises an exception if the input
date is not an ECB date
*/
static std::string code(const Date& ecbDate);
//! next maintenance period start date following the given date
static Date nextDate(const Date& d = Date());
//! next maintenance period start date following the given ECB code
static Date nextDate(const std::string& ecbCode,
const Date& referenceDate = Date()) {
return nextDate(date(ecbCode, referenceDate));
}
//! next maintenance period start dates following the given date
static std::vector<Date> nextDates(const Date& d = Date());
//! next maintenance period start dates following the given code
static std::vector<Date> nextDates(const std::string& ecbCode,
const Date& referenceDate = Date()) {
return nextDates(date(ecbCode, referenceDate));
}
/*! returns whether or not the given date is
a maintenance period start date */
static bool isECBdate(const Date& d) {
Date date = nextDate(d-1);
return d==date;
}
//! returns whether or not the given string is an ECB code
static bool isECBcode(const std::string& in);
//! next ECB code following the given date
static std::string nextCode(const Date& d = Date()) {
return code(nextDate(d));
}
//! next ECB code following the given code
static std::string nextCode(const std::string& ecbCode);
};
}
#endif
|