Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
infjydata.cpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2020 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
22
23using QuantLib::Real;
24using QuantLib::Size;
25using std::vector;
26
27namespace ore {
28namespace data {
29
31
32InfJyData::InfJyData(CalibrationType calibrationType, const vector<CalibrationBasket>& calibrationBaskets,
33 const std::string& currency, const std::string& index, const ReversionParameter& realRateReversion,
34 const VolatilityParameter& realRateVolatility, const VolatilityParameter& indexVolatility,
35 const LgmReversionTransformation& reversionTransformation,
36 const CalibrationConfiguration& calibrationConfiguration,
37 const bool ignoreDuplicateCalibrationExpiryTimes, const bool linkRealToNominalRateParams,
38 const Real linkedRealRateVolatilityScaling)
39 : InflationModelData(calibrationType, calibrationBaskets, currency, index, ignoreDuplicateCalibrationExpiryTimes),
40 realRateReversion_(realRateReversion), realRateVolatility_(realRateVolatility), indexVolatility_(indexVolatility),
41 reversionTransformation_(reversionTransformation), calibrationConfiguration_(calibrationConfiguration),
42 linkRealToNominalRateParams_(linkRealToNominalRateParams),
43 linkedRealRateVolatilityScaling_(linkedRealRateVolatilityScaling) {}
44
46 return realRateReversion_;
47}
48
51}
52
54 return indexVolatility_;
55}
56
59}
60
63}
64
66
68
70
72
74
75 // Check the node is not null and that name is LGM or DodgsonKainth. LGM is for backward compatibility.
76 XMLUtils::checkNode(node, "JarrowYildirim");
77
79
80 // Get reversion and volatility for the real rate process
81 XMLNode* rrNode = XMLUtils::getChildNode(node, "RealRate");
82 QL_REQUIRE(rrNode, "JarrowYildirim inflation model data should have RealRate node.");
85 if (XMLNode* n = XMLUtils::getChildNode(rrNode, "ParameterTransformation")) {
87 }
88
89 // Get volatility for the inflation index process
90 XMLNode* idxNode = XMLUtils::getChildNode(node, "Index");
91 QL_REQUIRE(idxNode, "JarrowYildirim inflation model data should have Index node.");
92 indexVolatility_.fromXML(XMLUtils::getChildNode(idxNode, "Volatility"));
93
94 // Get the calibration configuration
95 if (XMLNode* ccNode = XMLUtils::getChildNode(node, "CalibrationConfiguration"))
97
98 // Get the link to nominal param fields
100 parseBool(XMLUtils::getChildValue(node, "LinkRealToNominalRateParams", false, "false"));
103 parseReal(XMLUtils::getChildValue(node, "LinkedRealRateVolatilityScaling", false, "1.0"));
104 }
105}
106
108
109 XMLNode* node = doc.allocNode("JarrowYildirim");
111
112 XMLNode* rrNode = doc.allocNode("RealRate");
116 XMLUtils::appendNode(node, rrNode);
117
118 XMLNode* idxNode = doc.allocNode("Index");
120 XMLUtils::appendNode(node, idxNode);
121
123
125 XMLUtils::addChild(doc, node, "LinkRealToNominalRateParams", linkRealToNominalRateParams_);
126 XMLUtils::addChild(doc, node, "LinkedRealRateVolatilityScaling", linkedRealRateVolatilityScaling_);
127 }
128
129 return node;
130}
131
132}
133}
XMLNode * toXML(XMLDocument &doc) const override
LgmReversionTransformation reversionTransformation_
Definition: infjydata.hpp:88
const VolatilityParameter & indexVolatility() const
Definition: infjydata.cpp:53
bool linkRealRateParamsToNominalRateParams() const
Definition: infjydata.cpp:69
VolatilityParameter indexVolatility_
Definition: infjydata.hpp:87
void setRealRateReversion(ReversionParameter p)
Definition: infjydata.cpp:65
const VolatilityParameter & realRateVolatility() const
Definition: infjydata.cpp:49
const CalibrationConfiguration & calibrationConfiguration() const
Definition: infjydata.cpp:61
void fromXML(XMLNode *node) override
Definition: infjydata.cpp:73
XMLNode * toXML(XMLDocument &doc) const override
Definition: infjydata.cpp:107
InfJyData()
Default constructor.
Definition: infjydata.cpp:30
CalibrationConfiguration calibrationConfiguration_
Definition: infjydata.hpp:89
VolatilityParameter realRateVolatility_
Definition: infjydata.hpp:86
Real linkedRealRateVolatilityScaling_
Definition: infjydata.hpp:91
Real linkedRealRateVolatilityScaling() const
Definition: infjydata.cpp:71
const ReversionParameter & realRateReversion() const
Definition: infjydata.cpp:45
bool linkRealToNominalRateParams_
Definition: infjydata.hpp:90
const LgmReversionTransformation & reversionTransformation() const
Definition: infjydata.cpp:57
ReversionParameter realRateReversion_
Definition: infjydata.hpp:85
void setRealRateVolatility(VolatilityParameter p)
Definition: infjydata.cpp:67
void append(XMLDocument &doc, XMLNode *node) const override
Method used by toXML in derived classes to add the members here to a node.
void fromXML(XMLNode *node) override
void fromXML(XMLNode *node) override
Definition: lgmdata.cpp:260
XMLNode * toXML(XMLDocument &doc) const override
Definition: lgmdata.cpp:266
void fromXML(XMLNode *node) override
XMLNode * toXML(XMLDocument &doc) const override
void fromXML(XMLNode *node) override
XMLNode * toXML(XMLDocument &doc) const override
Small XML Document wrapper class.
Definition: xmlutils.hpp:65
XMLNode * allocNode(const string &nodeName)
util functions that wrap rapidxml
Definition: xmlutils.cpp:132
static void checkNode(XMLNode *n, const string &expectedName)
Definition: xmlutils.cpp:175
static string getChildValue(XMLNode *node, const string &name, bool mandatory=false, const string &defaultValue=string())
Definition: xmlutils.cpp:277
static XMLNode * getChildNode(XMLNode *n, const string &name="")
Definition: xmlutils.cpp:387
static XMLNode * addChild(XMLDocument &doc, XMLNode *n, const string &name)
Definition: xmlutils.cpp:181
static void appendNode(XMLNode *parent, XMLNode *child)
Definition: xmlutils.cpp:406
bool parseBool(const string &s)
Convert text to bool.
Definition: parsers.cpp:144
Real parseReal(const string &s)
Convert text to Real.
Definition: parsers.cpp:112
Jarrow Yildirim inflation model component data for the cross asset model.
Classes and functions for log message handling.
@ data
Definition: log.hpp:77
CalibrationType
Supported calibration types.
Definition: irmodeldata.hpp:46
Serializable Credit Default Swap.
Definition: namespaces.docs:23
Map text representations to QuantLib/QuantExt types.