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

Container for storing Overnight Index Swap conventions. More...

#include <ored/configuration/conventions.hpp>

+ Inheritance diagram for OisConvention:
+ Collaboration diagram for OisConvention:

Public Member Functions

Constructors
 OisConvention ()
 Default constructor. More...
 
 OisConvention (const string &id, const string &spotLag, const string &index, const string &fixedDayCounter, const string &fixedCalendar, const string &paymentLag="", const string &eom="", const string &fixedFrequency="", const string &fixedConvention="", const string &fixedPaymentConvention="", const string &rule="", const std::string &paymentCalendar="")
 Detailed constructor. More...
 
Inspectors
Natural spotLag () const
 
const string & indexName () const
 
QuantLib::ext::shared_ptr< OvernightIndexindex () const
 
const DayCounter & fixedDayCounter () const
 
const Calendar & fixedCalendar () const
 
Natural paymentLag () const
 
bool eom ()
 
Frequency fixedFrequency () const
 
BusinessDayConvention fixedConvention () const
 
BusinessDayConvention fixedPaymentConvention () const
 
DateGeneration::Rule rule () const
 
QuantLib::Calendar paymentCalendar () 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 spotLag_
 
DayCounter fixedDayCounter_
 
Calendar fixedCalendar_
 
Natural paymentLag_
 
bool eom_
 
Frequency fixedFrequency_
 
BusinessDayConvention fixedConvention_
 
BusinessDayConvention fixedPaymentConvention_
 
DateGeneration::Rule rule_
 
QuantLib::Calendar paymentCal_
 
string strSpotLag_
 
string strIndex_
 
string strFixedDayCounter_
 
string strFixedCalendar_
 
string strPaymentLag_
 
string strEom_
 
string strFixedFrequency_
 
string strFixedConvention_
 
string strFixedPaymentConvention_
 
string strRule_
 
std::string strPaymentCal_
 
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 Overnight Index Swap conventions.

Definition at line 373 of file conventions.hpp.

Constructor & Destructor Documentation

◆ OisConvention() [1/2]

Default constructor.

Definition at line 378 of file conventions.hpp.

378{}

◆ OisConvention() [2/2]

OisConvention ( const string &  id,
const string &  spotLag,
const string &  index,
const string &  fixedDayCounter,
const string &  fixedCalendar,
const string &  paymentLag = "",
const string &  eom = "",
const string &  fixedFrequency = "",
const string &  fixedConvention = "",
const string &  fixedPaymentConvention = "",
const string &  rule = "",
const std::string &  paymentCalendar = "" 
)

Detailed constructor.

Definition at line 285 of file conventions.cpp.

292 strPaymentCal_(paymentCal) {
293 build();
294}
BusinessDayConvention fixedPaymentConvention() const
Frequency fixedFrequency() const
Natural paymentLag() const
virtual void build() override
const DayCounter & fixedDayCounter() const
DateGeneration::Rule rule() const
BusinessDayConvention fixedConvention() const
Natural spotLag() const
const Calendar & fixedCalendar() const
QuantLib::ext::shared_ptr< OvernightIndex > index() const
+ Here is the call graph for this function:

Member Function Documentation

◆ spotLag()

Natural spotLag ( ) const

Definition at line 389 of file conventions.hpp.

389{ return spotLag_; }

◆ indexName()

const string & indexName ( ) const

Definition at line 390 of file conventions.hpp.

390{ return strIndex_; }

◆ index()

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

Definition at line 361 of file conventions.cpp.

361 {
362 auto tmp = QuantLib::ext::dynamic_pointer_cast<OvernightIndex>(parseIborIndex(strIndex_));
363 QL_REQUIRE(tmp, "The index string '" << strIndex_ << "' does not represent an overnight index.");
364 return tmp;
365}
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:

◆ fixedDayCounter()

const DayCounter & fixedDayCounter ( ) const

Definition at line 392 of file conventions.hpp.

392{ return fixedDayCounter_; }

◆ fixedCalendar()

const Calendar & fixedCalendar ( ) const

Definition at line 394 of file conventions.hpp.

394{ return fixedCalendar_; }

◆ paymentLag()

Natural paymentLag ( ) const

Definition at line 395 of file conventions.hpp.

395{ return paymentLag_; }

◆ eom()

bool eom ( )

Definition at line 396 of file conventions.hpp.

396{ return eom_; }

◆ fixedFrequency()

Frequency fixedFrequency ( ) const

Definition at line 397 of file conventions.hpp.

397{ return fixedFrequency_; }

◆ fixedConvention()

BusinessDayConvention fixedConvention ( ) const

Definition at line 398 of file conventions.hpp.

398{ return fixedConvention_; }
BusinessDayConvention fixedConvention_

◆ fixedPaymentConvention()

BusinessDayConvention fixedPaymentConvention ( ) const

Definition at line 399 of file conventions.hpp.

399{ return fixedPaymentConvention_; }
BusinessDayConvention fixedPaymentConvention_

◆ rule()

DateGeneration::Rule rule ( ) const

Definition at line 400 of file conventions.hpp.

400{ return rule_; }
DateGeneration::Rule rule_

◆ paymentCalendar()

QuantLib::Calendar paymentCalendar ( ) const

Definition at line 401 of file conventions.hpp.

401{ return paymentCal_; }
QuantLib::Calendar paymentCal_

◆ fromXML()

void fromXML ( XMLNode node)
overridevirtual

Implements XMLSerializable.

Definition at line 311 of file conventions.cpp.

311 {
312
313 XMLUtils::checkNode(node, "OIS");
315 id_ = XMLUtils::getChildValue(node, "Id", true);
316
317 // Get string values from xml
318 strSpotLag_ = XMLUtils::getChildValue(node, "SpotLag", true);
319 strIndex_ = XMLUtils::getChildValue(node, "Index", true);
320 strFixedDayCounter_ = XMLUtils::getChildValue(node, "FixedDayCounter", true);
321 // bwd compatibility
322 strFixedCalendar_ = XMLUtils::getChildValue(node, "FixedCalendar", false);
323 strPaymentLag_ = XMLUtils::getChildValue(node, "PaymentLag", false);
324 strEom_ = XMLUtils::getChildValue(node, "EOM", false);
325 strFixedFrequency_ = XMLUtils::getChildValue(node, "FixedFrequency", false);
326 strFixedConvention_ = XMLUtils::getChildValue(node, "FixedConvention", false);
327 strFixedPaymentConvention_ = XMLUtils::getChildValue(node, "FixedPaymentConvention", false);
328 strRule_ = XMLUtils::getChildValue(node, "Rule", false);
329 strPaymentCal_ = XMLUtils::getChildValue(node, "PaymentCalendar", false);
330
331 build();
332}
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 334 of file conventions.cpp.

334 {
335
336 XMLNode* node = doc.allocNode("OIS");
337 XMLUtils::addChild(doc, node, "Id", id_);
338 XMLUtils::addChild(doc, node, "SpotLag", strSpotLag_);
339 XMLUtils::addChild(doc, node, "Index", strIndex_);
340 XMLUtils::addChild(doc, node, "FixedDayCounter", strFixedDayCounter_);
341 if(!strFixedCalendar_.empty())
342 XMLUtils::addChild(doc, node, "FixedCalendar", strFixedCalendar_);
343 if (!strPaymentLag_.empty())
344 XMLUtils::addChild(doc, node, "PaymentLag", strPaymentLag_);
345 if (!strEom_.empty())
346 XMLUtils::addChild(doc, node, "EOM", strEom_);
347 if (!strFixedFrequency_.empty())
348 XMLUtils::addChild(doc, node, "FixedFrequency", strFixedFrequency_);
349 if (!strFixedConvention_.empty())
350 XMLUtils::addChild(doc, node, "FixedConvention", strFixedConvention_);
351 if (!strFixedPaymentConvention_.empty())
352 XMLUtils::addChild(doc, node, "FixedPaymentConvention", strFixedPaymentConvention_);
353 if (!strRule_.empty())
354 XMLUtils::addChild(doc, node, "Rule", strRule_);
355 if (!strPaymentCal_.empty())
356 XMLUtils::addChild(doc, node, "PaymentCalendar", strPaymentCal_);
357
358 return node;
359}
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 296 of file conventions.cpp.

296 {
297 auto tmpIndex = parseIborIndex(strIndex_);
298 spotLag_ = lexical_cast<Natural>(strSpotLag_);
300 fixedCalendar_ = strFixedCalendar_.empty() ? tmpIndex->fixingCalendar() : parseCalendar(strFixedCalendar_);
301 paymentLag_ = strPaymentLag_.empty() ? 0 : lexical_cast<Natural>(strPaymentLag_);
302 eom_ = strEom_.empty() ? false : parseBool(strEom_);
307 rule_ = strRule_.empty() ? DateGeneration::Backward : parseDateGenerationRule(strRule_);
308 paymentCal_ = strPaymentCal_.empty() ? Calendar() : parseCalendar(strPaymentCal_);
309}
DateGeneration::Rule parseDateGenerationRule(const string &s)
Convert text to QuantLib::DateGeneration::Rule.
Definition: parsers.cpp:328
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
bool parseBool(const string &s)
Convert text to bool.
Definition: parsers.cpp:144
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

◆ spotLag_

Natural spotLag_
private

Definition at line 412 of file conventions.hpp.

◆ fixedDayCounter_

DayCounter fixedDayCounter_
private

Definition at line 413 of file conventions.hpp.

◆ fixedCalendar_

Calendar fixedCalendar_
private

Definition at line 414 of file conventions.hpp.

◆ paymentLag_

Natural paymentLag_
private

Definition at line 415 of file conventions.hpp.

◆ eom_

bool eom_
private

Definition at line 416 of file conventions.hpp.

◆ fixedFrequency_

Frequency fixedFrequency_
private

Definition at line 417 of file conventions.hpp.

◆ fixedConvention_

BusinessDayConvention fixedConvention_
private

Definition at line 418 of file conventions.hpp.

◆ fixedPaymentConvention_

BusinessDayConvention fixedPaymentConvention_
private

Definition at line 419 of file conventions.hpp.

◆ rule_

DateGeneration::Rule rule_
private

Definition at line 420 of file conventions.hpp.

◆ paymentCal_

QuantLib::Calendar paymentCal_
private

Definition at line 421 of file conventions.hpp.

◆ strSpotLag_

string strSpotLag_
private

Definition at line 424 of file conventions.hpp.

◆ strIndex_

string strIndex_
private

Definition at line 425 of file conventions.hpp.

◆ strFixedDayCounter_

string strFixedDayCounter_
private

Definition at line 426 of file conventions.hpp.

◆ strFixedCalendar_

string strFixedCalendar_
private

Definition at line 427 of file conventions.hpp.

◆ strPaymentLag_

string strPaymentLag_
private

Definition at line 428 of file conventions.hpp.

◆ strEom_

string strEom_
private

Definition at line 429 of file conventions.hpp.

◆ strFixedFrequency_

string strFixedFrequency_
private

Definition at line 430 of file conventions.hpp.

◆ strFixedConvention_

string strFixedConvention_
private

Definition at line 431 of file conventions.hpp.

◆ strFixedPaymentConvention_

string strFixedPaymentConvention_
private

Definition at line 432 of file conventions.hpp.

◆ strRule_

string strRule_
private

Definition at line 433 of file conventions.hpp.

◆ strPaymentCal_

std::string strPaymentCal_
private

Definition at line 434 of file conventions.hpp.