QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
SimpleDayCounter Class Reference

Simple day counter for reproducing theoretical calculations. More...

#include <simpledaycounter.hpp>

+ Inheritance diagram for SimpleDayCounter:
+ Collaboration diagram for SimpleDayCounter:

Classes

class  Impl
 

Public Member Functions

 SimpleDayCounter ()
 
- Public Member Functions inherited from DayCounter
 DayCounter ()=default
 
bool empty () const
 Returns whether or not the day counter is initialized. More...
 
std::string name () const
 Returns the name of the day counter. More...
 
Date::serial_type dayCount (const Date &, const Date &) const
 Returns the number of days between two dates. More...
 
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. More...
 

Additional Inherited Members

- Protected Member Functions inherited from DayCounter
 DayCounter (ext::shared_ptr< Impl > impl)
 
- Protected Attributes inherited from DayCounter
ext::shared_ptr< Implimpl_
 

Detailed Description

Simple day counter for reproducing theoretical calculations.

This day counter tries to ensure that whole-month distances are returned as a simple fraction, i.e., 1 year = 1.0, 6 months = 0.5, 3 months = 0.25 and so forth.

Warning:
this day counter should be used together with NullCalendar, which ensures that dates at whole-month distances share the same day of month. It is not guaranteed to work with any other calendar.
Tests:
the correctness of the results is checked against known good values.
Examples
FittedBondCurve.cpp.

Definition at line 46 of file simpledaycounter.hpp.

Constructor & Destructor Documentation

◆ SimpleDayCounter()

Definition at line 56 of file simpledaycounter.hpp.