Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
hwmodel.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2022 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 hwmodel.hpp
20 \brief hull white n Factor model class
21 \ingroup models
22*/
23
24#pragma once
25
28
29#include <ql/math/comparison.hpp>
30
31namespace QuantExt {
32
33class HwModel : public IrModel {
34public:
35 enum class Discretization { Euler, Exact };
36
37 HwModel(const QuantLib::ext::shared_ptr<IrHwParametrization>& parametrization, const Measure measure = Measure::BA,
38 const Discretization discretization = Discretization::Euler, const bool evaluateBankAccount = true);
39
40 // IrModel interface
41
42 Measure measure() const override { return measure_; }
43
44 const QuantLib::ext::shared_ptr<Parametrization> parametrizationBase() const override { return parametrization_; }
45
46 Handle<YieldTermStructure> termStructure() const override { return parametrization_->termStructure(); }
47
48 Size n() const override;
49 Size m() const override;
50 Size n_aux() const override;
51 Size m_aux() const override;
52
53 QuantLib::ext::shared_ptr<StochasticProcess> stateProcess() const override { return stateProcess_; }
54
55 QuantLib::Real discountBond(const QuantLib::Time t, const QuantLib::Time T, const QuantLib::Array& x,
56 const QuantLib::Handle<QuantLib::YieldTermStructure>& discountCurve =
57 Handle<YieldTermStructure>()) const override;
58
59 QuantLib::Real
60 numeraire(const QuantLib::Time t, const QuantLib::Array& x,
61 const QuantLib::Handle<QuantLib::YieldTermStructure>& discountCurve = Handle<YieldTermStructure>(),
62 const QuantLib::Array& aux = Array()) const override;
63
64 QuantLib::Real shortRate(const QuantLib::Time t, const QuantLib::Array& x,
65 const QuantLib::Handle<QuantLib::YieldTermStructure>& discountCurve =
66 Handle<YieldTermStructure>()) const override;
67
68 // HwModel specific methods
69
70 const QuantLib::ext::shared_ptr<IrHwParametrization> parametrization() const { return parametrization_; }
71
72 /*! observer and linked calibrated model interface */
73 void update() override;
74 void generateArguments() override;
75
76private:
77 QuantLib::ext::shared_ptr<IrHwParametrization> parametrization_;
80 QuantLib::ext::shared_ptr<StochasticProcess> stateProcess_;
82};
83
84} // namespace QuantExt
Measure measure_
Definition: hwmodel.hpp:78
Size m() const override
Definition: hwmodel.cpp:70
const QuantLib::ext::shared_ptr< IrHwParametrization > parametrization() const
Definition: hwmodel.hpp:70
const QuantLib::ext::shared_ptr< Parametrization > parametrizationBase() const override
Definition: hwmodel.hpp:44
QuantLib::ext::shared_ptr< StochasticProcess > stateProcess() const override
Definition: hwmodel.hpp:53
Size n() const override
Definition: hwmodel.cpp:69
Size n_aux() const override
Definition: hwmodel.cpp:71
bool evaluateBankAccount_
Definition: hwmodel.hpp:81
void update() override
Definition: hwmodel.cpp:62
QuantLib::ext::shared_ptr< StochasticProcess > stateProcess_
Definition: hwmodel.hpp:80
Measure measure() const override
Definition: hwmodel.hpp:42
QuantLib::Real discountBond(const QuantLib::Time t, const QuantLib::Time T, const QuantLib::Array &x, const QuantLib::Handle< QuantLib::YieldTermStructure > &discountCurve=Handle< YieldTermStructure >()) const override
Definition: hwmodel.cpp:33
void generateArguments() override
Definition: hwmodel.cpp:67
Handle< YieldTermStructure > termStructure() const override
Definition: hwmodel.hpp:46
QuantLib::Real shortRate(const QuantLib::Time t, const QuantLib::Array &x, const QuantLib::Handle< QuantLib::YieldTermStructure > &discountCurve=Handle< YieldTermStructure >()) const override
Definition: hwmodel.cpp:55
Discretization discretization_
Definition: hwmodel.hpp:79
Size m_aux() const override
Definition: hwmodel.cpp:72
QuantLib::ext::shared_ptr< IrHwParametrization > parametrization_
Definition: hwmodel.hpp:77
QuantLib::Real numeraire(const QuantLib::Time t, const QuantLib::Array &x, const QuantLib::Handle< QuantLib::YieldTermStructure > &discountCurve=Handle< YieldTermStructure >(), const QuantLib::Array &aux=Array()) const override
Definition: hwmodel.cpp:47
Hull White n factor parametrization.
ir model base class