quantlib.time.calendar.Calendar¶
- class Calendar¶
Bases:
object
This class provides methods for determining whether a date is a business day or a holiday for a given market, and for incrementing/decrementing a date of a given number of business days.
A calendar should be defined for specific exchange holiday schedule or for general country holiday schedule. Legacy city holiday schedule calendars will be moved to the exchange/country convention.
- __init__()¶
Methods
__init__
()add_holiday
(self, Date holiday)Adds a date to the set of holidays for the given calendar.
adjust
(self, Date given_date, ...)Adjusts a non-business day to the appropriate near business day with respect to the given convention.
advance
(self, Date given_date, int step=0, ...)Advances the given date of the given number of business days, or period and returns the result.
business_day_list
(self, Date from_date, ...)Returns the business days between two dates.
business_days_between
(self, Date date1, ...)Returns the number of business days between date1 and date2.
end_of_month
(self, Date current_date)Returns the ending date for the month that contains the given date.
holiday_list
(self, Date from_date, ...)Returns the holidays between two dates.
is_business_day
(self, Date test_date)Returns true iff the date is a business day for the given market.
is_end_of_month
(self, Date test_date)Is this date the last business day of the month to which the given date belongs
is_holiday
(self, Date test_date)Returns true iff the weekday is part of the weekend for the given market.
is_weekend
(self, int week_day)Returns true iff the date is last business day for the month in given market.
remove_holiday
(self, Date holiday)Removes a date from the set of holidays for the given calendar.
Attributes
name
- add_holiday(self, Date holiday)¶
Adds a date to the set of holidays for the given calendar.
- adjust(self, Date given_date, int convention=Following)¶
Adjusts a non-business day to the appropriate near business day with respect to the given convention.
- advance(self, Date given_date, int step=0, int units=-1, Period period=None, int convention=Following, end_of_month=False)¶
Advances the given date of the given number of business days, or period and returns the result.
You must provide either a step and unit or a Period.
- business_day_list(self, Date from_date, Date to_date)¶
Returns the business days between two dates.
- business_days_between(self, Date date1, Date date2, include_first=True, include_last=False)¶
Returns the number of business days between date1 and date2.
- end_of_month(self, Date current_date)¶
Returns the ending date for the month that contains the given date.
- holiday_list(self, Date from_date, Date to_date, bool include_weekends=False)¶
Returns the holidays between two dates.
- is_business_day(self, Date test_date)¶
Returns true iff the date is a business day for the given market.
- is_end_of_month(self, Date test_date)¶
Is this date the last business day of the month to which the given date belongs
- is_holiday(self, Date test_date)¶
Returns true iff the weekday is part of the weekend for the given market.
- is_weekend(self, int week_day)¶
Returns true iff the date is last business day for the month in given market.
- remove_holiday(self, Date holiday)¶
Removes a date from the set of holidays for the given calendar.