Coverage Report

Created: 2026-10-31 06:47

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/quantlib/ql/time/calendars/malaysia.hpp
Line
Count
Source
1
/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3
/*
4
 Copyright (C) 2026 Lawrenz Law
5
6
 This file is part of QuantLib, a free-software/open-source library
7
 for financial quantitative analysts and developers - http://quantlib.org/
8
9
 QuantLib is free software: you can redistribute it and/or modify it
10
 under the terms of the QuantLib license.  You should have received a
11
 copy of the license along with this program; if not, please email
12
 <quantlib-dev@lists.sf.net>. The license is also available online at
13
 <https://www.quantlib.org/license.shtml>.
14
15
 This program is distributed in the hope that it will be useful, but WITHOUT
16
 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17
 FOR A PARTICULAR PURPOSE.  See the license for more details.
18
*/
19
20
/*! \file malaysia.hpp
21
    \brief Malaysian calendar
22
*/
23
24
#ifndef quantlib_malaysia_calendar_hpp
25
#define quantlib_malaysia_calendar_hpp
26
27
#include <ql/time/calendar.hpp>
28
29
namespace QuantLib {
30
31
    //! Malaysian calendar
32
    /*! Holidays for the Kuala Lumpur stock exchange (Bursa Malaysia).
33
34
        Bursa Malaysia observes the federal public holidays gazetted for the
35
        Federal Territory of Kuala Lumpur, so state-only holidays (for example
36
        Good Friday in Sabah and Sarawak, or the Harvest Festival in Sabah and
37
        Labuan) are deliberately not included.
38
39
        Holidays with a fixed date:
40
        <ul>
41
        <li>Saturdays</li>
42
        <li>Sundays</li>
43
        <li>New Year's Day, January 1st</li>
44
        <li>Federal Territory Day, February 1st</li>
45
        <li>Labour Day, May 1st</li>
46
        <li>National Day (Hari Merdeka), August 31st</li>
47
        <li>Malaysia Day, September 16th (a federal holiday since 2010)</li>
48
        <li>Christmas Day, December 25th</li>
49
        </ul>
50
51
        Holidays with no fixed rule, tabulated for 2015 to 2027:
52
        <ul>
53
        <li>Chinese New Year (two days)</li>
54
        <li>Thaipusam</li>
55
        <li>Wesak Day</li>
56
        <li>Deepavali</li>
57
        <li>Nuzul Al-Quran</li>
58
        <li>Hari Raya Aidilfitri (two days)</li>
59
        <li>Hari Raya Haji</li>
60
        <li>Awal Muharram</li>
61
        <li>Maulidur Rasul</li>
62
        <li>Birthday of the Yang di-Pertuan Agong</li>
63
        <li>Substitute days granted when a gazetted holiday falls on a Sunday</li>
64
        <li>One-off federal holidays (royal installations, the 2018 general
65
            election, the 2017 SEA Games)</li>
66
        </ul>
67
68
        The Islamic, Chinese and Hindu festivals are set each year by
69
        proclamation rather than by calculation, so they are tabulated from the
70
        published holiday lists rather than computed. Outside the tabulated
71
        range only the fixed-date holidays above are returned.
72
73
        Holiday dates compiled from the gazetted Malaysian public holiday
74
        lists published at
75
        <https://www.officeholidays.com/countries/malaysia>, cross-checked for
76
        2021-2026 against Google's public Malaysia holiday calendar. They
77
        should be verified against the trading calendar published by Bursa
78
        Malaysia at <https://www.bursamalaysia.com/> before being relied upon.
79
80
        \ingroup calendars
81
    */
82
    class Malaysia : public Calendar {
83
      private:
84
        class KlseImpl final : public Calendar::WesternImpl {
85
          public:
86
0
            std::string name() const override { return "Kuala Lumpur stock exchange"; }
87
            bool isBusinessDay(const Date&) const override;
88
        };
89
90
      public:
91
        enum Market {
92
            KLSE //!< Kuala Lumpur stock exchange (Bursa Malaysia)
93
        };
94
        explicit Malaysia(Market m = KLSE);
95
    };
96
97
}
98
99
#endif