Provide stateless functions for SIA 30/360 end-of-month convention.
More...
Detailed Description
- Outline
-
-
- Purpose:
- Provide stateless functions for SIA 30/360 end-of-month convention.
-
- Classes:
-
-
- Description:
- This component provides a
struct
, bbldc::BasicSia30360Eom
, that serves as a namespace for defining a suite of date-related functions used to compute the day count and year fraction between two dates as prescribed by the Standard Industry Association (SIA) 30/360 day-count convention with end-of-month (eom) adjustments. In this day-count convention (also known as "US 30/360" or just "30/360"), each year is assumed to have 12 months and 360 days, with each month consisting of exactly 30 days. Special end-of-month rule adjustments are made to account for the last day of February. Note that in this day-count convention, the second date may or may not be adjusted depending on the first date.
-
- SIA-30/360-eom Day Count Algorithm:
- Given
beginDate
and endDate
, let: Ye = year of earlier date Yl = year of later date
Me = month of earlier date Ml = month of later date
De = day of earlier date Dl = day of later date
o If Dl is the last day of February (29 in a leap year, else 28)
and De is the last day of February, change Dl to 30.
o If De is the last day of February, change De to 30.
o If Dl is 31 and De is 30 or 31, change Dl to 30.
o If De is 31, change De to 30.
daysDiff ::= sign(endDate - beginDate) *
(Yl - Ye) * 360 + (Ml - Me) * 30 + Dl - De
Reference: Standard Securities Calculation Methods (1996) ISBN 1-882936-01-9
- The year fraction is simply the day count divided by 360.
-
- 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::BasicSia30360Eom
methods. First, create two bdlt::Date
variables, d1
and d2
: Then, compute the day count between the two dates: Finally, compute the year fraction between the two dates: