Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
crcirpp.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/*!
20 \file crcirpp.hpp
21 \brief CIR++ credit model class
22 \ingroup models
23 */
24
25#ifndef quantext_crcirpp_hpp
26#define quantext_crcirpp_hpp
27
28#include <ql/experimental/credit/cdsoption.hpp>
29#include <ql/stochasticprocess.hpp>
30#include <ql/termstructures/defaulttermstructure.hpp>
34
35#include <ql/math/distributions/chisquaredistribution.hpp>
36
37namespace QuantExt {
38using namespace QuantLib;
39
40//! Cox-Ingersoll-Ross ++ credit model class.
41/*! This class implements the Cox-Ingersoll-Ross model defined by
42 \f[
43 \lambda(t) = y(t) + \psi (t) \\
44 dy(t) = a(\theta - y(t)) dt + \sigma \, \sqrt{y(t)} \, dW
45 \f]
46*/
47
49
50public:
51 CrCirpp(const QuantLib::ext::shared_ptr<CrCirppParametrization>& parametrization);
52
53 Real zeroBond(Real t, Real T, Real y) const;
54 Real survivalProbability(Real t, Real T, Real y) const;
55
56 // density of y(t) incl required change of measure
57 Real densityForwardMeasure(Real x, Real t);
58 Real cumulativeForwardMeasure(Real x, Real t);
59 // density of y(t) in the w/o change of measure
60 Real density(Real x, Real t);
61 Real cumulative(Real x, Real t);
62 Real zeroBondOption(Real eval_t, Real expiry_T, Real maturity_tau, Real strike_k, Real y_t, Real w);
63
64 Handle<DefaultProbabilityTermStructure> defaultCurve(std::vector<Date> dateGrid = std::vector<Date>()) const;
65
66 const QuantLib::ext::shared_ptr<CrCirppParametrization> parametrization() const;
67 const QuantLib::ext::shared_ptr<StochasticProcess> stateProcess() const;
68
69 Real A(Real t, Real T) const;
70 Real B(Real t, Real T) const;
71
72 /*! observer and linked calibrated model interface */
73 void update() override;
74 void generateArguments() override;
75
76private:
77 QuantLib::ext::shared_ptr<CrCirppParametrization> parametrization_;
78 QuantLib::ext::shared_ptr<CrCirppStateProcess> stateProcess_;
79}; // class CrCirpp
80
81inline void CrCirpp::update() {
82 notifyObservers();
83 parametrization_->update();
84}
85
87
88inline const QuantLib::ext::shared_ptr<CrCirppParametrization> CrCirpp::parametrization() const {
89 return parametrization_;
90}
91
92inline const QuantLib::ext::shared_ptr<StochasticProcess> CrCirpp::stateProcess() const {
93 QL_REQUIRE(stateProcess_ != NULL, "stateProcess has null pointer in CIR++ stateProcess!");
94 return stateProcess_;
95}
96
97} // end namespace QuantExt
98
99#endif
CIR ++ parametrisation.
Cox-Ingersoll-Ross ++ credit model class.
Definition: crcirpp.hpp:48
const QuantLib::ext::shared_ptr< StochasticProcess > stateProcess() const
Definition: crcirpp.hpp:92
Real density(Real x, Real t)
Definition: crcirpp.cpp:142
Real zeroBondOption(Real eval_t, Real expiry_T, Real maturity_tau, Real strike_k, Real y_t, Real w)
Definition: crcirpp.cpp:220
Real A(Real t, Real T) const
Definition: crcirpp.cpp:93
void update() override
Definition: crcirpp.hpp:81
Real densityForwardMeasure(Real x, Real t)
Definition: crcirpp.cpp:176
Real cumulativeForwardMeasure(Real x, Real t)
Definition: crcirpp.cpp:198
void generateArguments() override
Definition: crcirpp.hpp:86
Real zeroBond(Real t, Real T, Real y) const
Definition: crcirpp.cpp:124
Real cumulative(Real x, Real t)
Definition: crcirpp.cpp:159
QuantLib::ext::shared_ptr< CrCirppParametrization > parametrization_
Definition: crcirpp.hpp:77
QuantLib::ext::shared_ptr< CrCirppStateProcess > stateProcess_
Definition: crcirpp.hpp:78
Handle< DefaultProbabilityTermStructure > defaultCurve(std::vector< Date > dateGrid=std::vector< Date >()) const
Definition: crcirpp.cpp:59
Real B(Real t, Real T) const
Definition: crcirpp.cpp:109
Real survivalProbability(Real t, Real T, Real y) const
Definition: crcirpp.cpp:126
const QuantLib::ext::shared_ptr< CrCirppParametrization > parametrization() const
Definition: crcirpp.hpp:88
Calibrated model class with linkable parameters.
CIR++ model state process.
calibrated model class with linkable parameters