23#include <ql/time/calendar.hpp>
45 return holidays->second;
47 static set<Date> empty;
55 return businessDays->second;
57 static set<Date> empty;
65 cals.insert(it.first);
68 cals.insert(it.first);
80 static const string empty =
"";
104 if (baseCalendar !=
"") {
113 for (
auto holiday : holidayDates) {
118 }
catch(std::exception&) {
119 ALOG(
"error parsing holiday " << holiday <<
" for calendar " << calname);
123 for (
auto businessDay : businessDates) {
127 cal.removeHoliday(b);
128 }
catch(std::exception&) {
129 ALOG(
"error parsing business day " << businessDay <<
" for calendar " << calname);
137 if (baseCalendar ==
"")
139 Calendar cal = CalendarParser::instance().addCalendar(baseCalendar, calname);
142 for (
auto holiday : holidayDates) {
147 }
catch(std::exception&) {
148 ALOG(
"error parsing business day " << holiday <<
" for calendar " << calname);
153 for (
auto businessDay : businessDates) {
157 cal.removeHoliday(b);
158 }
catch(std::exception&) {
159 ALOG(
"error parsing business day " << businessDay <<
" for calendar " << calname);
Interface for calendar modifications, additional holidays and business days.
calendar parser singleton class
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.
set< string > getCalendars() const
CalendarAdjustmentConfig()
string normalisedName(const string &) const
map< string, string > baseCalendars_
void fromXML(XMLNode *node) override
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.
XMLNode * allocNode(const string &nodeName)
util functions that wrap rapidxml
static void addAttribute(XMLDocument &doc, XMLNode *node, const string &attrName, const string &attrValue)
static string getAttribute(XMLNode *node, const string &attrName)
static void checkNode(XMLNode *n, const string &expectedName)
static vector< XMLNode * > getChildrenNodes(XMLNode *node, const string &name)
Returns all the children with a given name.
static string getChildValue(XMLNode *node, const string &name, bool mandatory=false, const string &defaultValue=string())
static vector< string > getChildrenValues(XMLNode *node, const string &names, const string &name, bool mandatory=false)
static XMLNode * addChild(XMLDocument &doc, XMLNode *n, const string &name)
Calendar parseCalendar(const string &s)
Convert text to QuantLib::Calendar.
Date parseDate(const string &s)
Convert std::string to QuantLib::Date.
#define ALOG(text)
Logging Macro (Level = Alert)
std::string to_string(const LocationInfo &l)
Serializable Credit Default Swap.
Map text representations to QuantLib/QuantExt types.
string conversion utilities