quantlib_rs 0.1.0

A ground-up, idiomatic Rust quantitative finance library inspired by QuantLib.
Documentation
//! Day count conventions for accrued interest and term structures.

use crate::time::date::Date;

/// Trait implemented by day count convention calculators.
///
/// Day counters calculate:
/// 1. The number of days between two dates under the convention.
/// 2. The year fraction (time $T$ in years) between two dates.
pub trait DayCounter: Send + Sync {
    /// Return the name of the day counter.
    fn name(&self) -> &'static str;

    /// Return the number of days between two dates according to the convention.
    fn day_count(&self, start: Date, end: Date) -> i64;

    /// Return the year fraction (time in years) between two dates.
    fn year_fraction(&self, start: Date, end: Date) -> f64;
}