Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
malaysia.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 QuantLib {
22
24 // all calendar instances share the same implementation instance
25 static QuantLib::ext::shared_ptr<Calendar::Impl> impl(new Malaysia::MyxImpl);
26 impl_ = impl;
27}
28
29// Missing about 8 lunar calendar holidays
30bool Malaysia::MyxImpl::isBusinessDay(const Date& date) const {
31 Weekday w = date.weekday();
32 Day d = date.dayOfMonth();
33 Month m = date.month();
34 if (isWeekend(w)
35 // New Years
36 || ((d == 1 && m == January) || (d == 31 && m == December && w == Friday) ||
37 (d == 2 && m == January && w == Monday))
38 // Federal Territory Day
39 || ((d == 1 || ((d == 2 || d == 3) && w == Monday)) && m == February)
40 // Labour Day
41 || ((d == 1 || (d == 2 && w == Monday)) && m == May)
42 // National Day
43 || ((d == 31 && m == August) || (d == 1 && w == Monday && m == September))
44 // Malaysia Day
45 || ((d == 16 || (d == 17 && w == Monday)) && m == September)
46 // Christmas
47 || ((d == 25 || (d == 26 && w == Monday)) && m == December))
48 return false;
49 return true;
50}
51
52} // namespace QuantLib
bool isBusinessDay(const Date &) const override
Definition: malaysia.cpp:30
Malaysia(Market m=MYX)
Definition: malaysia.cpp:23
Malaysian calendar.