Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
cirppparametrization.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2020 Quaternion Risk Management Ltd
3 All rights reserved.
4
5 This file is part of ORE, a free-software/open-source library
6 for transparent pricing and risk analysis - http://opensourcerisk.org
7
8 ORE is free software: you can redistribute it and/or modify it
9 under the terms of the Modified BSD License. You should have received a
10 copy of the license along with this program.
11 The license is also available online at <http://opensourcerisk.org>
12
13 This program is distributed on the basis that it will form a useful
14 contribution to risk analytics and model standardisation, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
17*/
18
19/*! \file cirppparametrization.hpp
20 \brief CIR ++ parametrisation
21 \ingroup models
22*/
23
24#ifndef quantext_cirpp_parametrization_hpp
25#define quantext_cirpp_parametrization_hpp
26
27#include <ql/handle.hpp>
28#include <ql/termstructures/defaulttermstructure.hpp>
29#include <ql/termstructures/yieldtermstructure.hpp>
31
32namespace QuantExt {
33
34//! CIR++ Parametrization
35/*! \ingroup models
36 */
37template <class TS> class CirppParametrization : public Parametrization {
38public:
39 CirppParametrization(const Currency& currency, const Handle<TS>& termStructure, bool shifted,
40 const std::string& name = std::string());
41
42 virtual Real kappa(const Time t) const = 0;
43 virtual Real theta(const Time t) const = 0;
44 virtual Real sigma(const Time t) const = 0;
45 virtual Real y0(const Time t) const = 0;
46
47 const Handle<TS> termStructure() const;
48 const bool shifted() const;
49
50 Size numberOfParameters() const override { return 4; }
51
52private:
53 const Handle<TS> termStructure_;
54 const bool shifted_;
55};
56
57template <class TS> inline const Handle<TS> CirppParametrization<TS>::termStructure() const { return termStructure_; }
58template <class TS> inline const bool CirppParametrization<TS>::shifted() const { return shifted_; }
59
60// typedef
63
64template <class TS>
65CirppParametrization<TS>::CirppParametrization(const Currency& currency, const Handle<TS>& termStructure, bool shifted,
66 const std::string& name)
67 : Parametrization(currency, name.empty() ? currency.code() : name), termStructure_(termStructure),
68 shifted_(shifted) {}
69
70} // namespace QuantExt
71
72#endif
virtual Real sigma(const Time t) const =0
CirppParametrization(const Currency &currency, const Handle< TS > &termStructure, bool shifted, const std::string &name=std::string())
virtual Real y0(const Time t) const =0
Size numberOfParameters() const override
virtual Real kappa(const Time t) const =0
virtual Real theta(const Time t) const =0
const Handle< TS > termStructure() const
const std::string & name() const
virtual const Currency & currency() const
CirppParametrization< YieldTermStructure > IrCirppParametrization
CirppParametrization< DefaultProbabilityTermStructure > CrCirppParametrization
base class for model parametrizations