BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bbldc_basicisdaactualactual

Detailed Description

Outline

Purpose

Provide stateless functions for the ISDA Actual/Actual convention.

Classes

Description

This component provides a struct, bbldc::BasicIsdaActualActual, that serves as a namespace for defining a suite of date-related functions used to compute the day count and the year fraction between two dates as per the ISDA Actual/Actual day-count convention. In this day-count convention, the day count between two dates is exactly the number of days occurring in the time period and the year fraction between two dates is the number of full calendar years between the dates plus front-stub and back-stub adjustments.

Usage

This section illustrates intended use of this component.

Example 1: Computing Day Count and Year Fraction

The following snippets of code illustrate how to use bbldc::BasicIsdaActualActual methods. First, create two bdlt::Date variables, d1 and d2:

const bdlt::Date d1(2003, 10, 19);
const bdlt::Date d2(2003, 12, 31);
Definition bdlt_date.h:294

Then, compute the day count between the two dates:

const int daysDiff = bbldc::BasicIsdaActualActual::daysDiff(d1, d2);
assert(73 == daysDiff);
static int daysDiff(const bdlt::Date &beginDate, const bdlt::Date &endDate)
Definition bbldc_basicisdaactualactual.h:134

Finally, compute the year fraction between the two dates:

const double yearsDiff = bbldc::BasicIsdaActualActual::yearsDiff(d1, d2);
// Need fuzzy comparison since 'yearsDiff' is a 'double'.
assert(yearsDiff > 0.1999 && yearsDiff < 0.2001);
static double yearsDiff(const bdlt::Date &beginDate, const bdlt::Date &endDate)