Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
mauritius.cpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2022 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 {
23 // all calendar instances share the same implementation instance
24 static ext::shared_ptr<Calendar::Impl> impl(new Mauritius::SemImpl);
25 impl_ = impl;
26}
27
28bool Mauritius::SemImpl::isBusinessDay(const Date& date) const {
29 Weekday w = date.weekday();
30 Day d = date.dayOfMonth();
31 Month m = date.month();
32 Year y = date.year();
33
34 if(isWeekend(w)
35 // New year's day
36 || (d == 1 && m == January)
37 // Abolition of slavery
38 || (d == 1 && m == February )
39 // Independence and Republic day
40 || (d == 12 && m == March )
41 // Labour day
42 || (d == 1 && m == May)
43 // Arrival of indentured laborers
44 || (d == 2 && m == November)
45 // Christmas
46 || (d == 25 && m == December )
47 )
48 return false;
49 if(y == 2022){
50 if( // New year holiday
51 (d == 3 && m == January)
52 // Thaipoosam Cavadee
53 || (d == 18 && m == January)
54 // Chinese Spring Festival
55 || (d == 1 && m == February )
56 // Maha Shivaratree
57 || (d == 1 && m == March )
58 // Eid-Ul-Fitr
59 || (d == 3 && m == May )
60 // Assumption of the blessed Virgin Mary
61 || (d == 15 && m == August)
62 // Ganesh Chartuthi
63 || (d == 1 && m == September)
64 // Divali
65 || (d == 24 && m == October)
66 )
67 return false;
68 }
69 else if (y == 2023){
70 if( // New year holiday
71 (d == 2 && m == January)
72 // New year holiday
73 || (d == 3 && m == January)
74 // Ugaadi
75 || (d == 22 && m == March )
76 // Labour day
77 || (d == 1 && m == May )
78 // Ganesh Chartuthi
79 || (d == 20 && m == September)
80 //All Saints Day
81 || (d == 1 && m == November)
82 )
83 return false;
84 }
85 return true;
86}
87}
bool isBusinessDay(const Date &) const override
Definition: mauritius.cpp:28
Mauritius(Market m=SEM)
Definition: mauritius.cpp:22