36#include <ql/math/optimization/levenbergmarquardt.hpp>
37#include <ql/models/shortrate/calibrationhelpers/swaptionhelper.hpp>
38#include <ql/quotes/simplequote.hpp>
39#include <ql/utilities/dataformatters.hpp>
41#include <boost/algorithm/string/case_conv.hpp>
42#include <boost/lexical_cast.hpp>
63 if (boost::algorithm::to_upper_copy(s) ==
"HULLWHITE")
65 else if (boost::algorithm::to_upper_copy(s) ==
"HAGAN")
68 QL_FAIL(
"Reversion type " << s <<
" not recognized");
77 QL_FAIL(
"Reversion type not covered");
82 if (boost::algorithm::to_upper_copy(s) ==
"HULLWHITE")
84 else if (boost::algorithm::to_upper_copy(s) ==
"HAGAN")
87 QL_FAIL(
"Volatility type " << s <<
" not recognized");
96 QL_FAIL(
"Volatility type not covered");
101 if (boost::algorithm::to_upper_copy(s) ==
"NEXTCOUPON")
103 else if (boost::algorithm::to_upper_copy(s) ==
"PRORATA")
105 else if (boost::algorithm::to_upper_copy(s) ==
"SIMPLE")
106 return QuantExt::AnalyticLgmSwaptionEngine::simple;
108 QL_FAIL(
"FloatSpreadMapping '" << s <<
"' not recognized");
116 else if (m == QuantExt::AnalyticLgmSwaptionEngine::simple)
119 QL_FAIL(
"FloatSpreadMapping type not covered");
153 LOG(
"LGM Volatility type = " << volTypeString);
157 LOG(
"LGM Volatility param type = " << alphaTypeString);
160 LOG(
"LGM Volatility time grid size = " <<
aTimes_.size());
163 LOG(
"LGM Volatility initial values size = " <<
aValues_.size());
174 LOG(
"LGM Reversion type = " << revTypeString);
178 LOG(
"LGM Reversion parameter type = " << hTypeString);
181 LOG(
"LGM Reversion time grid size = " <<
hTimes_.size());
184 LOG(
"LGM Reversion initial values size = " <<
hValues_.size());
254 : horizon_(horizon), scaling_(scaling) {}
CalibrationType calibrationType_
virtual void fromXML(XMLNode *node) override
virtual XMLNode * toXML(XMLDocument &doc) const override
virtual void reset()
Reset member variables to defaults.
Linear Gauss Markov Model Parameters.
VolatilityParameter volatilityParameter() const
bool operator!=(const LgmData &rhs)
std::vector< std::string > optionTerms_
ReversionParameter reversionParameter() const
QuantExt::AnalyticLgmSwaptionEngine::FloatSpreadMapping floatSpreadMapping_
std::vector< std::string > optionExpiries_
std::vector< Time > hTimes_
std::vector< Time > aTimes_
virtual void fromXML(XMLNode *node) override
virtual XMLNode * toXML(XMLDocument &doc) const override
ReversionType
Supported mean reversion types.
@ Hagan
Parametrize LGM H(t) as H(t) = int_0^t h(s) ds with constant or piecewise h(s)
VolatilityType
Supported volatility types.
@ HullWhite
Parametrize volatility as HullWhite sigma(t)
@ Hagan
Parametrize volatility as Hagan alpha(t)
std::vector< Real > aValues_
bool operator==(const LgmData &rhs)
std::vector< Real > hValues_
void reset() override
Reset member variables to defaults.
void clear() override
Clear list of calibration instruments.
std::vector< std::string > optionStrikes_
Small XML Document wrapper class.
XMLNode * allocNode(const string &nodeName)
util functions that wrap rapidxml
static void addGenericChildAsList(XMLDocument &doc, XMLNode *n, const string &name, const vector< T > &values, const string &attrName="", const string &attr="")
static void checkNode(XMLNode *n, const string &expectedName)
static void addGenericChild(XMLDocument &doc, XMLNode *n, const char *name, const T &value)
Adds <Name>p1,p2,p3</Name>
static Real getChildValueAsDouble(XMLNode *node, const string &name, bool mandatory=false, double defaultValue=0.0)
static string getChildValue(XMLNode *node, const string &name, bool mandatory=false, const string &defaultValue=string())
static bool getChildValueAsBool(XMLNode *node, const string &name, bool mandatory=false, bool defaultValue=true)
static XMLNode * getChildNode(XMLNode *n, const string &name="")
static vector< Real > getChildrenValuesAsDoublesCompact(XMLNode *node, const string &name, bool mandatory=false)
static XMLNode * addChild(XMLDocument &doc, XMLNode *n, const string &name)
static void appendNode(XMLNode *parent, XMLNode *child)
configuration class for building correlation matrices
Linear Gauss Markov model data.
Classes and functions for log message handling.
#define LOG(text)
Logging Macro (Level = Notice)
class for holding model parameter data
std::ostream & operator<<(std::ostream &out, EquityReturnType t)
ParamType parseParamType(const string &s)
Convert parameter type string into enumerated class value.
std::string to_string(const LocationInfo &l)
LgmData::ReversionType parseReversionType(const string &s)
Enum parsers.
QuantExt::AnalyticLgmSwaptionEngine::FloatSpreadMapping parseFloatSpreadMapping(const string &s)
LgmData::VolatilityType parseVolatilityType(const string &s)
Serializable Credit Default Swap.
Map text representations to QuantLib/QuantExt types.
string conversion utilities