Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
calendaradjustmentconfig.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2019 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 ored/utilities/calendaradjustmentconfig.hpp
20 \brief Interface for calendar modifications, additional holidays and business days
21 \ingroup utilities
22*/
23
24#pragma once
25
26#include <map>
28#include <ql/patterns/singleton.hpp>
29#include <ql/time/calendar.hpp>
30#include <ql/time/date.hpp>
31#include <ql/utilities/dataparsers.hpp>
32#include <set>
33#include <string>
34#include <vector>
35
36namespace ore {
37namespace data {
39using QuantLib::Date;
40using std::map;
41using std::set;
42using std::string;
43using std::vector;
44
46public:
47 // default constructor
49 //! This method adds d to the list of holidays for cal name.
50 void addHolidays(const string& calname, const Date& d);
51
52 //! This method adds d to the list of business days for cal name.
53 void addBusinessDays(const string& calname, const Date& d);
54
55 //! This method adds s as a base calendar for cal name.
56 void addBaseCalendar(const string& calname, const string& d);
57
58 //! Returns all the holidays for a given cal name
59 const set<Date>& getHolidays(const string& calname) const;
60
61 //! Returns all the business days for a given calname
62 const set<Date>& getBusinessDays(const string& calname) const;
63
64 set<string> getCalendars() const;
65
66 const string& getBaseCalendar(const string& calname) const;
67
68 void fromXML(XMLNode* node) override;
69 XMLNode* toXML(XMLDocument& doc) const override;
70
71 //! add all holidays and business days from c to this instance
72 void append(const CalendarAdjustmentConfig& c);
73
74private:
75 map<string, string> baseCalendars_;
76 map<string, set<Date>> additionalHolidays_;
77 map<string, set<Date>> additionalBusinessDays_;
78
79 string normalisedName(const string&) const;
80};
81
82} // namespace data
83} // namespace ore
const set< Date > & getHolidays(const string &calname) const
Returns all the holidays for a given cal name.
const string & getBaseCalendar(const string &calname) const
void addBusinessDays(const string &calname, const Date &d)
This method adds d to the list of business days for cal name.
string normalisedName(const string &) const
XMLNode * toXML(XMLDocument &doc) const override
void addBaseCalendar(const string &calname, const string &d)
This method adds s as a base calendar for cal name.
const set< Date > & getBusinessDays(const string &calname) const
Returns all the business days for a given calname.
map< string, set< Date > > additionalHolidays_
void addHolidays(const string &calname, const Date &d)
This method adds d to the list of holidays for cal name.
void append(const CalendarAdjustmentConfig &c)
add all holidays and business days from c to this instance
map< string, set< Date > > additionalBusinessDays_
Small XML Document wrapper class.
Definition: xmlutils.hpp:65
Base class for all serializable classes.
Definition: xmlutils.hpp:101
@ data
Definition: log.hpp:77
Serializable Credit Default Swap.
Definition: namespaces.docs:23
XML utility functions.