Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Avhz RustQuant Schedule

From Leeroopedia
Revision as of 14:33, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/Avhz_RustQuant_Schedule.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Knowledge Sources
Domains Calendar, Time_Value_of_Money
Last Updated 2026-02-07 19:00 GMT

Overview

Concrete tool for representing financial instrument payment schedules with dates and day count factors provided by the RustQuant library.

Description

The Schedule module defines the Schedule struct, which represents a sequence of dates and their associated day count factors for financial instruments. Many financial instruments -- including coupon bonds, interest rate caps and floors, and swaps -- have periodic payment dates. The Schedule struct bundles these dates with the computed year fractions (day count factors) between them, along with the conventions used to generate them.

The struct contains four fields:

  • dates (Vec<Date>) -- the vector of rolled (business-day-adjusted) payment dates in the schedule.
  • day_count_factors (Vec<f64>) -- the year fractions between consecutive dates, computed using the specified day count convention. The first element represents the factor from today to the first scheduled date, followed by factors between each consecutive pair of dates.
  • day_counting_convention (DayCountConvention) -- the convention used to compute the day count factors (e.g., Actual/360, 30/360 ISDA).
  • date_rolling_convention (DateRollingConvention) -- the convention used to roll dates to business days (e.g., ModifiedFollowing).

The Display trait is implemented for Schedule, providing a formatted text representation showing all four fields.

The struct is annotated with #[pyclass] for Python interoperability via PyO3. The module also contains extensive commented-out code for alternative constructors (new_from_start, new_from_end, new_from_dates, and drop) and their associated unit tests, indicating work-in-progress functionality for direct schedule construction.

Currently, schedules are generated through Calendar::generate_schedule_from_dates, which rolls the dates, computes day count factors, and assembles the Schedule.

Usage

Use this as the output of schedule generation for pricing fixed-income instruments, computing present values of cash flow streams, or any calculation requiring a time grid of dates with associated year fractions. The schedule is typically created via Calendar::generate_schedule_from_dates and then consumed by pricing engines.

Code Reference

Source Location

Signature

#[derive(Clone, Debug)]
#[pyclass]
pub struct Schedule {
    pub dates: Vec<Date>,
    pub day_count_factors: Vec<f64>,
    pub day_counting_convention: DayCountConvention,
    pub date_rolling_convention: DateRollingConvention,
}

impl fmt::Display for Schedule {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result;
}

Import

use RustQuant::time::schedule::Schedule;

I/O Contract

Inputs

Name Type Required Description
dates Vec<Date> Yes The raw (unrolled) payment dates for the schedule
day_count_factors Vec<f64> Yes The precomputed year fractions between consecutive dates
day_counting_convention DayCountConvention Yes The convention used for day count factor computation
date_rolling_convention DateRollingConvention Yes The convention used for adjusting dates to business days

Outputs

Name Type Description
Schedule Schedule A struct containing rolled dates, day count factors, and the conventions used
String String Formatted display output (via Display trait)

Usage Examples

use time::macros::date;
use RustQuant::time::calendar::{Calendar, Market};
use RustQuant::time::date_rolling::DateRollingConvention;
use RustQuant::time::day_counting::DayCountConvention;

// Create a calendar and define payment dates.
let calendar = Calendar::new(Market::UnitedStates);
let dates = vec![
    date!(2024-06-15),
    date!(2024-12-15),
    date!(2025-06-15),
    date!(2025-12-15),
];

// Generate a schedule with ModifiedFollowing rolling and Actual/365 Fixed day counting.
let schedule = calendar.generate_schedule_from_dates(
    dates,
    DateRollingConvention::ModifiedFollowing,
    DayCountConvention::Actual_365_Fixed,
);

// Access the rolled dates.
for date in &schedule.dates {
    println!("Payment date: {}", date);
}

// Access the day count factors.
for dcf in &schedule.day_count_factors {
    println!("Day count factor: {:.6}", dcf);
}

// Display the full schedule.
println!("{}", schedule);

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment