/src/quantlib/ql/time/daycounters/business252.hpp
Line | Count | Source |
1 | | /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | |
3 | | /* |
4 | | Copyright (C) 2006 Piter Dias |
5 | | Copyright (C) 2011 StatPro Italia 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 business252.hpp |
22 | | \brief business/252 day counter |
23 | | */ |
24 | | |
25 | | #ifndef quantlib_business252_day_counter_hpp |
26 | | #define quantlib_business252_day_counter_hpp |
27 | | |
28 | | #include <ql/time/calendar.hpp> |
29 | | #include <ql/time/calendars/brazil.hpp> |
30 | | #include <ql/time/daycounter.hpp> |
31 | | #include <utility> |
32 | | |
33 | | namespace QuantLib { |
34 | | |
35 | | //! Business/252 day count convention |
36 | | /*! \ingroup daycounters */ |
37 | | class Business252 : public DayCounter { |
38 | | private: |
39 | | class Impl final : public DayCounter::Impl { |
40 | | private: |
41 | | Calendar calendar_; |
42 | | public: |
43 | | std::string name() const override; |
44 | | Date::serial_type dayCount(const Date& d1, const Date& d2) const override; |
45 | | Time |
46 | | yearFraction(const Date& d1, const Date& d2, const Date&, const Date&) const override; |
47 | 0 | explicit Impl(Calendar c) : calendar_(std::move(c)) {} |
48 | | }; |
49 | | public: |
50 | | Business252(const Calendar& c = Brazil()) |
51 | 0 | : DayCounter(ext::shared_ptr<DayCounter::Impl>(new Business252::Impl(c))) {} |
52 | | }; |
53 | | |
54 | | } |
55 | | |
56 | | #endif |