Enum Frequency
pub enum Frequency {
Annual,
SemiAnnual,
Quarterly,
BiMonthly,
Monthly,
Weekly,
Daily,
Weeks(u16),
Days(u16),
Once,
}Expand description
Payment / accrual frequency.
FpML has no FrequencyEnum; it models frequency as a Period
(calculationPeriodFrequency). Frequency is an ergonomic, Period-derived
convenience with total conversions to and from Period.
Variants§
Annual
Once per year (12M).
SemiAnnual
Twice per year (6M).
Quarterly
Four times per year (3M).
BiMonthly
Six times per year (2M).
Monthly
Twelve times per year (1M).
Weekly
Weekly (1W).
Daily
Daily (1D).
Weeks(u16)
Every n weeks ("4W"), n ≥ 2 — 28-day-coupon markets (MXN F-TIIE)
step by exact multi-week periods. Parsing never produces Weeks(1)
(that is Frequency::Weekly).
Days(u16)
Every n calendar days ("28D"), n ≥ 2. Parsing never produces
Days(1) (that is Frequency::Daily).
Once
A single payment at maturity (zero-coupon / bullet legs). Has no recurring
period; consumers MUST branch on this variant rather than stepping by
Frequency::to_period.
Implementations§
§impl Frequency
impl Frequency
pub fn periods_per_year(self) -> f64
pub fn periods_per_year(self) -> f64
The number of compounding periods per year this frequency implies
(Annual → 1, SemiAnnual → 2, Quarterly → 4, BiMonthly → 6,
Monthly → 12, Weekly → 52, Daily → 365). Used as the f in periodic
compounding.
pub fn from_period(period: Period) -> Option<Self>
pub fn from_period(period: Period) -> Option<Self>
The named frequency matching period, if one exists. A 1Y period maps
to Frequency::Annual.