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

Container for storing Interest Rate Swap conventions. More...

#include <ored/configuration/conventions.hpp>

+ Inheritance diagram for IRSwapConvention:
+ Collaboration diagram for IRSwapConvention:

Public Member Functions

Constructors
 IRSwapConvention ()
 Default constructor. More...
 
 IRSwapConvention (const string &id, const string &fixedCalendar, const string &fixedFrequency, const string &fixedConvention, const string &fixedDayCounter, const string &index, bool hasSubPeriod=false, const string &floatFrequency="", const string &subPeriodsCouponType="")
 Detailed constructor. More...
 
Inspectors
const Calendar & fixedCalendar () const
 
Frequency fixedFrequency () const
 
BusinessDayConvention fixedConvention () const
 
const DayCounter & fixedDayCounter () const
 
const string & indexName () const
 
QuantLib::ext::shared_ptr< IborIndexindex () const
 
bool hasSubPeriod () const
 
Frequency floatFrequency () const
 
SubPeriodsCoupon1::Type subPeriodsCouponType () 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

Calendar fixedCalendar_
 
Frequency fixedFrequency_
 
BusinessDayConvention fixedConvention_
 
DayCounter fixedDayCounter_
 
bool hasSubPeriod_
 
Frequency floatFrequency_
 
SubPeriodsCoupon1::Type subPeriodsCouponType_
 
string strFixedCalendar_
 
string strFixedFrequency_
 
string strFixedConvention_
 
string strFixedDayCounter_
 
string strIndex_
 
string strFloatFrequency_
 
string strSubPeriodsCouponType_
 
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 Interest Rate Swap conventions.

Definition at line 515 of file conventions.hpp.

Constructor & Destructor Documentation

◆ IRSwapConvention() [1/2]

Default constructor.

Definition at line 520 of file conventions.hpp.

520{}

◆ IRSwapConvention() [2/2]

IRSwapConvention ( const string &  id,
const string &  fixedCalendar,
const string &  fixedFrequency,
const string &  fixedConvention,
const string &  fixedDayCounter,
const string &  index,
bool  hasSubPeriod = false,
const string &  floatFrequency = "",
const string &  subPeriodsCouponType = "" 
)

Detailed constructor.

Definition at line 467 of file conventions.cpp.

473 build();
474}
Frequency floatFrequency() const
SubPeriodsCoupon1::Type subPeriodsCouponType() const
Frequency fixedFrequency() const
virtual void build() override
const DayCounter & fixedDayCounter() const
BusinessDayConvention fixedConvention() const
QuantLib::ext::shared_ptr< IborIndex > index() const
const Calendar & fixedCalendar() const
+ Here is the call graph for this function:

Member Function Documentation

◆ fixedCalendar()

const Calendar & fixedCalendar ( ) const

Definition at line 530 of file conventions.hpp.

530{ return fixedCalendar_; }

◆ fixedFrequency()

Frequency fixedFrequency ( ) const

Definition at line 531 of file conventions.hpp.

531{ return fixedFrequency_; }

◆ fixedConvention()

BusinessDayConvention fixedConvention ( ) const

Definition at line 532 of file conventions.hpp.

532{ return fixedConvention_; }
BusinessDayConvention fixedConvention_

◆ fixedDayCounter()

const DayCounter & fixedDayCounter ( ) const

Definition at line 533 of file conventions.hpp.

533{ return fixedDayCounter_; }

◆ indexName()

const string & indexName ( ) const

Definition at line 534 of file conventions.hpp.

534{ return strIndex_; }

◆ index()

QuantLib::ext::shared_ptr< IborIndex > index ( ) const

Definition at line 538 of file conventions.cpp.

538{ return parseIborIndex(strIndex_); }
QuantLib::ext::shared_ptr< IborIndex > parseIborIndex(const string &s, const Handle< YieldTermStructure > &h)
Convert std::string to QuantLib::IborIndex.
+ Here is the call graph for this function:

◆ hasSubPeriod()

bool hasSubPeriod ( ) const

Definition at line 537 of file conventions.hpp.

537{ return hasSubPeriod_; }

◆ floatFrequency()

Frequency floatFrequency ( ) const

Definition at line 538 of file conventions.hpp.

538{ return floatFrequency_; } // returns NoFrequency for normal swaps

◆ subPeriodsCouponType()

SubPeriodsCoupon1::Type subPeriodsCouponType ( ) const

Definition at line 539 of file conventions.hpp.

539{ return subPeriodsCouponType_; }
SubPeriodsCoupon1::Type subPeriodsCouponType_

◆ fromXML()

void fromXML ( XMLNode node)
overridevirtual

Implements XMLSerializable.

Definition at line 500 of file conventions.cpp.

500 {
501
502 XMLUtils::checkNode(node, "Swap");
504 id_ = XMLUtils::getChildValue(node, "Id", true);
505
506 // Get string values from xml
507 strFixedFrequency_ = XMLUtils::getChildValue(node, "FixedFrequency", true);
508 strFixedDayCounter_ = XMLUtils::getChildValue(node, "FixedDayCounter", true);
509 strIndex_ = XMLUtils::getChildValue(node, "Index", true);
510
511 // optional
512 strFixedCalendar_ = XMLUtils::getChildValue(node, "FixedCalendar", false);
513 strFixedConvention_ = XMLUtils::getChildValue(node, "FixedConvention", false);
514 strFloatFrequency_ = XMLUtils::getChildValue(node, "FloatFrequency", false);
515 strSubPeriodsCouponType_ = XMLUtils::getChildValue(node, "SubPeriodsCouponType", false);
517
518 build();
519}
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 521 of file conventions.cpp.

521 {
522
523 XMLNode* node = doc.allocNode("Swap");
524 XMLUtils::addChild(doc, node, "Id", id_);
525 XMLUtils::addChild(doc, node, "FixedCalendar", strFixedCalendar_);
526 XMLUtils::addChild(doc, node, "FixedFrequency", strFixedFrequency_);
527 XMLUtils::addChild(doc, node, "FixedConvention", strFixedConvention_);
528 XMLUtils::addChild(doc, node, "FixedDayCounter", strFixedDayCounter_);
529 XMLUtils::addChild(doc, node, "Index", strIndex_);
530 if (hasSubPeriod_) {
531 XMLUtils::addChild(doc, node, "FloatFrequency", strFloatFrequency_);
532 XMLUtils::addChild(doc, node, "SubPeriodsCouponType", strSubPeriodsCouponType_);
533 }
534
535 return node;
536}
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 476 of file conventions.cpp.

476 {
479 auto ind = parseIborIndex(strIndex_);
480
481 if (strFixedCalendar_.empty())
482 fixedCalendar_ = ind->fixingCalendar();
483 else
485
486 if (strFixedConvention_.empty())
487 fixedConvention_ = ind->businessDayConvention();
488 else
490
491 if (hasSubPeriod_) {
493 subPeriodsCouponType_ = parseSubPeriodsCouponType(strSubPeriodsCouponType_);
494 } else {
495 floatFrequency_ = NoFrequency;
497 }
498}
Calendar parseCalendar(const string &s)
Convert text to QuantLib::Calendar.
Definition: parsers.cpp:157
BusinessDayConvention parseBusinessDayConvention(const string &s)
Convert text to QuantLib::BusinessDayConvention.
Definition: parsers.cpp:173
Frequency parseFrequency(const string &s)
Convert text to QuantLib::Frequency.
Definition: parsers.cpp:348
DayCounter parseDayCounter(const string &s)
Convert text to QuantLib::DayCounter.
Definition: parsers.cpp:209
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ fixedCalendar_

Calendar fixedCalendar_
private

Definition at line 550 of file conventions.hpp.

◆ fixedFrequency_

Frequency fixedFrequency_
private

Definition at line 551 of file conventions.hpp.

◆ fixedConvention_

BusinessDayConvention fixedConvention_
private

Definition at line 552 of file conventions.hpp.

◆ fixedDayCounter_

DayCounter fixedDayCounter_
private

Definition at line 553 of file conventions.hpp.

◆ hasSubPeriod_

bool hasSubPeriod_
private

Definition at line 554 of file conventions.hpp.

◆ floatFrequency_

Frequency floatFrequency_
private

Definition at line 555 of file conventions.hpp.

◆ subPeriodsCouponType_

SubPeriodsCoupon1::Type subPeriodsCouponType_
private

Definition at line 556 of file conventions.hpp.

◆ strFixedCalendar_

string strFixedCalendar_
private

Definition at line 559 of file conventions.hpp.

◆ strFixedFrequency_

string strFixedFrequency_
private

Definition at line 560 of file conventions.hpp.

◆ strFixedConvention_

string strFixedConvention_
private

Definition at line 561 of file conventions.hpp.

◆ strFixedDayCounter_

string strFixedDayCounter_
private

Definition at line 562 of file conventions.hpp.

◆ strIndex_

string strIndex_
private

Definition at line 563 of file conventions.hpp.

◆ strFloatFrequency_

string strFloatFrequency_
private

Definition at line 564 of file conventions.hpp.

◆ strSubPeriodsCouponType_

string strSubPeriodsCouponType_
private

Definition at line 565 of file conventions.hpp.