The configuration should refer to the calibration configuration here, alternative discounting curves are then usually set in the pricing engines for swaptions etc.
49
51 optimizationMethod_(QuantLib::ext::shared_ptr<OptimizationMethod>(
new LevenbergMarquardt(1E-8, 1E-8, 1E-8))),
53 {
54
58 QuantLib::ext::shared_ptr<IborIndex> index;
61 }
65
68
69 QL_REQUIRE(!
requiresCalibration_,
"HwBuilder: HwModel does not support calibration at the moment.");
70
71
72
75
86 }
89
90 alwaysForwardNotifications();
91
93
95
96 }
97
98 Array sigmaTimes(
data_->sigmaTimes().begin(),
data_->sigmaTimes().end());
99 Array kappaTimes(
data_->kappaTimes().begin(),
data_->kappaTimes().end());
100 std::vector<Matrix> sigma(
data_->sigmaValues().begin(),
data_->sigmaValues().end());
101 std::vector<Array> kappa(
data_->kappaValues().begin(),
data_->kappaValues().end());
102
104 "HwBuilder: only constant sigma is supported at the moment");
106 "HwBuilder: only constant sigma is supported at the moment");
107
109 QL_REQUIRE(
data_->sigmaTimes().size() == 0,
110 "HwBuilder: empty volatility time grid expected for constant parameter type");
111 QL_REQUIRE(
data_->sigmaValues().size() == 1,
112 "HwBuilder: initial volatility values should have size 1 for constant parameter type");
115 if (
data_->sigmaTimes().size() > 0) {
116 DLOG(
"overriding alpha time grid with swaption expiries, set all initial values to first given value");
117 }
120 sigma = std::vector<Matrix>(sigmaTimes.size() + 1,
data_->sigmaValues()[0]);
121 } else {
122 QL_REQUIRE(sigma.size() == sigmaTimes.size() + 1,
123 "HwBBuilder: hw volatility time and initial value array sizes do not match");
124 }
125 } else {
126 QL_FAIL("HwBuilder: volatility parameter type not covered");
127 }
128
130 QL_REQUIRE(
data_->kappaTimes().size() == 0,
131 "HwBuilder: empty reversion time grid expected for constant parameter type");
132 QL_REQUIRE(
data_->kappaValues().size() == 1,
133 "HwBuidler: initial reversion values should have size 1 for constant parameter type");
136 if (
data_->kappaTimes().size() > 0) {
137 DLOG(
"overriding h time grid with swaption underlying maturities, set all initial values to first "
138 "given value");
139 }
141 kappa = std::vector<Array>(kappaTimes.size() + 1,
data_->kappaValues()[0]);
142 } else {
143 QL_REQUIRE(kappa.size() == kappaTimes.size() + 1, "HwBuilder:: hw kappa grids do not match");
144 }
145 } else
146 QL_FAIL("HwBuilder: reversion parameter type case not covered");
147
148 DLOGGERSTREAM(
"before calibration: sigma times = " << sigmaTimes);
149 DLOGGERSTREAM(
"before calibration: kappa times = " << kappaTimes);
150
152 QuantLib::ext::make_shared<QuantExt::IrHwConstantParametrization>(
ccy,
modelDiscountCurve_, sigma[0], kappa[0]);
153
154 DLOG(
"alpha times size: " << sigmaTimes.size());
155 DLOG(
"lambda times size: " << kappaTimes.size());
156
159}
std::vector< bool > swaptionActive_
Handle< SwapIndex > swapIndex_
IrModel::Measure measure_
const std::string configuration_
QuantLib::ext::shared_ptr< QuantExt::MarketObserver > marketObserver_
QuantLib::ext::shared_ptr< QuantExt::HwModel > model_
bool evaluateBankAccount_
Array swaptionMaturities_
HwModel::Discretization discretization_
QuantLib::ext::shared_ptr< HwModelData > data_
Handle< YieldTermStructure > calibrationDiscountCurve_
QuantLib::ext::shared_ptr< OptimizationMethod > optimizationMethod_
QuantLib::ext::shared_ptr< ore::data::Market > market_
Handle< SwapIndex > shortSwapIndex_
const std::string referenceCalibrationGrid_
QuantLib::ext::shared_ptr< QuantExt::IrHwParametrization > parametrization_
bool requiresCalibration_
Handle< QuantLib::SwaptionVolatilityStructure > svts_
RelinkableHandle< YieldTermStructure > modelDiscountCurve_
bool tryParseIborIndex(const string &s, QuantLib::ext::shared_ptr< IborIndex > &index)
Try to convert std::string to QuantLib::IborIndex.
Currency parseCurrency(const string &s)
Convert text to QuantLib::Currency.
#define LOG(text)
Logging Macro (Level = Notice)
#define DLOG(text)
Logging Macro (Level = Debug)
#define DLOGGERSTREAM(text)