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§
- Funding
DayCount - 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§
- DayCount
Fraction - Year-fraction conventions, named per the FpML day-count-fraction scheme.
- Period
Context - Period/schedule context a day count may need beyond the accrual dates.
- Thirty360
Rule 🔒
Functions§
- act_
act_ 🔒afb - act_
act_ 🔒icma ACT/ACT.ICMAreference-period basis. Requires aPeriodContext::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.ICMAbetween two dates with no reference period: the dates are their own reference period. The period isround(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/365day numerator: actual days minus every 29 Februarydwithstart < 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). Withtermination == Nonethe exception cannot fire, so every non-February-maturity date behaves as the standard rule.