Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
crcirbuilder.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2018 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 ored/model/crcirbuilder.hpp
20 \brief Build an cir model
21 \ingroup models
22*/
23
24#pragma once
25
26#include <map>
27#include <ostream>
28#include <vector>
29
32
34
35namespace ore {
36namespace data {
37using namespace QuantLib;
38
39//! Builder for a cir model component
41public:
42 CrCirBuilder(const QuantLib::ext::shared_ptr<ore::data::Market>& market, const QuantLib::ext::shared_ptr<CrCirData>& data,
43 const std::string& configuration = Market::defaultConfiguration);
44
45 Real error() const;
46 QuantLib::ext::shared_ptr<QuantExt::CrCirpp> model() const;
47 QuantLib::ext::shared_ptr<QuantExt::CrCirppParametrization> parametrization() const;
48
49 bool requiresRecalibration() const override { return false; }
50
51private:
52 void performCalculations() const override {}
53 void buildBasket() const;
54
55 QuantLib::ext::shared_ptr<ore::data::Market> market_;
56 const std::string configuration_;
57 QuantLib::ext::shared_ptr<CrCirData> data_;
58
59 Handle<YieldTermStructure> rateCurve_;
60 Handle<DefaultProbabilityTermStructure> creditCurve_;
61 Handle<Quote> recoveryRate_;
62
63 mutable Real error_;
64 QuantLib::ext::shared_ptr<QuantExt::CrCirpp> model_;
65 QuantLib::ext::shared_ptr<QuantExt::CrCirppParametrization> parametrization_;
66
67 // TODO: Move CalibrationErrorType, optimizer and end criteria parameters to data
68 QuantLib::ext::shared_ptr<OptimizationMethod> optimizationMethod_;
69 EndCriteria endCriteria_;
70 BlackCalibrationHelper::CalibrationErrorType calibrationErrorType_;
71};
72
73// implementation
74
75inline Real CrCirBuilder::error() const {
76 calculate();
77 return error_;
78}
79
80inline QuantLib::ext::shared_ptr<QuantExt::CrCirpp> CrCirBuilder::model() const {
81 calculate();
82 return model_;
83}
84
85inline QuantLib::ext::shared_ptr<QuantExt::CrCirppParametrization> CrCirBuilder::parametrization() const {
86 return parametrization_;
87}
88
89} // namespace data
90} // namespace ore
Builder for a cir model component.
const std::string configuration_
BlackCalibrationHelper::CalibrationErrorType calibrationErrorType_
void performCalculations() const override
QuantLib::ext::shared_ptr< QuantExt::CrCirpp > model() const
QuantLib::ext::shared_ptr< QuantExt::CrCirppParametrization > parametrization() const
QuantLib::ext::shared_ptr< QuantExt::CrCirpp > model_
Handle< DefaultProbabilityTermStructure > creditCurve_
bool requiresRecalibration() const override
Handle< YieldTermStructure > rateCurve_
QuantLib::ext::shared_ptr< OptimizationMethod > optimizationMethod_
QuantLib::ext::shared_ptr< ore::data::Market > market_
QuantLib::ext::shared_ptr< QuantExt::CrCirppParametrization > parametrization_
QuantLib::ext::shared_ptr< CrCirData > data_
void buildBasket() const
Handle< Quote > recoveryRate_
static const string defaultConfiguration
Default configuration label.
Definition: market.hpp:296
CIR credit model data.
@ data
Definition: log.hpp:77
Serializable Credit Default Swap.
Definition: namespaces.docs:23