Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
cyprus.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*/
20#include <ql/errors.hpp>
21
22namespace QuantExt {
23 using namespace QuantLib;
24
26 // all calendar instances on the same market share the same
27 // implementation instance
28 impl_ = QuantLib::ext::make_shared<Cyprus::Impl>();
29 }
30
31 bool Cyprus::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
38 if (isWeekend(w)
39 // New Year's Day
40 || (d == 1 && m == January)
41 // Ephiphany Day
42 || (d == 6 && m == January)
43 // Green Monday
44 || (dd == em-49)
45 // Good Friday
46 || (dd == em-3)
47 // Easter Monday
48 || (dd == em)
49 // Easter Tuesday
50 || (dd == em+1)
51 // Greek Independence Day
52 || (m == Mar && d == 25)
53 // National Day
54 || (m == Apr && d == 1)
55 // Labour Day
56 || (m == May && d == 1)
57 // Orthodox Pentecoast (Whit) Monday
58 || (dd == em+49)
59 // Assumption Day (Theotokos)
60 || (m == August && d == 15)
61 // Cyprus Independence Day
62 || (m == October && d == 1)
63 // Greek National Day
64 || (m == October && d == 28)
65 // Christmas Day
66 || (m == December && d == 25)
67 // Boxing Day
68 || (m == December && d == 26))
69 return false; // NOLINT(readability-simplify-boolean-expr)
70 return true;
71 }
72
73}
74
bool isBusinessDay(const QuantLib::Date &) const override
Definition: cyprus.cpp:31
Cyprus Calendar.
helper functions for date operations