Implementation:Avhz RustQuant DateGenerationConvention
| Knowledge Sources | |
|---|---|
| Domains | Calendar, Time_Value_of_Money |
| Last Updated | 2026-02-07 19:00 GMT |
Overview
Concrete tool for specifying the direction and strategy of date generation in financial schedules provided by the RustQuant library.
Description
The DateGenerationConvention module defines two enums that control how payment or coupon date schedules are constructed for financial instruments.
The DateGenerationConvention enum specifies the direction of date generation:
- Forward -- dates are generated forward from the issue date toward the maturity date. This is the standard approach for most instruments where the start date is known and future dates are projected.
- Backward -- dates are generated backward from the maturity date toward the issue date. This is commonly used when the maturity date is fixed and earlier dates need to be derived.
- Zero -- no dates are generated. This is used for zero-coupon instruments or cases where no periodic schedule is needed.
The StubGeneration enum specifies how irregular (stub) periods at the beginning or end of a schedule are handled:
- None -- no stubs; all periods are regular.
- ShortFront -- a short stub period at the beginning of the schedule.
- ShortBack -- a short stub period at the end of the schedule.
- LongFront -- a long stub period at the beginning of the schedule.
- LongBack -- a long stub period at the end of the schedule.
- Both -- stubs at both the front and back of the schedule.
Both enums derive Clone, Copy, Debug, and PartialEq/Eq traits. These types are used as configuration parameters when constructing schedules for bonds, swaps, and other periodic cash-flow instruments.
Usage
Use this when constructing date schedules for coupon bonds, interest rate swaps, or other instruments with periodic payment dates. The DateGenerationConvention determines the direction of schedule construction, while StubGeneration controls how non-standard period lengths are allocated.
Code Reference
Source Location
- Repository: RustQuant
- File: crates/RustQuant_time/src/date_generation.rs
- Lines: 1-42
Signature
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum DateGenerationConvention {
Forward,
Backward,
Zero,
}
pub enum StubGeneration {
None,
ShortFront,
ShortBack,
LongFront,
LongBack,
Both,
}
Import
use RustQuant::time::date_generation::{DateGenerationConvention, StubGeneration};
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| (enum variant) | DateGenerationConvention | Yes | The direction of schedule generation (Forward, Backward, or Zero) |
| (enum variant) | StubGeneration | Yes | The stub period placement strategy |
Outputs
| Name | Type | Description |
|---|---|---|
| (enum value) | DateGenerationConvention | The selected generation direction, used as a parameter in schedule construction |
| (enum value) | StubGeneration | The selected stub strategy, used as a parameter in schedule construction |
Usage Examples
use RustQuant::time::date_generation::{DateGenerationConvention, StubGeneration};
// Select forward date generation for a standard coupon bond.
let generation = DateGenerationConvention::Forward;
// Select backward generation from maturity for a swap schedule.
let generation = DateGenerationConvention::Backward;
// Use zero generation for a zero-coupon bond.
let generation = DateGenerationConvention::Zero;
// Specify a short front stub for an irregular first period.
let stub = StubGeneration::ShortFront;
// Compare conventions.
assert_eq!(DateGenerationConvention::Forward, DateGenerationConvention::Forward);
assert_ne!(DateGenerationConvention::Forward, DateGenerationConvention::Backward);