|
BDE 4.14.0 Production release
|
Support for day-count calculations of enum-specified conventions.
enum-specified day-count calculationsThis component provides a struct, bbldc::PeriodDayCountUtil, that defines a suite of date-related functions used to compute the day count and the year fraction between two dates as prescribed by an enumerated day-count convention. Specifically, the daysDiff and yearsDiff methods defined in bbldc::PeriodDayCountUtil take a trailing DayCountConvention::Enum argument indicating which particular period-based day-count convention to apply.
This section illustrates intended use of this component.
The following snippets of code illustrate how to use bbldc::PeriodDayCountUtil methods. First, create two bdlt::Date variables, d1 and d2:
Then, create a schedule of period dates, sched, corresponding to a quarterly payment (periodYearDiff == 0.25):
Now, compute the day count between d1 and d2 according to the ICMA Actual/Actual day-count convention:
Finally, compute the year fraction between the two dates according to the ICMA Actual/Actual day-count convention: