pub enum Calendar {
WeekendsOnly,
Target,
UsNyse,
UkSettlement,
Custom {
holidays: BTreeSet<NaiveDate>,
},
}Expand description
A holiday calendar: weekends plus market-specific holidays.
Variants§
WeekendsOnly
Saturdays and Sundays only.
Target
TARGET (Trans-European Automated Real-time Gross settlement): the euro-area settlement calendar.
UsNyse
New York Stock Exchange trading calendar.
UkSettlement
England-and-Wales bank holidays (regular rules; one-off royal or millennium holidays are not modelled).
Custom
Weekends plus an explicit list of extra holidays.
Implementations§
Source§impl Calendar
impl Calendar
Sourcepub fn is_weekend(date: NaiveDate) -> bool
pub fn is_weekend(date: NaiveDate) -> bool
Saturday or Sunday.
Sourcepub fn is_holiday(&self, date: NaiveDate) -> bool
pub fn is_holiday(&self, date: NaiveDate) -> bool
A non-weekend holiday on this calendar.
Sourcepub fn is_business_day(&self, date: NaiveDate) -> bool
pub fn is_business_day(&self, date: NaiveDate) -> bool
Neither a weekend nor a holiday.
Sourcepub fn adjust(
&self,
date: NaiveDate,
convention: BusinessDayConvention,
) -> NaiveDate
pub fn adjust( &self, date: NaiveDate, convention: BusinessDayConvention, ) -> NaiveDate
Adjust a date to a business day under the given convention.
Sourcepub fn add_business_days(&self, date: NaiveDate, n: i64) -> NaiveDate
pub fn add_business_days(&self, date: NaiveDate, n: i64) -> NaiveDate
Move n business days (n may be negative). n = 0 returns the
date unchanged, even on a holiday. The classic settlement-lag
helper: calendar.add_business_days(trade_date, 2) is T+2.
Sourcepub fn advance(
&self,
date: NaiveDate,
period: Period,
convention: BusinessDayConvention,
) -> NaiveDate
pub fn advance( &self, date: NaiveDate, period: Period, convention: BusinessDayConvention, ) -> NaiveDate
Advance by a calendar period and adjust the result. Month/year arithmetic clamps to the end of month (Jan 31 + 1M = Feb 28/29) before adjustment.
Sourcepub fn business_days_between(&self, from: NaiveDate, to: NaiveDate) -> i64
pub fn business_days_between(&self, from: NaiveDate, to: NaiveDate) -> i64
Business days in the half-open interval (from, to]; negative when
to < from.