| 1 | /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
| 2 | |
| 3 | /* |
| 4 | Copyright (C) 2007 Ferdinando Ametrano |
| 5 | Copyright (C) 2008 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 | <http://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 dategenerationrule.hpp |
| 22 | \brief date generation rule |
| 23 | */ |
| 24 | |
| 25 | #ifndef quantlib_date_generation_rule_hpp |
| 26 | #define quantlib_date_generation_rule_hpp |
| 27 | |
| 28 | #include <ql/qldefines.hpp> |
| 29 | #include <iosfwd> |
| 30 | |
| 31 | namespace QuantLib { |
| 32 | |
| 33 | //! Date-generation rule |
| 34 | /*! These conventions specify the rule used to generate dates in a |
| 35 | Schedule. |
| 36 | |
| 37 | \ingroup datetime |
| 38 | */ |
| 39 | struct DateGeneration { |
| 40 | enum Rule { |
| 41 | Backward, /*!< Backward from termination date to |
| 42 | effective date. */ |
| 43 | Forward, /*!< Forward from effective date to |
| 44 | termination date. */ |
| 45 | Zero, /*!< No intermediate dates between effective date |
| 46 | and termination date. */ |
| 47 | ThirdWednesday, /*!< All dates but effective date and termination |
| 48 | date are taken to be on the third wednesday |
| 49 | of their month (with forward calculation.) */ |
| 50 | ThirdWednesdayInclusive, /*!< All dates including effective date and termination |
| 51 | date are taken to be on the third wednesday |
| 52 | of their month (with forward calculation.) */ |
| 53 | Twentieth, /*!< All dates but the effective date are |
| 54 | taken to be the twentieth of their |
| 55 | month (used for CDS schedules in |
| 56 | emerging markets.) The termination |
| 57 | date is also modified. */ |
| 58 | TwentiethIMM, /*!< All dates but the effective date are |
| 59 | taken to be the twentieth of an IMM |
| 60 | month (used for CDS schedules.) The |
| 61 | termination date is also modified. */ |
| 62 | OldCDS, /*!< Same as TwentiethIMM with unrestricted date |
| 63 | ends and log/short stub coupon period (old |
| 64 | CDS convention). */ |
| 65 | CDS, /*!< Credit derivatives standard rule since 'Big |
| 66 | Bang' changes in 2009. */ |
| 67 | CDS2015, /*!< Credit derivatives standard rule since |
| 68 | December 20th, 2015. */ |
| 69 | }; |
| 70 | }; |
| 71 | |
| 72 | /*! \relates DateGeneration */ |
| 73 | std::ostream& operator<<(std::ostream&, |
| 74 | DateGeneration::Rule); |
| 75 | |
| 76 | } |
| 77 | |
| 78 | #endif |
| 79 | |