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

#include <ored/configuration/conventions.hpp>

+ Inheritance diagram for BondYieldConvention:
+ Collaboration diagram for BondYieldConvention:

Public Member Functions

 BondYieldConvention ()
 Constructor. More...
 
 BondYieldConvention (const std::string &id, const std::string &compoundingName, const std::string &frequencyName, const std::string &priceTypeName, Real accuracy, Size maxEvaluations, Real guess)
 Detailed constructor. More...
 
std::string compoundingName () const
 
Compounding compounding () const
 
std::string frequencyName () const
 
Frequency frequency () const
 
QuantLib::Bond::Price::Type priceType () const
 
std::string priceTypeName () const
 
QuantLib::Real accuracy () const
 
QuantLib::Size maxEvaluations () const
 
QuantLib::Real guess () const
 
void fromXML (XMLNode *node) override
 
XMLNodetoXML (XMLDocument &doc) const override
 
void build () override
 
- Public Member Functions inherited from Convention
virtual ~Convention ()
 Default destructor. More...
 
const string & id () const
 
Type type () 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...
 

Private Attributes

Compounding compounding_
 
std::string compoundingName_
 
Frequency frequency_
 
std::string frequencyName_
 
QuantLib::Bond::Price::Type priceType_
 
std::string priceTypeName_
 
QuantLib::Real accuracy_
 
QuantLib::Size maxEvaluations_
 
QuantLib::Real guess_
 

Additional Inherited Members

- Public Types inherited from Convention
enum class  Type {
  Zero , Deposit , Future , FRA ,
  OIS , Swap , AverageOIS , TenorBasisSwap ,
  TenorBasisTwoSwap , BMABasisSwap , FX , CrossCcyBasis ,
  CrossCcyFixFloat , CDS , IborIndex , OvernightIndex ,
  SwapIndex , ZeroInflationIndex , InflationSwap , SecuritySpread ,
  CMSSpreadOption , CommodityForward , CommodityFuture , FxOption ,
  BondYield
}
 Supported convention types. More...
 
- Protected Member Functions inherited from Convention
 Convention ()
 
 Convention (const string &id, Type type)
 
- Protected Attributes inherited from Convention
Type type_
 
string id_
 

Detailed Description

Container for storing bond yield calculation conventions

Definition at line 1788 of file conventions.hpp.

Constructor & Destructor Documentation

◆ BondYieldConvention() [1/2]

Constructor.

Definition at line 2371 of file conventions.cpp.

2372 : compounding_(Compounded), compoundingName_("Compounded"),
2373 frequency_(Annual), frequencyName_("Annual"),
2374 priceType_(QuantLib::Bond::Price::Type::Clean), priceTypeName_("Clean"),
2375 accuracy_(1.0e-8), maxEvaluations_(100), guess_(0.05) {}
QuantLib::Bond::Price::Type priceType_

◆ BondYieldConvention() [2/2]

BondYieldConvention ( const std::string &  id,
const std::string &  compoundingName,
const std::string &  frequencyName,
const std::string &  priceTypeName,
Real  accuracy,
Size  maxEvaluations,
Real  guess 
)

Detailed constructor.

Definition at line 2377 of file conventions.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ compoundingName()

std::string compoundingName ( ) const

Definition at line 1802 of file conventions.hpp.

1802{ return compoundingName_; }

◆ compounding()

Compounding compounding ( ) const

Definition at line 1803 of file conventions.hpp.

1803{ return compounding_; }

◆ frequencyName()

std::string frequencyName ( ) const

Definition at line 1804 of file conventions.hpp.

1804{ return frequencyName_; }

◆ frequency()

Frequency frequency ( ) const

Definition at line 1805 of file conventions.hpp.

1805{ return frequency_; }

◆ priceType()

QuantLib::Bond::Price::Type priceType ( ) const

Definition at line 1806 of file conventions.hpp.

1806{ return priceType_; }

◆ priceTypeName()

std::string priceTypeName ( ) const

Definition at line 1807 of file conventions.hpp.

1807{ return priceTypeName_; }

◆ accuracy()

QuantLib::Real accuracy ( ) const

Definition at line 1808 of file conventions.hpp.

1808{ return accuracy_; }

◆ maxEvaluations()

QuantLib::Size maxEvaluations ( ) const

Definition at line 1809 of file conventions.hpp.

1809{ return maxEvaluations_; }

◆ guess()

QuantLib::Real guess ( ) const

Definition at line 1810 of file conventions.hpp.

1810{ return guess_; }

◆ fromXML()

void fromXML ( XMLNode node)
overridevirtual

Implements XMLSerializable.

Definition at line 2401 of file conventions.cpp.

2401 {
2402
2403 XMLUtils::checkNode(node, "BondYield");
2405 id_ = XMLUtils::getChildValue(node, "Id", true);
2406
2407 compoundingName_ = XMLUtils::getChildValue(node, "Compounding", true);
2408 frequencyName_ = XMLUtils::getChildValue(node, "Frequency", false, "Annual");
2409 priceTypeName_ = XMLUtils::getChildValue(node, "PriceType", false, "Clean");
2410 accuracy_ = XMLUtils::getChildValueAsDouble(node, "Accuracy", false, 1.0e-8);
2411 maxEvaluations_ = XMLUtils::getChildValueAsInt(node, "MaxEvaluations", false, 100);
2412 guess_ = XMLUtils::getChildValueAsDouble(node, "Guess", false, 0.05);
2413
2414 build();
2415}
static void checkNode(XMLNode *n, const string &expectedName)
Definition: xmlutils.cpp:175
static Real getChildValueAsDouble(XMLNode *node, const string &name, bool mandatory=false, double defaultValue=0.0)
Definition: xmlutils.cpp:286
static string getChildValue(XMLNode *node, const string &name, bool mandatory=false, const string &defaultValue=string())
Definition: xmlutils.cpp:277
static int getChildValueAsInt(XMLNode *node, const string &name, bool mandatory=false, int defaultValue=0)
Definition: xmlutils.cpp:291
+ Here is the call graph for this function:

◆ toXML()

XMLNode * toXML ( XMLDocument doc) const
overridevirtual

Implements XMLSerializable.

Definition at line 2417 of file conventions.cpp.

2417 {
2418
2419 XMLNode* node = doc.allocNode("BondYield");
2420 XMLUtils::addChild(doc, node, "Id", id_);
2421 XMLUtils::addChild(doc, node, "Compounding", compoundingName_);
2422 XMLUtils::addChild(doc, node, "Frequency", frequencyName_);
2423 XMLUtils::addChild(doc, node, "PriceType", priceTypeName_);
2424 XMLUtils::addChild(doc, node, "Accuracy", accuracy_);
2425 XMLUtils::addChild(doc, node, "MaxEvaluations", Integer(maxEvaluations_));
2426 XMLUtils::addChild(doc, node, "Guess", guess_);
2427
2428 return node;
2429}
static XMLNode * addChild(XMLDocument &doc, XMLNode *n, const string &name)
Definition: xmlutils.cpp:181
rapidxml::xml_node< char > XMLNode
Definition: xmlutils.hpp:60
+ Here is the call graph for this function:

◆ build()

void build ( )
overridevirtual

Implements Convention.

Definition at line 2395 of file conventions.cpp.

2395 {
2399}
Frequency parseFrequency(const string &s)
Convert text to QuantLib::Frequency.
Definition: parsers.cpp:348
QuantLib::Bond::Price::Type parseBondPriceType(const string &s)
Convert text to QuantLib::Bond::Price::Type.
Definition: parsers.cpp:392
Compounding parseCompounding(const string &s)
Convert text to QuantLib::Compounding;.
Definition: parsers.cpp:376
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ compounding_

Compounding compounding_
private

Definition at line 1817 of file conventions.hpp.

◆ compoundingName_

std::string compoundingName_
private

Definition at line 1818 of file conventions.hpp.

◆ frequency_

Frequency frequency_
private

Definition at line 1819 of file conventions.hpp.

◆ frequencyName_

std::string frequencyName_
private

Definition at line 1820 of file conventions.hpp.

◆ priceType_

QuantLib::Bond::Price::Type priceType_
private

Definition at line 1821 of file conventions.hpp.

◆ priceTypeName_

std::string priceTypeName_
private

Definition at line 1822 of file conventions.hpp.

◆ accuracy_

QuantLib::Real accuracy_
private

Definition at line 1823 of file conventions.hpp.

◆ maxEvaluations_

QuantLib::Size maxEvaluations_
private

Definition at line 1824 of file conventions.hpp.

◆ guess_

QuantLib::Real guess_
private

Definition at line 1825 of file conventions.hpp.