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

#include <ored/configuration/volatilityconfig.hpp>

+ Inheritance diagram for QuoteBasedVolatilityConfig:
+ Collaboration diagram for QuoteBasedVolatilityConfig:

Public Member Functions

 QuoteBasedVolatilityConfig (MarketDatum::QuoteType quoteType=MarketDatum::QuoteType::RATE_LNVOL, QuantLib::Exercise::Type exerciseType=QuantLib::Exercise::Type::European, std::string calendarStr=std::string(), QuantLib::Natural priority=0)
 Default constructor. More...
 
Inspectors
const MarketDatum::QuoteTypequoteType () const
 
const QuantLib::Exercise::Type & exerciseType () const
 
- Public Member Functions inherited from VolatilityConfig
 VolatilityConfig (std::string calendarStr=std::string(), QuantLib::Natural priority=0)
 
void fromXMLNode (ore::data::XMLNode *node)
 
void toXMLNode (XMLDocument &doc, XMLNode *node) const
 
QuantLib::Natural priority () const
 
Calendar calendar () const
 
- Public Member Functions inherited from XMLSerializable
virtual ~XMLSerializable ()
 
virtual void fromXML (XMLNode *node)=0
 
virtual XMLNodetoXML (XMLDocument &doc) const =0
 
void fromFile (const std::string &filename)
 
void toFile (const std::string &filename) const
 
void fromXMLString (const std::string &xml)
 Parse from XML string. More...
 
std::string toXMLString () const
 Parse from XML string. More...
 

Serialisation

MarketDatum::QuoteType quoteType_
 
QuantLib::Exercise::Type exerciseType_
 
void fromBaseNode (ore::data::XMLNode *node)
 
void toBaseNode (ore::data::XMLDocument &doc, ore::data::XMLNode *node) const
 

Detailed Description

Definition at line 104 of file volatilityconfig.hpp.

Constructor & Destructor Documentation

◆ QuoteBasedVolatilityConfig()

QuoteBasedVolatilityConfig ( MarketDatum::QuoteType  quoteType = MarketDatum::QuoteType::RATE_LNVOL,
QuantLib::Exercise::Type  exerciseType = QuantLib::Exercise::Type::European,
std::string  calendarStr = std::string(),
QuantLib::Natural  priority = 0 
)

Default constructor.

Definition at line 107 of file volatilityconfig.hpp.

const MarketDatum::QuoteType & quoteType() const
const QuantLib::Exercise::Type & exerciseType() const
QuantLib::Natural priority() const
VolatilityConfig(std::string calendarStr=std::string(), QuantLib::Natural priority=0)

Member Function Documentation

◆ quoteType()

const MarketDatum::QuoteType & quoteType ( ) const

Definition at line 114 of file volatilityconfig.hpp.

114{ return quoteType_; }
+ Here is the caller graph for this function:

◆ exerciseType()

const QuantLib::Exercise::Type & exerciseType ( ) const

Definition at line 115 of file volatilityconfig.hpp.

115{ return exerciseType_; }

◆ fromBaseNode()

void fromBaseNode ( ore::data::XMLNode node)

Definition at line 100 of file volatilityconfig.cpp.

100 {
102 string qType = XMLUtils::getChildValue(node, "QuoteType", false);
103 if (qType == "ImpliedVolatility" || qType == "") {
104 string volType = XMLUtils::getChildValue(node, "VolatilityType", false);
105 if (volType == "Lognormal" || qType == "") {
107 } else if (volType == "ShiftedLognormal") {
109 } else if (volType == "Normal") {
111 } else {
112 QL_FAIL("Volatility type " << volType << " is not supported;");
113 }
114 } else if (qType == "Premium") {
116 // If we have premiums the exercise type is required
117 exerciseType_ = parseExerciseType(XMLUtils::getChildValue(node, "ExerciseType", true));
118 } else {
119 QL_FAIL("Invalid quote type for volatility curve , quote type must be ImpliedVolatility or Premium");
120 }
121}
void fromXMLNode(ore::data::XMLNode *node)
static string getChildValue(XMLNode *node, const string &name, bool mandatory=false, const string &defaultValue=string())
Definition: xmlutils.cpp:277
Exercise::Type parseExerciseType(const std::string &s)
Convert text to QuantLib::Exercise::Type.
Definition: parsers.cpp:466
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ toBaseNode()

void toBaseNode ( ore::data::XMLDocument doc,
ore::data::XMLNode node 
) const

Definition at line 123 of file volatilityconfig.cpp.

123 {
125
126 // Check first for premium
128 XMLUtils::addChild(doc, node, "QuoteType", "Premium");
129 XMLUtils::addChild(doc, node, "ExerciseType", ore::data::to_string(exerciseType_));
130 return;
131 }
132
133 // Must be a volatility (or possibly fail)
134 XMLUtils::addChild(doc, node, "QuoteType", "ImpliedVolatility");
136 XMLUtils::addChild(doc, node, "VolatilityType", "Lognormal");
138 XMLUtils::addChild(doc, node, "VolatilityType", "ShiftedLognormal");
140 XMLUtils::addChild(doc, node, "VolatilityType", "Normal");
141 } else {
142 QL_FAIL("Invalid quote type");
143 }
144}
void toXMLNode(XMLDocument &doc, XMLNode *node) const
static XMLNode * addChild(XMLDocument &doc, XMLNode *n, const string &name)
Definition: xmlutils.cpp:181
std::string to_string(const LocationInfo &l)
Definition: ast.cpp:28
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ quoteType_

MarketDatum::QuoteType quoteType_
private

Definition at line 125 of file volatilityconfig.hpp.

◆ exerciseType_

QuantLib::Exercise::Type exerciseType_
private

Definition at line 126 of file volatilityconfig.hpp.