findates 0.1.2

Financial date arithmetic: business day calendars, day count conventions, and schedule generation.
Documentation

findates

Crates.io Docs.rs License: MIT OR Apache-2.0 MSRV: 1.70

Financial date arithmetic for Rust.

findates handles the unglamorous but essential layer that every financial application depends on: business day calendars, date adjustment conventions, day count fractions, and schedule generation. It is designed to be lightweight, composable, and independent of larger quantitative finance frameworks.

Installation

[dependencies]
findates = "0.1"

Optional serde support:

findates = { version = "0.1", features = ["serde"] }

Usage

use chrono::NaiveDate;
use findates::calendar::basic_calendar;
use findates::conventions::{AdjustRule, DayCount, Frequency};
use findates::schedule::Schedule;
use findates::algebra;

// Adjust a Saturday to the next business day (Monday)
let cal = basic_calendar();
let saturday = NaiveDate::from_ymd_opt(2024, 3, 16).unwrap();
let monday = algebra::adjust(&saturday, Some(&cal), Some(AdjustRule::Following));

// Generate a semi-annual schedule
let anchor = NaiveDate::from_ymd_opt(2023, 1, 1).unwrap();
let end    = NaiveDate::from_ymd_opt(2024, 1, 1).unwrap();
let dates  = Schedule::new(Frequency::Semiannual, None, None)
    .generate(&anchor, &end)
    .unwrap();
// [2023-01-01, 2023-07-01, 2024-01-01]

// Compute a day count fraction
let dcf = algebra::day_count_fraction(
    &anchor, &end, DayCount::Act365, Some(&cal), Some(AdjustRule::Following),
).unwrap();

Features

  • Business day calendars with weekend and holiday sets, union and intersection
  • Standard financial adjustment rules for non-business dates
  • Day count fraction calculations covering the most common market conventions
  • Frequency-based schedule generation with lazy infinite iterators
  • Optional serde support for all types

For the full list of supported conventions, adjustment rules, and frequencies see the documentation.

Design

Core operations are pure functions — no hidden state, no side effects. Schedules are lazy iterators; dates are only computed when needed. All date types are chrono::NaiveDate. Timezone-aware dates are out of scope — financial date arithmetic operates on calendar dates without reference to time of day.

Dependencies

findates uses chrono as its date representation. All public functions accept and return chrono::NaiveDate. If your codebase uses the time crate, conversion at the boundary is currently required. Broader date type interoperability is planned for a future release.

Non-goals

findates is not a pricing library, a risk engine, or a Rust replacement for QuantLib. It is a foundation layer — the date arithmetic that everything else sits on top of.

License

Licensed under either of MIT or Apache-2.0 at your option.