Day count convention

The IDayCountConvention is an interface used to convert a pair of dates into a duration expressed in days or years. Depending on the selected convention, the amount of days or years between two dates can change. See the different convention used in finance on the ISO website: Indicator: Method of Interest Computation Indicator.

The interface provides two functions:

  • days(start, end): provides the number of days between the start and end dates.
  • years(start, end): provides the year fraction between the start and end dates.

The common library provides several implementations of the day converter:

  • DayCount30on360ISDA: corresponds to the A001 rule. All months have 30 days. The 31st is assumed to be 30th.
  • DayCountA360: the A004 rule. The days are exact. A year is 360 days.
  • DayCountA365Fixed: the A005 rule. The days are exact. A year is 365 days.
  • DayCountActualActualISDA: A008 rule. The days and years are exact. A year is 366 or 365 days, depending on whether the current year is leap.
  • DayCountActualActual: A009 rule. The days and years are exact. A year is 366 or 365 days, depending on whether the last year is leap.