Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
CrCirBuilder Class Reference

Builder for a cir model component. More...

#include <ored/model/crcirbuilder.hpp>

+ Inheritance diagram for CrCirBuilder:
+ Collaboration diagram for CrCirBuilder:

Public Member Functions

 CrCirBuilder (const QuantLib::ext::shared_ptr< ore::data::Market > &market, const QuantLib::ext::shared_ptr< CrCirData > &data, const std::string &configuration=Market::defaultConfiguration)
 
Real error () const
 
QuantLib::ext::shared_ptr< QuantExt::CrCirppmodel () const
 
QuantLib::ext::shared_ptr< QuantExt::CrCirppParametrizationparametrization () const
 
bool requiresRecalibration () const override
 
- Public Member Functions inherited from ModelBuilder
void recalibrate () const
 
virtual void forceRecalculate ()
 
virtual bool requiresRecalibration () const=0
 

Private Member Functions

void performCalculations () const override
 
void buildBasket () const
 

Private Attributes

QuantLib::ext::shared_ptr< ore::data::Marketmarket_
 
const std::string configuration_
 
QuantLib::ext::shared_ptr< CrCirDatadata_
 
Handle< YieldTermStructure > rateCurve_
 
Handle< DefaultProbabilityTermStructure > creditCurve_
 
Handle< Quote > recoveryRate_
 
Real error_
 
QuantLib::ext::shared_ptr< QuantExt::CrCirppmodel_
 
QuantLib::ext::shared_ptr< QuantExt::CrCirppParametrizationparametrization_
 
QuantLib::ext::shared_ptr< OptimizationMethodoptimizationMethod_
 
EndCriteria endCriteria_
 
BlackCalibrationHelper::CalibrationErrorType calibrationErrorType_
 

Detailed Description

Builder for a cir model component.

Definition at line 40 of file crcirbuilder.hpp.

Constructor & Destructor Documentation

◆ CrCirBuilder()

CrCirBuilder ( const QuantLib::ext::shared_ptr< ore::data::Market > &  market,
const QuantLib::ext::shared_ptr< CrCirData > &  data,
const std::string &  configuration = Market::defaultConfiguration 
)

Definition at line 41 of file crcirbuilder.cpp.

43 : market_(market), configuration_(configuration), data_(data),
44 optimizationMethod_(QuantLib::ext::shared_ptr<OptimizationMethod>(new LevenbergMarquardt(1E-8, 1E-8, 1E-8))),
45 endCriteria_(EndCriteria(1000, 500, 1E-8, 1E-8, 1E-8)),
46 calibrationErrorType_(BlackCalibrationHelper::RelativePriceError) {
47
48 LOG("CIR CR Calibration for name " << data_->name());
49
50 rateCurve_ = market->discountCurve(data_->currency(), configuration);
51 creditCurve_ = market->defaultCurve(data_->name(), configuration)->curve();
52 recoveryRate_ = market->recoveryRate(data_->name(), configuration);
53
54 registerWith(rateCurve_);
55 registerWith(creditCurve_);
56 registerWith(recoveryRate_);
57
58 // shifted CIR model hard coded here
59 parametrization_ = QuantLib::ext::make_shared<QuantExt::CrCirppConstantWithFellerParametrization>(
60 parseCurrency(data_->currency()), creditCurve_, data_->reversionValue(), data_->longTermValue(),
61 data_->volatility(), data_->startValue(), true, data_->relaxedFeller(), data_->fellerFactor(),
62 data_->name());
63
64 // alternatively, use unconstrained parametrization (only positivity of all parameters is implied)
65 // parametrization_ = QuantLib::ext::make_shared<QuantExt::CrCirppConstantParametrization>(
66 // parseCurrency(data_->currency()), creditCurve_, data_->reversionValue(), data_->longTermValue(),
67 // data_->volatility(), data_->startValue(), false);
68
69 model_ = QuantLib::ext::make_shared<QuantExt::CrCirpp>(parametrization_);
70}
const std::string configuration_
BlackCalibrationHelper::CalibrationErrorType calibrationErrorType_
QuantLib::ext::shared_ptr< QuantExt::CrCirpp > model_
Handle< DefaultProbabilityTermStructure > creditCurve_
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_
Handle< Quote > recoveryRate_
Currency parseCurrency(const string &s)
Convert text to QuantLib::Currency.
Definition: parsers.cpp:290
#define LOG(text)
Logging Macro (Level = Notice)
Definition: log.hpp:552
+ Here is the call graph for this function:

Member Function Documentation

◆ error()

Real error ( ) const

Definition at line 75 of file crcirbuilder.hpp.

75 {
76 calculate();
77 return error_;
78}

◆ model()

QuantLib::ext::shared_ptr< QuantExt::CrCirpp > model ( ) const

Definition at line 80 of file crcirbuilder.hpp.

80 {
81 calculate();
82 return model_;
83}

◆ parametrization()

QuantLib::ext::shared_ptr< QuantExt::CrCirppParametrization > parametrization ( ) const

Definition at line 85 of file crcirbuilder.hpp.

85 {
86 return parametrization_;
87}

◆ requiresRecalibration()

bool requiresRecalibration ( ) const
overridevirtual

Implements ModelBuilder.

Definition at line 49 of file crcirbuilder.hpp.

49{ return false; }

◆ performCalculations()

void performCalculations ( ) const
overrideprivate

Definition at line 52 of file crcirbuilder.hpp.

52{}

◆ buildBasket()

void buildBasket ( ) const
private

Member Data Documentation

◆ market_

QuantLib::ext::shared_ptr<ore::data::Market> market_
private

Definition at line 55 of file crcirbuilder.hpp.

◆ configuration_

const std::string configuration_
private

Definition at line 56 of file crcirbuilder.hpp.

◆ data_

QuantLib::ext::shared_ptr<CrCirData> data_
private

Definition at line 57 of file crcirbuilder.hpp.

◆ rateCurve_

Handle<YieldTermStructure> rateCurve_
private

Definition at line 59 of file crcirbuilder.hpp.

◆ creditCurve_

Handle<DefaultProbabilityTermStructure> creditCurve_
private

Definition at line 60 of file crcirbuilder.hpp.

◆ recoveryRate_

Handle<Quote> recoveryRate_
private

Definition at line 61 of file crcirbuilder.hpp.

◆ error_

Real error_
mutableprivate

Definition at line 63 of file crcirbuilder.hpp.

◆ model_

QuantLib::ext::shared_ptr<QuantExt::CrCirpp> model_
private

Definition at line 64 of file crcirbuilder.hpp.

◆ parametrization_

QuantLib::ext::shared_ptr<QuantExt::CrCirppParametrization> parametrization_
private

Definition at line 65 of file crcirbuilder.hpp.

◆ optimizationMethod_

QuantLib::ext::shared_ptr<OptimizationMethod> optimizationMethod_
private

Definition at line 68 of file crcirbuilder.hpp.

◆ endCriteria_

EndCriteria endCriteria_
private

Definition at line 69 of file crcirbuilder.hpp.

◆ calibrationErrorType_

BlackCalibrationHelper::CalibrationErrorType calibrationErrorType_
private

Definition at line 70 of file crcirbuilder.hpp.