Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
philippines.cpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2018 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
20
21namespace QuantExt {
22
24 // all calendar instances share the same implementation instance
25 static QuantLib::ext::shared_ptr<Calendar::Impl> impl(new Philippines::PheImpl);
26 impl_ = impl;
27}
28
29// Missing Eidul Fitr and Eidul Adha (Lunar)
30bool Philippines::PheImpl::isBusinessDay(const Date& date) const {
31 Weekday w = date.weekday();
32 Day d = date.dayOfMonth(), dd = date.dayOfYear();
33 Month m = date.month();
34 Year y = date.year();
35 Day em = easterMonday(y);
36 if (isWeekend(w)
37 // New Years Day
38 || ((d == 1 || (d == 2 && w == Monday)) && m == January)
39 // Day of Valor
40 || (d == 9 && m == April)
41 // Maundy Thursday
42 || (dd == em - 4)
43 // Good Friday
44 || (dd == em - 3)
45 // Labor Day
46 || (d == 1 && m == May)
47 // Independence Day
48 || (d == 12 && m == June)
49 // Ninoy Aquino Day
50 || (d == 21 && m == August)
51 // National Heroes (last Mon of August)
52 || (d >= 25 && w == Monday && m == August)
53 // All Saints Day
54 || (d == 1 && m == November)
55 // Bonifacio Day
56 || (d == 30 && m == November)
57 // Christmas
58 || ((d == 25 || (d == 27 && (w == Monday || w == Tuesday))) && m == December)
59 // Rizal Day
60 || ((d == 30 && m == December) || (d == 2 && m == January && w == Tuesday))
61 // New Years Eve
62 || (d == 31 && m == December))
63 return false;
64 return true;
65}
66
67} // namespace QuantExt
bool isBusinessDay(const Date &) const override
Definition: philippines.cpp:30
Philippines(Market m=PHE)
Definition: philippines.cpp:23
Philippine calendar.