Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
greece.cpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2021 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#include <ql/errors.hpp>
21
22namespace QuantExt {
23using namespace QuantLib;
24
26 // all calendar instances on the same market share the same
27 // implementation instance
28 impl_ = QuantLib::ext::make_shared<Greece::Impl>();
29}
30
31bool Greece::Impl::isBusinessDay(const Date& date) const {
32 Weekday w = date.weekday();
33 Day d = date.dayOfMonth(), dd = date.dayOfYear();
34 Month m = date.month();
35 Year y = date.year();
36 Day em = easterMonday(y);
37 Day laborDay = Date(1, May, y).dayOfYear();
38
39 if (isWeekend(w)
40 // New Year's Day
41 || (d == 1 && m == January)
42 // Ephiphany Day
43 || (d == 6 && m == January)
44 // Clean Monday
45 || (dd == em - 49)
46 // Good Friday
47 || (dd == em - 3)
48 // Easter Monday
49 || (dd == em)
50 // Greek Independence Day
51 || (m == Mar && d == 25)
52 // Labour Day
53 || (m == May && ((d == 1) || ((w==Tuesday) && (d<=5) && (em-3 <= laborDay && laborDay <= em))))
54 // Orthodox Pentecoast (Whit) Monday
55 || (dd == em + 49)
56 // Assumption Day
57 || (m == August && d == 15)
58 // Greek National Day
59 || (m == October && d == 28)
60 // Christmas Day
61 || (m == December && d == 25)
62 // Christmas Day
63 || (m == December && d == 26))
64 return false; // NOLINT(readability-simplify-boolean-expr)
65 return true;
66}
67
68} // namespace QuantExt
bool isBusinessDay(const QuantLib::Date &) const override
Definition: greece.cpp:31
helper functions for date operations
Greece Calendars.