QuantLib_DayCounter man page

DayCounter — day counter class  


#include <ql/time/daycounter.hpp>

Inherited by Actual360, Actual365Fixed, Actual365NoLeap, ActualActual, Business252, OneDayCounter, SimpleDayCounter, and Thirty360.


class Impl
abstract base class for day counter implementations

Public Member Functions

DayCounter ()

DayCounter interface

bool empty () const
Returns whether or not the day counter is initialized.
std::string name () const
Returns the name of the day counter.
Date::serial_type dayCount (const Date &, const Date &) const
Returns the number of days between two dates.
Time yearFraction (const Date &, const Date &, const Date &refPeriodStart=Date(), const Date &refPeriodEnd=Date()) const
Returns the period between two dates as a fraction of year.

Protected Member Functions

DayCounter (const boost::shared_ptr< Impl > &impl)

Protected Attributes

boost::shared_ptr< Impl > impl_

Detailed Description

day counter class

This class provides methods for determining the length of a time period according to given market convention, both as a number of days and as a year fraction.

The Bridge pattern is used to provide the base behavior of the day counter.

Examples: BermudanSwaption.cpp, Bonds.cpp, CallableBonds.cpp, ConvertibleBonds.cpp, DiscreteHedging.cpp, EquityOption.cpp, FittedBondCurve.cpp, FRA.cpp, Replication.cpp, Repo.cpp, and swapvaluation.cpp.

Constructor & Destructor Documentation

DayCounter (const boost::shared_ptr< Impl > & impl) [protected]

This constructor can be invoked by derived classes which define a given implementation.

DayCounter ()

The default constructor returns a day counter with a null implementation, which is therefore unusable except as a placeholder.

Member Function Documentation

std::string name () const

Returns the name of the day counter.


This method is used for output and comparison between day counters. It is not meant to be used for writing switch-on-type code.


Generated automatically by Doxygen for QuantLib from the source code.

Referenced By

The man pages dayCount(3), DayCounter(3) and yearFraction(3) are aliases of QuantLib_DayCounter(3).

Fri Sep 1 2017 Version 1.10.1 QuantLib