Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
timeperiod.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2017 Quaternion Risk Management Ltd
3 All rights reserved.
4
5 This file is part of ORE, a free-software/open-source library
6 for transparent pricing and risk analysis - http://opensourcerisk.org
7
8 ORE is free software: you can redistribute it and/or modify it
9 under the terms of the Modified BSD License. You should have received a
10 copy of the license along with this program.
11 The license is also available online at <http://opensourcerisk.org>
12
13 This program is distributed on the basis that it will form a useful
14 contribution to risk analytics and model standardisation, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
17*/
18
19/*! \file timeperiod.hpp
20 \brief non-contiguous time period handling
21 \ingroup utilities
22*/
23
24#pragma once
25
26#include <ql/errors.hpp>
27#include <ql/time/calendar.hpp>
28#include <ql/time/date.hpp>
29
30#include <vector>
31
32namespace ore {
33namespace data {
34using QuantLib::Date;
35using QuantLib::Size;
36
37//! Handles non-contiguous time period
38/*!
39\ingroup utilities
40*/
42public:
43 /* The given vector of dates defines the contiguous parts of the time period
44 as start1, end1, start2, end2, ...
45 The single parts may overlap.
46 If mporDays, and a Calendar are provided, each startdate will be adjusted
47 backward to include the mpor period
48 */
49 TimePeriod(const std::vector<Date>& dates, Size mporDays = QuantLib::Null<Size>(),
51 Size numberOfContiguousParts() const { return startDates_.size(); }
52 const std::vector<Date>& startDates() const { return startDates_; }
53 const std::vector<Date>& endDates() const { return endDates_; }
54 bool contains(const Date& d) const;
55
56private:
57 std::vector<Date> startDates_, endDates_;
58};
59
60TimePeriod totalTimePeriod(std::vector<std::string> timePeriods, Size mporDays = QuantLib::Null<Size>(),
62
63std::ostream& operator<<(std::ostream& out, const TimePeriod& t);
64
65} // namespace data
66} // namespace ore
Handles non-contiguous time period.
Definition: timeperiod.hpp:41
std::vector< Date > startDates_
Definition: timeperiod.hpp:57
std::vector< Date > endDates_
Definition: timeperiod.hpp:57
const std::vector< Date > & endDates() const
Definition: timeperiod.hpp:53
const std::vector< Date > & startDates() const
Definition: timeperiod.hpp:52
bool contains(const Date &d) const
Definition: timeperiod.cpp:42
Size numberOfContiguousParts() const
Definition: timeperiod.hpp:51
@ data
Definition: log.hpp:77
Calendar calendar
Definition: utilities.cpp:441
std::ostream & operator<<(std::ostream &out, EquityReturnType t)
TimePeriod totalTimePeriod(std::vector< std::string > timePeriods, Size mporDays, const QuantLib::Calendar &calendar)
Definition: timeperiod.cpp:59
Serializable Credit Default Swap.
Definition: namespaces.docs:23