Skip to main content

Module daycounts

Module daycounts 

Expand description

Day-count conventions — DayCountFraction and year-fraction helpers.

Sub-day / perpetual-funding accrual (FundingDayCount) is a finer resolution of the same concept and lives here too — there is no separate intraday namespace.

Year fractions are deterministic functions of dates and return f64; the AD scalar enters later, where an accrual amount multiplies a year fraction by a rate.

Structs§

FundingDayCount
A funding day-count basis: actual elapsed time over a fixed annualisation basis (in days), at sub-day resolution. Used for perpetual-funding accrual. The default basis is 365 days.

Enums§

DayCountFraction
Year-fraction conventions, named per the FpML day-count-fraction scheme.
PeriodContext
Period/schedule context a day count may need beyond the accrual dates.
Thirty360Rule 🔒

Functions§

act_act_afb 🔒
act_act_icma 🔒
ACT/ACT.ICMA reference-period basis. Requires a PeriodContext::Scheduled — the accrual days divided by the coupon frequency times the days in the notional reference period that the accrual falls in. The reference period is recovered from the next coupon date (period_end) stepped back by one frequency tenor. Without a schedule context the two dates are their own reference period (act_act_icma_two_date).
act_act_icma_two_date 🔒
ACT/ACT.ICMA between two dates with no reference period: the dates are their own reference period. The period is round(12·days/365) months, so a regular coupon period is exactly its share of a year; a span shorter than half a month takes a one-year reference instead.
act_act_isda 🔒
actual_days 🔒
brazil_business_days 🔒
Brazilian business days in [start, end): BRBD’s count, the calendar BUS/252 is defined on. Before 2000 and after the table’s last year BRBD keeps only its weekend mask, so the count there is the weekday count.
days_in_year 🔒
is_leap 🔒
last_day_of_month 🔒
no_leap_days 🔒
NL/365 day numerator: actual days minus every 29 February d with start < d <= end — equivalent to mapping both dates onto a 365-day no-leap serial (a leap-day endpoint collapses onto 28 February).
one_per_period 🔒
1/1’s fraction: the sign of the span, so a period accrues once.
stub_contains_feb29 🔒
subtract_one_year 🔒
thirty_360 🔒
thirty_360_us 🔒
30U/360 — SIFMA’s Standard Securities Calculation Methods 30/360 US, in its order: with an end-of-month security, both dates the last day of February → D2 = 30; the start the last day of February → D1 = 30; then D2 = 31 with D1 ∈ {30, 31} → D2 = 30; D1 = 31 → D1 = 30. Without the end-of-month statement it is the bond basis.
thirty_e_360_isda 🔒
30E/360.ISDA, also quoted as the German convention. The start and end days collapse to 30 on a month-end, with the ISDA exception that an end date which is the last day of February is not collapsed when it is the schedule’s maturity (termination). With termination == None the exception cannot fire, so every non-February-maturity date behaves as the standard rule.