DayCount

The following functions operate on the built-in type DayCount for day count conventions.

DayCount::yearFraction : DayCount::YearFraction -> Float

Get the Day Count Fraction according to some convention, where conventions are defined as:

module DayCount {
  type PaymentFrequency
    | Annual
    | SemiAnnual
    | Triennial
    | Quarterly
    | EveryOtherMonth

  type YearFraction
    | ActActISDA Date Date
    | ActActICMA Date Date Date DayCount::PaymentFrequency
    | Act365F Date Date
    | Act360 Date Date
    | Act365A Date Date
    | Thirty360ISDA Date Date
    | Thirty360ICMA Date Date
    | OneOne
}

Most constructors for the YearFraction data type have an arity of 2, where the two parameters correspond respectively to the start and end of the interest accrual calculation period.

ActActICMA has an arity of 4, such that the first and second parameters correspond to the start and end of the calculation period repectively, the third argument corresponds to the first coupon payment in the bond’s schedule and the fourth argument corresponds to the frequency at which subsequent coupon payments occur (and is of type PaymentFrequency).

OneOne has an arity of 0, and DayCount::yearFraction DayCount::OneOne always returns 1.0.