Struct quantmath::dates::calendar::WeekdayAndHolidayCalendar [−][src]
pub struct WeekdayAndHolidayCalendar { /* fields omitted */ }
A calendar that assumes that Saturday and Sunday are not business days, together with a specified list of business holidays. In general this list is read from a file.
Methods
impl WeekdayAndHolidayCalendar
[src]
impl WeekdayAndHolidayCalendar
pub fn new(name: &str, holidays: &[Date]) -> WeekdayAndHolidayCalendar
[src]
pub fn new(name: &str, holidays: &[Date]) -> WeekdayAndHolidayCalendar
pub fn from_serial<'de>(de: &mut Deserializer<'de>) -> Result<RcCalendar, Error>
[src]
pub fn from_serial<'de>(de: &mut Deserializer<'de>) -> Result<RcCalendar, Error>
Trait Implementations
impl Debug for WeekdayAndHolidayCalendar
[src]
impl Debug for WeekdayAndHolidayCalendar
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl TypeId for WeekdayAndHolidayCalendar
[src]
impl TypeId for WeekdayAndHolidayCalendar
impl Calendar for WeekdayAndHolidayCalendar
[src]
impl Calendar for WeekdayAndHolidayCalendar
fn name(&self) -> &str
[src]
fn name(&self) -> &str
The name of this calendar. Conventionally, the name is a three-letter upper-case string such as "TGT" or "NYS", though this is not required. Read more
fn is_holiday(&self, date: Date) -> bool
[src]
fn is_holiday(&self, date: Date) -> bool
TODO: is_holiday is an expensive call for WeekendAndHolidayCalendar. We still need to implement it for external users, but we should avoid calling it internally.
fn count_business_days(
&self,
from: Date,
from_fraction: f64,
to: Date,
to_fraction: f64
) -> f64
[src]
fn count_business_days(
&self,
from: Date,
from_fraction: f64,
to: Date,
to_fraction: f64
) -> f64
Count business days between the two given dates. The dates at the ends of the range may optionally be partly included in the count, by setting a fraction between zero and one. Read more
fn step(&self, from: Date, step: i32, slip_forward: bool) -> Date
[src]
fn step(&self, from: Date, step: i32, slip_forward: bool) -> Date
Step forward/backward by the given number of business days. The result is always a business day. If today is a business day, a zero step means staying where we are. If today is not a business day, we slip off to the nearest business day in the direction specified by the slip_forward flag. If the step is non-zero, the overall move is equivalent to a zero step followed by the given number of one-step moves. Read more
fn standard_basis(&self) -> f64
[src]
fn standard_basis(&self) -> f64
Returns the basis normally used for business day volatility. Roughly speaking this is the expected number of business days in a year, but conventionalised. It is 365 for EveryDayCalendar and 252 for a pure business day calendar. Read more
fn day_weight(&self, date: Date) -> f64
[src]
fn day_weight(&self, date: Date) -> f64
If the given date is a holiday, what weight should it receive? Returns 1.0 for a business day, 0.0 for a pure holiday with no weight, and potentially a number somewhere between for anything else. Read more
fn step_partial(&self, from: Date, step: f64, slip_forward: bool) -> Date
[src]
fn step_partial(&self, from: Date, step: f64, slip_forward: bool) -> Date
Specialised function where day-counts may be fractional, for example in volatility surfaces. For most calendars, the step is truncated towards zero and an integer number of steps is taken. Read more
fn year_fraction(&self, from: DateDayFraction, to: DateDayFraction) -> f64
[src]
fn year_fraction(&self, from: DateDayFraction, to: DateDayFraction) -> f64
Calculate the year-fraction between two date-times, given the count of business days and the standard basis. Read more
Auto Trait Implementations
impl Send for WeekdayAndHolidayCalendar
impl Send for WeekdayAndHolidayCalendar
impl Sync for WeekdayAndHolidayCalendar
impl Sync for WeekdayAndHolidayCalendar