| 1 | /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
| 2 | |
| 3 | /* |
| 4 | Copyright (C) 2007, 2009 Chris Kenyon |
| 5 | Copyright (C) 2021 Ralf Konrad Eckel |
| 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 ukrpi.hpp |
| 22 | \brief %UKRPI index |
| 23 | */ |
| 24 | |
| 25 | #ifndef quantlib_ukrpi_hpp |
| 26 | #define quantlib_ukrpi_hpp |
| 27 | |
| 28 | #include <ql/currencies/europe.hpp> |
| 29 | #include <ql/indexes/inflationindex.hpp> |
| 30 | |
| 31 | namespace QuantLib { |
| 32 | |
| 33 | //! UK Retail Price Inflation Index |
| 34 | class UKRPI : public ZeroInflationIndex { |
| 35 | public: |
| 36 | explicit UKRPI(const Handle<ZeroInflationTermStructure>& ts = {}) |
| 37 | : ZeroInflationIndex( |
| 38 | "RPI" , UKRegion(), false, Monthly, Period(1, Months), GBPCurrency(), ts) {} |
| 39 | |
| 40 | /*! \deprecated Use the constructor without the "interpolated" parameter. |
| 41 | Deprecated in version 1.29. |
| 42 | */ |
| 43 | QL_DEPRECATED |
| 44 | explicit UKRPI( |
| 45 | bool interpolated, |
| 46 | const Handle<ZeroInflationTermStructure>& ts = {}) |
| 47 | : UKRPI(ts) { |
| 48 | QL_DEPRECATED_DISABLE_WARNING |
| 49 | interpolated_ = interpolated; |
| 50 | QL_DEPRECATED_ENABLE_WARNING |
| 51 | } |
| 52 | }; |
| 53 | |
| 54 | |
| 55 | //! Quoted year-on-year UK RPI (i.e. not a ratio of UK RPI) |
| 56 | class YYUKRPI : public YoYInflationIndex { |
| 57 | public: |
| 58 | explicit YYUKRPI( |
| 59 | bool interpolated, |
| 60 | const Handle<YoYInflationTermStructure>& ts = {}) |
| 61 | : YoYInflationIndex("YY_RPI" , |
| 62 | UKRegion(), |
| 63 | false, |
| 64 | interpolated, |
| 65 | Monthly, |
| 66 | Period(1, Months), |
| 67 | GBPCurrency(), |
| 68 | ts) {} |
| 69 | }; |
| 70 | |
| 71 | |
| 72 | QL_DEPRECATED_DISABLE_WARNING |
| 73 | |
| 74 | //! Year-on-year UK RPI (i.e. a ratio of UK RPI) |
| 75 | /*! \deprecated Pass the UKRPI index to YoYInflationIndex instead. |
| 76 | Deprecated in version 1.31. |
| 77 | */ |
| 78 | class [[deprecated("Pass the UKRPI index to YoYInflationIndex instead" )]] YYUKRPIr : public YoYInflationIndex { |
| 79 | public: |
| 80 | explicit YYUKRPIr( |
| 81 | bool interpolated, |
| 82 | const Handle<YoYInflationTermStructure>& ts = {}) |
| 83 | : YoYInflationIndex("YYR_RPI" , |
| 84 | UKRegion(), |
| 85 | false, |
| 86 | interpolated, |
| 87 | true, |
| 88 | Monthly, |
| 89 | Period(1, Months), |
| 90 | GBPCurrency(), |
| 91 | ts) {} |
| 92 | }; |
| 93 | |
| 94 | QL_DEPRECATED_ENABLE_WARNING |
| 95 | } |
| 96 | |
| 97 | |
| 98 | #endif |
| 99 | |