yearFrac

Syntax

yearFrac(dayCountConvention, start, end, [referenceStart], [referenceEnd])

Details

Calculates the year fraction between dates start and end using the specified day count convention. This value is commonly used in financial calculations such as interest accrual, discounting, and option pricing.

Parameters

dayCountConvention is a STRING scalar indicating the day count convention to use. It can be:

  • "ActualActualISMA": actual/actual (ISMA rule)
  • "Actual360": actual/360
  • "Actual365": actual/365
  • "ActualActualISDA": actual/actual (ISDA rule)

start is a DATE scalar, indicating the start date of the calculation period.

end is a DATE scalar, indicating the end date of the calculation period.

referenceStart (optional) is a DATE scalar, indicating the start date of the standard coupon period to which the accrual interval belongs. This parameter is only applicable when dayCountConvention is set to "ActualActualISMA".

referenceEnd (optional) is a DATE scalar, indicating the end date of the standard coupon period to which the accrual interval belongs. This parameter is only applicable when dayCountConvention is set to "ActualActualISMA".

Returns

A DOUBLE scalar.

Examples

For instruments with fixed coupon periods (such as semi-annual coupon bonds), the ActualActualISMA day count convention requires referenceStart and referenceEnd to define the standard coupon period to which the accrual interval belongs.

Assume a bond pays coupons semi-annually, with a coupon period defined as: January 1, 2025 to July 1, 2025. The year fraction for a portion of this coupon period is calculated as follows:

start =  2025.02.15
end = 2025.05.15
referenceStart = 2025.01.01
referenceEnd = 2025.07.01
yearFrac("ActualActualISMA", start, end, referenceStart, referenceEnd)

// output: 0.25