Trait DateRoll

Source
pub trait DateRoll {
Show 18 methods // Required methods fn is_weekday(&self, date: &NaiveDateTime) -> bool; fn is_holiday(&self, date: &NaiveDateTime) -> bool; fn is_settlement(&self, date: &NaiveDateTime) -> bool; // Provided methods fn is_bus_day(&self, date: &NaiveDateTime) -> bool { ... } fn is_non_bus_day(&self, date: &NaiveDateTime) -> bool { ... } fn roll_forward_bus_day(&self, date: &NaiveDateTime) -> NaiveDateTime { ... } fn roll_backward_bus_day(&self, date: &NaiveDateTime) -> NaiveDateTime { ... } fn roll_mod_forward_bus_day(&self, date: &NaiveDateTime) -> NaiveDateTime { ... } fn roll_mod_backward_bus_day(&self, date: &NaiveDateTime) -> NaiveDateTime { ... } fn roll_forward_settled_bus_day( &self, date: &NaiveDateTime, ) -> NaiveDateTime { ... } fn roll_backward_settled_bus_day( &self, date: &NaiveDateTime, ) -> NaiveDateTime { ... } fn roll_forward_mod_settled_bus_day( &self, date: &NaiveDateTime, ) -> NaiveDateTime { ... } fn roll_backward_mod_settled_bus_day( &self, date: &NaiveDateTime, ) -> NaiveDateTime { ... } fn lag_bus_days( &self, date: &NaiveDateTime, days: i32, settlement: bool, ) -> NaiveDateTime { ... } fn add_cal_days( &self, date: &NaiveDateTime, days: i32, adjuster: &Adjuster, ) -> NaiveDateTime where Self: Sized { ... } fn add_bus_days( &self, date: &NaiveDateTime, days: i32, settlement: bool, ) -> Result<NaiveDateTime, PyErr> { ... } fn bus_date_range( &self, start: &NaiveDateTime, end: &NaiveDateTime, ) -> Result<Vec<NaiveDateTime>, PyErr> { ... } fn cal_date_range( &self, start: &NaiveDateTime, end: &NaiveDateTime, ) -> Result<Vec<NaiveDateTime>, PyErr> { ... }
}
Expand description

Simple date adjustment defining business, settleable and holidays and rolling.

Required Methods§

Source

fn is_weekday(&self, date: &NaiveDateTime) -> bool

Returns whether the date is part of the general working week.

Source

fn is_holiday(&self, date: &NaiveDateTime) -> bool

Returns whether the date is a specific holiday excluded from the regular working week.

Source

fn is_settlement(&self, date: &NaiveDateTime) -> bool

Returns whether the date is valid relative to an associated settlement calendar.

If the holiday calendar object has no associated settlement calendar this should return true for any date.

Provided Methods§

Source

fn is_bus_day(&self, date: &NaiveDateTime) -> bool

Returns whether the date is a business day, i.e. part of the working week and not a holiday.

Source

fn is_non_bus_day(&self, date: &NaiveDateTime) -> bool

Returns whether the date is not a business day, i.e. either not in working week or a specific holiday.

Source

fn roll_forward_bus_day(&self, date: &NaiveDateTime) -> NaiveDateTime

Return the date, if a business day, or get the next business date after date.

Source

fn roll_backward_bus_day(&self, date: &NaiveDateTime) -> NaiveDateTime

Return the date, if a business day, or get the business day preceding date.

Source

fn roll_mod_forward_bus_day(&self, date: &NaiveDateTime) -> NaiveDateTime

Return the date, if a business day, or get the proceeding business date, without rolling into a new month.

Source

fn roll_mod_backward_bus_day(&self, date: &NaiveDateTime) -> NaiveDateTime

Return the date, if a business day, or get the proceeding business date, without rolling into a new month.

Source

fn roll_forward_settled_bus_day(&self, date: &NaiveDateTime) -> NaiveDateTime

Return the date, if a business day that can be settled, or the proceeding date that is such.

If the calendar has no associated settlement calendar this is identical to roll_forward_bus_day.

Source

fn roll_backward_settled_bus_day(&self, date: &NaiveDateTime) -> NaiveDateTime

Return the date, if a business day that can be settled, or the preceding date that is such.

If the calendar has no associated settlement calendar this is identical to roll_backward_bus_day.

Source

fn roll_forward_mod_settled_bus_day( &self, date: &NaiveDateTime, ) -> NaiveDateTime

Return the date, if a business day that can be settled, or get the proceeding such date, without rolling into a new month.

Source

fn roll_backward_mod_settled_bus_day( &self, date: &NaiveDateTime, ) -> NaiveDateTime

Return the date, if a business day that can be settled, or get the preceding such date, without rolling into a new month.

Source

fn lag_bus_days( &self, date: &NaiveDateTime, days: i32, settlement: bool, ) -> NaiveDateTime

Adjust a date by a number of business days, under lag rules.

Note: if the number of business days is zero a non-business day will be rolled forwards.

Note: if the given date is a non-business date adding or subtracting 1 business day is equivalent to the rolling forwards or backwards, respectively.

Source

fn add_cal_days( &self, date: &NaiveDateTime, days: i32, adjuster: &Adjuster, ) -> NaiveDateTime
where Self: Sized,

Add a given number of calendar days to a date with the result adjusted to a business day that may or may not allow settlement.

Source

fn add_bus_days( &self, date: &NaiveDateTime, days: i32, settlement: bool, ) -> Result<NaiveDateTime, PyErr>

Add a given number of business days to a date with the result adjusted to a business day that may or may not allow settlement.

Note: When adding a positive number of business days the only sensible modifier is Modifier::F and when subtracting business days it is Modifier::P.

Source

fn bus_date_range( &self, start: &NaiveDateTime, end: &NaiveDateTime, ) -> Result<Vec<NaiveDateTime>, PyErr>

Return a vector of business dates between a start and end, inclusive.

Source

fn cal_date_range( &self, start: &NaiveDateTime, end: &NaiveDateTime, ) -> Result<Vec<NaiveDateTime>, PyErr>

Return a vector of calendar dates between a start and end, inclusive

Implementors§