QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
austria.cpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2004 StatPro Italia srl
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 <http://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#include <ql/time/calendars/austria.hpp>
21#include <ql/errors.hpp>
22
23namespace QuantLib {
24
26 // all calendar instances on the same market share the same
27 // implementation instance
28 static ext::shared_ptr<Calendar::Impl> settlementImpl(
30 static ext::shared_ptr<Calendar::Impl> exchangeImpl(
32 switch (market) {
33 case Settlement:
34 impl_ = settlementImpl;
35 break;
36 case Exchange:
37 impl_ = exchangeImpl;
38 break;
39 default:
40 QL_FAIL("unknown market");
41 }
42 }
43
44
46 Weekday w = date.weekday();
47 Day d = date.dayOfMonth(), dd = date.dayOfYear();
48 Month m = date.month();
49 Year y = date.year();
50 Day em = easterMonday(y);
51 if (isWeekend(w)
52 // New Year's Day
53 || (d == 1 && m == January)
54 // Epiphany
55 || (d == 6 && m == January)
56 // Easter Monday
57 || (dd == em)
58 // Ascension Thurday
59 || (dd == em+38)
60 // Whit Monday
61 || (dd == em+49)
62 // Corpus Christi
63 || (dd == em+59)
64 // Labour Day
65 || (d == 1 && m == May)
66 // Assumption
67 || (d == 15 && m == August)
68 // National Holiday since 1967
69 || (d == 26 && m == October && y >= 1967)
70 // National Holiday 1919-1934
71 || (d == 12 && m == November && y >= 1919 && y <= 1934)
72 // All Saints' Day
73 || (d == 1 && m == November)
74 // Immaculate Conception
75 || (d == 8 && m == December)
76 // Christmas
77 || (d == 25 && m == December)
78 // St. Stephen
79 || (d == 26 && m == December))
80 return false; // NOLINT(readability-simplify-boolean-expr)
81 return true;
82 }
83
84
86 Weekday w = date.weekday();
87 Day d = date.dayOfMonth(), dd = date.dayOfYear();
88 Month m = date.month();
89 Year y = date.year();
90 Day em = easterMonday(y);
91 if (isWeekend(w)
92 // New Year's Day
93 || (d == 1 && m == January)
94 // Good Friday
95 || (dd == em-3)
96 // Easter Monday
97 || (dd == em)
98 // Whit Monay
99 || (dd == em+49)
100 // Labour Day
101 || (d == 1 && m == May)
102 // National Holiday since 1967
103 || (d == 26 && m == October && y >= 1967)
104 // National Holiday 1919-1934
105 || (d == 12 && m == November && y >= 1919 && y <= 1934)
106 // Christmas' Eve
107 || (d == 24 && m == December)
108 // Christmas
109 || (d == 25 && m == December)
110 // St. Stephen
111 || (d == 26 && m == December)
112 // Exchange Holiday
113 || (d == 31 && m == December))
114 return false; // NOLINT(readability-simplify-boolean-expr)
115 return true;
116 }
117
118}
119
bool isBusinessDay(const Date &) const override
Definition: austria.cpp:85
bool isBusinessDay(const Date &) const override
Definition: austria.cpp:45
Austria(Market market=Settlement)
Definition: austria.cpp:25
Market
Austrian calendars.
Definition: austria.hpp:86
@ Settlement
generic settlement calendar
Definition: austria.hpp:86
@ Exchange
Vienna stock-exchange calendar.
Definition: austria.hpp:87
static Day easterMonday(Year)
expressed relative to first day of year
Definition: calendar.cpp:193
bool isWeekend(Weekday) const override
Definition: calendar.cpp:189
bool isWeekend(Weekday w) const
Definition: calendar.hpp:255
ext::shared_ptr< Impl > impl_
Definition: calendar.hpp:72
Concrete date class.
Definition: date.hpp:125
Month month() const
Definition: date.cpp:82
Year year() const
Definition: date.cpp:93
Day dayOfMonth() const
Definition: date.hpp:400
Weekday weekday() const
Definition: date.hpp:395
Day dayOfYear() const
One-based (Jan 1st = 1)
Definition: date.hpp:404
Integer Year
Year number.
Definition: date.hpp:87
Integer Day
Day number.
Definition: date.hpp:53
Month
Month names.
Definition: date.hpp:57
@ December
Definition: date.hpp:68
@ August
Definition: date.hpp:64
@ January
Definition: date.hpp:57
@ May
Definition: date.hpp:61
@ November
Definition: date.hpp:67
@ October
Definition: date.hpp:66
Definition: any.hpp:35