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

#include <ored/model/crlgmbuilder.hpp>

+ Inheritance diagram for CrLgmBuilder:
+ Collaboration diagram for CrLgmBuilder:

Public Member Functions

 CrLgmBuilder (const QuantLib::ext::shared_ptr< ore::data::Market > &market, const QuantLib::ext::shared_ptr< CrLgmData > &data, const std::string &configuration=Market::defaultConfiguration)
 
QuantLib::ext::shared_ptr< QuantExt::CrLgm1fParametrizationparametrization () const
 
bool requiresRecalibration () const override
 
void performCalculations () const override
 
- Public Member Functions inherited from ModelBuilder
void recalibrate () const
 
virtual void forceRecalculate ()
 
virtual bool requiresRecalibration () const=0
 

Private Attributes

QuantLib::ext::shared_ptr< ore::data::Marketmarket_
 
const std::string configuration_
 
QuantLib::ext::shared_ptr< CrLgmDatadata_
 
QuantLib::ext::shared_ptr< QuantExt::CrLgm1fParametrizationparametrization_
 
RelinkableHandle< DefaultProbabilityTermStructure > modelDefaultCurve_
 

Detailed Description

Definition at line 35 of file crlgmbuilder.hpp.

Constructor & Destructor Documentation

◆ CrLgmBuilder()

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

the configuration should refer to the calibration configuration here, alternative discounting curves are then usually set in the pricing engines for swaptions etc.

this builder should be replaced by the OREData standard builder for cr lgm

Definition at line 34 of file crlgmbuilder.cpp.

36 : market_(market), configuration_(configuration), data_(data) {
37
38 string name = data->name();
39 LOG("LgmCalibration for name " << name << ", configuration is " << configuration);
40
41 modelDefaultCurve_ = RelinkableHandle<DefaultProbabilityTermStructure>(*market_->defaultCurve(name, configuration)->curve());
42
43 QL_REQUIRE(!data_->calibrateA() && !data_->calibrateH(), "CrLgmBuilder does not support calibration currently");
44
45 QL_REQUIRE(data_->aParamType() == ParamType::Constant, "CrLgmBuilder only supports constant volatility currently");
46 QL_REQUIRE(data_->hParamType() == ParamType::Constant, "CrLgmBuilder only supports constant reversion currently");
47
48 Array aTimes(data_->aTimes().begin(), data_->aTimes().end());
49 Array hTimes(data_->hTimes().begin(), data_->hTimes().end());
50 Array alpha(data_->aValues().begin(), data_->aValues().end());
51 Array h(data_->hValues().begin(), data_->hValues().end());
52
53 // the currency does not matter here
55 QuantLib::ext::make_shared<QuantExt::CrLgm1fConstantParametrization>(USDCurrency(), modelDefaultCurve_, alpha[0], h[0], name);
56
57 LOG("Apply shift horizon and scale");
58
59 QL_REQUIRE(data_->shiftHorizon() >= 0.0, "shift horizon must be non negative");
60 QL_REQUIRE(data_->scaling() > 0.0, "scaling must be positive");
61
62 if (data_->shiftHorizon() > 0.0) {
63 LOG("Apply shift horizon " << data_->shiftHorizon() << " to the " << data_->qualifier() << " CR-LGM model");
64 parametrization_->shift() = data_->shiftHorizon();
65 }
66
67 if (data_->scaling() != 1.0) {
68 LOG("Apply scaling " << data_->scaling() << " to the " << data_->qualifier() << " CR-LGM model");
69 parametrization_->scaling() = data_->scaling();
70 }
71}
RelinkableHandle< DefaultProbabilityTermStructure > modelDefaultCurve_
const std::string configuration_
QuantLib::ext::shared_ptr< ore::data::Market > market_
QuantLib::ext::shared_ptr< CrLgmData > data_
QuantLib::ext::shared_ptr< QuantExt::CrLgm1fParametrization > parametrization_
@ data
Definition: log.hpp:77
#define LOG(text)
Logging Macro (Level = Notice)
Definition: log.hpp:552
string name

Member Function Documentation

◆ parametrization()

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

Definition at line 43 of file crlgmbuilder.hpp.

43{ return parametrization_; }

◆ requiresRecalibration()

bool requiresRecalibration ( ) const
overridevirtual

Implements ModelBuilder.

Definition at line 45 of file crlgmbuilder.hpp.

45{ return false; }

◆ performCalculations()

void performCalculations ( ) const
override

Definition at line 46 of file crlgmbuilder.hpp.

46{}

Member Data Documentation

◆ market_

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

Definition at line 50 of file crlgmbuilder.hpp.

◆ configuration_

const std::string configuration_
private

Definition at line 51 of file crlgmbuilder.hpp.

◆ data_

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

Definition at line 52 of file crlgmbuilder.hpp.

◆ parametrization_

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

Definition at line 53 of file crlgmbuilder.hpp.

◆ modelDefaultCurve_

RelinkableHandle<DefaultProbabilityTermStructure> modelDefaultCurve_
private

Definition at line 54 of file crlgmbuilder.hpp.