Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
List of all members
FXConvention Class Reference

Container for storing FX Spot quote conventions. More...

#include <ored/configuration/conventions.hpp>

+ Inheritance diagram for FXConvention:
+ Collaboration diagram for FXConvention:

Public Member Functions

Constructors
 FXConvention ()
 Default constructor. More...
 
 FXConvention (const string &id, const string &spotDays, const string &sourceCurrency, const string &targetCurrency, const string &pointsFactor, const string &advanceCalendar="", const string &spotRelative="", const string &endOfMonth="", const string &convention="")
 Detailed constructor. More...
 
Inspectors
Natural spotDays () const
 
const Currency & sourceCurrency () const
 
const Currency & targetCurrency () const
 
Real pointsFactor () const
 
const Calendar & advanceCalendar () const
 
bool spotRelative () const
 
bool endOfMonth () const
 
BusinessDayConvention convention () const
 
- 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...
 

Serialisation

Natural spotDays_
 
Currency sourceCurrency_
 
Currency targetCurrency_
 
Real pointsFactor_
 
Calendar advanceCalendar_
 
bool spotRelative_
 
bool endOfMonth_
 
BusinessDayConvention convention_
 
string strSpotDays_
 
string strSourceCurrency_
 
string strTargetCurrency_
 
string strPointsFactor_
 
string strAdvanceCalendar_
 
string strSpotRelative_
 
string strEndOfMonth_
 
string strConvention_
 
virtual void fromXML (XMLNode *node) override
 
virtual XMLNodetoXML (XMLDocument &doc) const override
 
virtual void build () override
 

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 FX Spot quote conventions.

Definition at line 785 of file conventions.hpp.

Constructor & Destructor Documentation

◆ FXConvention() [1/2]

Default constructor.

Definition at line 790 of file conventions.hpp.

790{}

◆ FXConvention() [2/2]

FXConvention ( const string &  id,
const string &  spotDays,
const string &  sourceCurrency,
const string &  targetCurrency,
const string &  pointsFactor,
const string &  advanceCalendar = "",
const string &  spotRelative = "",
const string &  endOfMonth = "",
const string &  convention = "" 
)

Detailed constructor.

Definition at line 847 of file conventions.cpp.

853 build();
854}
const Calendar & advanceCalendar() const
Natural spotDays() const
const Currency & sourceCurrency() const
BusinessDayConvention convention() const
virtual void build() override
const Currency & targetCurrency() const
+ Here is the call graph for this function:

Member Function Documentation

◆ spotDays()

Natural spotDays ( ) const

Definition at line 799 of file conventions.hpp.

799{ return spotDays_; }

◆ sourceCurrency()

const Currency & sourceCurrency ( ) const

Definition at line 800 of file conventions.hpp.

800{ return sourceCurrency_; }

◆ targetCurrency()

const Currency & targetCurrency ( ) const

Definition at line 801 of file conventions.hpp.

801{ return targetCurrency_; }

◆ pointsFactor()

Real pointsFactor ( ) const

Definition at line 802 of file conventions.hpp.

802{ return pointsFactor_; }

◆ advanceCalendar()

const Calendar & advanceCalendar ( ) const

Definition at line 803 of file conventions.hpp.

803{ return advanceCalendar_; }

◆ spotRelative()

bool spotRelative ( ) const

Definition at line 804 of file conventions.hpp.

804{ return spotRelative_; }

◆ endOfMonth()

bool endOfMonth ( ) const

Definition at line 805 of file conventions.hpp.

805{ return endOfMonth_; }

◆ convention()

BusinessDayConvention convention ( ) const

Definition at line 806 of file conventions.hpp.

806{ return convention_; }
BusinessDayConvention convention_

◆ fromXML()

void fromXML ( XMLNode node)
overridevirtual

Implements XMLSerializable.

Definition at line 867 of file conventions.cpp.

867 {
868
869 XMLUtils::checkNode(node, "FX");
870 type_ = Type::FX;
871 id_ = XMLUtils::getChildValue(node, "Id", true);
872
873 // Get string values from xml
874 strSpotDays_ = XMLUtils::getChildValue(node, "SpotDays", true);
875 strSourceCurrency_ = XMLUtils::getChildValue(node, "SourceCurrency", true);
876 strTargetCurrency_ = XMLUtils::getChildValue(node, "TargetCurrency", true);
877 strPointsFactor_ = XMLUtils::getChildValue(node, "PointsFactor", true);
878 strAdvanceCalendar_ = XMLUtils::getChildValue(node, "AdvanceCalendar", false);
879 strSpotRelative_ = XMLUtils::getChildValue(node, "SpotRelative", false);
880 strEndOfMonth_ = XMLUtils::getChildValue(node, "EOM", false);
881 strConvention_ = XMLUtils::getChildValue(node, "Convention", false);
882
883 build();
884}
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
+ Here is the call graph for this function:

◆ toXML()

XMLNode * toXML ( XMLDocument doc) const
overridevirtual

Implements XMLSerializable.

Definition at line 886 of file conventions.cpp.

886 {
887
888 XMLNode* node = doc.allocNode("FX");
889 XMLUtils::addChild(doc, node, "Id", id_);
890 XMLUtils::addChild(doc, node, "SpotDays", strSpotDays_);
891 XMLUtils::addChild(doc, node, "SourceCurrency", strSourceCurrency_);
892 XMLUtils::addChild(doc, node, "TargetCurrency", strTargetCurrency_);
893 XMLUtils::addChild(doc, node, "PointsFactor", strPointsFactor_);
894
895 if (!strAdvanceCalendar_.empty())
896 XMLUtils::addChild(doc, node, "AdvanceCalendar", strAdvanceCalendar_);
897 if (!strSpotRelative_.empty())
898 XMLUtils::addChild(doc, node, "SpotRelative", strSpotRelative_);
899 if (!strEndOfMonth_.empty())
900 XMLUtils::addChild(doc, node, "EOM", strEndOfMonth_);
901 if (!strConvention_.empty())
902 XMLUtils::addChild(doc, node, "Convention", strConvention_);
903
904 return node;
905}
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 856 of file conventions.cpp.

856 {
857 spotDays_ = lexical_cast<Natural>(strSpotDays_);
865}
Calendar parseCalendar(const string &s)
Convert text to QuantLib::Calendar.
Definition: parsers.cpp:157
Currency parseCurrency(const string &s)
Convert text to QuantLib::Currency.
Definition: parsers.cpp:290
BusinessDayConvention parseBusinessDayConvention(const string &s)
Convert text to QuantLib::BusinessDayConvention.
Definition: parsers.cpp:173
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
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ spotDays_

Natural spotDays_
private

Definition at line 817 of file conventions.hpp.

◆ sourceCurrency_

Currency sourceCurrency_
private

Definition at line 818 of file conventions.hpp.

◆ targetCurrency_

Currency targetCurrency_
private

Definition at line 819 of file conventions.hpp.

◆ pointsFactor_

Real pointsFactor_
private

Definition at line 820 of file conventions.hpp.

◆ advanceCalendar_

Calendar advanceCalendar_
private

Definition at line 821 of file conventions.hpp.

◆ spotRelative_

bool spotRelative_
private

Definition at line 822 of file conventions.hpp.

◆ endOfMonth_

bool endOfMonth_
private

Definition at line 823 of file conventions.hpp.

◆ convention_

BusinessDayConvention convention_
private

Definition at line 824 of file conventions.hpp.

◆ strSpotDays_

string strSpotDays_
private

Definition at line 827 of file conventions.hpp.

◆ strSourceCurrency_

string strSourceCurrency_
private

Definition at line 828 of file conventions.hpp.

◆ strTargetCurrency_

string strTargetCurrency_
private

Definition at line 829 of file conventions.hpp.

◆ strPointsFactor_

string strPointsFactor_
private

Definition at line 830 of file conventions.hpp.

◆ strAdvanceCalendar_

string strAdvanceCalendar_
private

Definition at line 831 of file conventions.hpp.

◆ strSpotRelative_

string strSpotRelative_
private

Definition at line 832 of file conventions.hpp.

◆ strEndOfMonth_

string strEndOfMonth_
private

Definition at line 833 of file conventions.hpp.

◆ strConvention_

string strConvention_
private

Definition at line 834 of file conventions.hpp.