Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Public Member Functions | List of all members
YearCounter::Impl Class Reference
+ Inheritance diagram for YearCounter::Impl:
+ Collaboration diagram for YearCounter::Impl:

Public Member Functions

std::string name () const override
 
QuantLib::Date::serial_type dayCount (const QuantLib::Date &d1, const QuantLib::Date &d2) const override
 
QuantLib::Time yearFraction (const QuantLib::Date &d1, const QuantLib::Date &d2, const QuantLib::Date &, const QuantLib::Date &) const override
 

Detailed Description

Definition at line 42 of file yearcounter.hpp.

Member Function Documentation

◆ name()

std::string name ( ) const
override

Definition at line 44 of file yearcounter.hpp.

44{ return "Year"; }

◆ dayCount()

Date::serial_type dayCount ( const QuantLib::Date &  d1,
const QuantLib::Date &  d2 
) const
override

Definition at line 32 of file yearcounter.cpp.

32 {
33 return underlyingDCF.dayCount(d1, d2);
34}

◆ yearFraction()

Time yearFraction ( const QuantLib::Date &  d1,
const QuantLib::Date &  d2,
const QuantLib::Date &  ,
const QuantLib::Date &   
) const
override

Definition at line 36 of file yearcounter.cpp.

36 {
37 Time t = underlyingDCF.yearFraction(d1, d2);
38
39 return std::floor(0.5 + t); // rounding to the nearest integer
40}