BDE 4.39.x Production Release
Loading...
Searching...
No Matches
bbldc_basicisda11

Detailed Description

Provide stateless functions for the ISDA 1/1 convention.

Outline

Purpose

Provide stateless functions for the ISDA 1/1 convention.

Classes

Description

This component provides a struct, bbldc::BasicIsda11, 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 1/1 day-count convention. In this day-count convention, the day count and year fraction between two dates is one if the second date is later than the first, zero if equal, and negative one if the first date is later than the second.

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::BasicIsda11 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::BasicIsda11::daysDiff(d1, d2);
assert(1 == daysDiff);
static int daysDiff(const bdlt::Date &beginDate, const bdlt::Date &endDate)
Definition bbldc_basicisda11.h:142

Finally, compute the year fraction between the two dates:

const double yearsDiff = bbldc::BasicIsda11::yearsDiff(d1, d2);
assert(1.0 == yearsDiff);
static double yearsDiff(const bdlt::Date &beginDate, const bdlt::Date &endDate)
Definition bbldc_basicisda11.h:135