/src/quantlib/ql/time/calendars/unitedkingdom.hpp
Line | Count | Source |
1 | | /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | |
3 | | /* |
4 | | Copyright (C) 2004 Ferdinando Ametrano |
5 | | Copyright (C) 2000, 2001, 2002, 2003 RiskMap srl |
6 | | |
7 | | This file is part of QuantLib, a free-software/open-source library |
8 | | for financial quantitative analysts and developers - http://quantlib.org/ |
9 | | |
10 | | QuantLib is free software: you can redistribute it and/or modify it |
11 | | under the terms of the QuantLib license. You should have received a |
12 | | copy of the license along with this program; if not, please email |
13 | | <quantlib-dev@lists.sf.net>. The license is also available online at |
14 | | <https://www.quantlib.org/license.shtml>. |
15 | | |
16 | | This program is distributed in the hope that it will be useful, but WITHOUT |
17 | | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
18 | | FOR A PARTICULAR PURPOSE. See the license for more details. |
19 | | */ |
20 | | |
21 | | /*! \file unitedkingdom.hpp |
22 | | \brief UK calendars |
23 | | */ |
24 | | |
25 | | #ifndef quantlib_united_kingdom_calendar_hpp |
26 | | #define quantlib_united_kingdom_calendar_hpp |
27 | | |
28 | | #include <ql/time/calendar.hpp> |
29 | | |
30 | | namespace QuantLib { |
31 | | |
32 | | //! United Kingdom calendars |
33 | | /*! Repeating Public holidays (data from https://www.gov.uk/bank-holidays): |
34 | | <ul> |
35 | | <li>Saturdays</li> |
36 | | <li>Sundays</li> |
37 | | <li>New Year's Day, January 1st (possibly moved to Monday)</li> |
38 | | <li>Good Friday</li> |
39 | | <li>Easter Monday</li> |
40 | | <li>Early May Bank Holiday, first Monday of May</li> |
41 | | <li>Spring Bank Holiday, last Monday of May</li> |
42 | | <li>Summer Bank Holiday, last Monday of August</li> |
43 | | <li>Christmas Day, December 25th (possibly moved to Monday or |
44 | | Tuesday)</li> |
45 | | <li>Boxing Day, December 26th (possibly moved to Monday or |
46 | | Tuesday)</li> |
47 | | </ul> |
48 | | |
49 | | Holidays for the stock exchange: |
50 | | <ul> |
51 | | <li>Saturdays</li> |
52 | | <li>Sundays</li> |
53 | | <li>New Year's Day, January 1st (possibly moved to Monday)</li> |
54 | | <li>Good Friday</li> |
55 | | <li>Easter Monday</li> |
56 | | <li>Early May Bank Holiday, first Monday of May</li> |
57 | | <li>Spring Bank Holiday, last Monday of May</li> |
58 | | <li>Summer Bank Holiday, last Monday of August</li> |
59 | | <li>Christmas Day, December 25th (possibly moved to Monday or |
60 | | Tuesday)</li> |
61 | | <li>Boxing Day, December 26th (possibly moved to Monday or |
62 | | Tuesday)</li> |
63 | | </ul> |
64 | | |
65 | | Holidays for the metals exchange: |
66 | | <ul> |
67 | | <li>Saturdays</li> |
68 | | <li>Sundays</li> |
69 | | <li>New Year's Day, January 1st (possibly moved to Monday)</li> |
70 | | <li>Good Friday</li> |
71 | | <li>Easter Monday</li> |
72 | | <li>Early May Bank Holiday, first Monday of May</li> |
73 | | <li>Spring Bank Holiday, last Monday of May</li> |
74 | | <li>Summer Bank Holiday, last Monday of August</li> |
75 | | <li>Christmas Day, December 25th (possibly moved to Monday or |
76 | | Tuesday)</li> |
77 | | <li>Boxing Day, December 26th (possibly moved to Monday or |
78 | | Tuesday)</li> |
79 | | </ul> |
80 | | |
81 | | Note that there are some one-off holidays not listed above. |
82 | | See the implementation for the complete list. |
83 | | |
84 | | \ingroup calendars |
85 | | |
86 | | \todo add LIFFE |
87 | | |
88 | | \test the correctness of the returned results is tested |
89 | | against a list of known holidays. |
90 | | */ |
91 | | class UnitedKingdom : public Calendar { |
92 | | private: |
93 | | class SettlementImpl final : public Calendar::WesternImpl { |
94 | | public: |
95 | 0 | std::string name() const override { return "UK settlement"; } |
96 | | bool isBusinessDay(const Date&) const override; |
97 | | }; |
98 | | class ExchangeImpl final : public Calendar::WesternImpl { |
99 | | public: |
100 | 0 | std::string name() const override { return "London stock exchange"; } |
101 | | bool isBusinessDay(const Date&) const override; |
102 | | }; |
103 | | class MetalsImpl final : public Calendar::WesternImpl { |
104 | | public: |
105 | 0 | std::string name() const override { return "London metals exchange"; } |
106 | | bool isBusinessDay(const Date&) const override; |
107 | | }; |
108 | | public: |
109 | | //! UK calendars |
110 | | enum Market { Settlement, //!< generic settlement calendar |
111 | | Exchange, //!< London stock-exchange calendar |
112 | | Metals //|< London metals-exchange calendar |
113 | | }; |
114 | | UnitedKingdom(Market market = Settlement); |
115 | | }; |
116 | | |
117 | | } |
118 | | |
119 | | |
120 | | #endif |