adjust (3) - Linux Manuals
adjust: calendar class
NAME
QuantLib::Calendar - calendar class
SYNOPSIS
#include <ql/time/calendar.hpp>
Inherited by Argentina, Australia, BespokeCalendar, Brazil, Canada, China, CzechRepublic, Denmark, Finland, Germany, HongKong, Hungary, Iceland, India, Indonesia, Italy, Japan, JointCalendar, Mexico, NewZealand, Norway, NullCalendar, Poland, SaudiArabia, Singapore, Slovakia, SouthAfrica, SouthKorea, Sweden, Switzerland, Taiwan, TARGET, Turkey, Ukraine, UnitedKingdom, and UnitedStates.
Classes
class Impl
abstract base class for calendar implementations
class OrthodoxImpl
partial calendar implementation
class WesternImpl
partial calendar implementation
Public Member Functions
Protected Attributes
boost::shared_ptr< Impl > impl_
Related Functions
(Note that these are not member functions.)bool operator== (const Calendar &, const Calendar &)
bool operator!= (const Calendar &, const Calendar &)
std::ostream & operator<< (std::ostream &, const Calendar &)
Calendar interface
bool empty () const
Returns whether or not the calendar is initialized.
std::string name () const
Returns the name of the calendar.
bool isBusinessDay (const Date &d) const
bool isHoliday (const Date &d) const
bool isWeekend (Weekday w) const
bool isEndOfMonth (const Date &d) const
Date endOfMonth (const Date &d) const
last business day of the month to which the given date belongs
void addHoliday (const Date &)
void removeHoliday (const Date &)
Date adjust (const Date &, BusinessDayConvention convention=Following) const
Date advance (const Date &, Integer n, TimeUnit unit, BusinessDayConvention convention=Following, bool endOfMonth=false) const
Date advance (const Date &date, const Period &period, BusinessDayConvention convention=Following, bool endOfMonth=false) const
BigInteger businessDaysBetween (const Date &from, const Date &to, bool includeFirst=true, bool includeLast=false) const
static std::vector< Date > holidayList (const Calendar &calendar, const Date &from, const Date &to, bool includeWeekEnds=false)
Returns the holidays between two dates.
Detailed Description
calendar class
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.
The Bridge pattern is used to provide the base behavior of the calendar, namely, to determine whether a date is a business day.
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.
Tests
- the methods for adding and removing holidays are tested by inspecting the calendar before and after their invocation.
Examples:
BermudanSwaption.cpp, Bonds.cpp, CallableBonds.cpp, CDS.cpp, ConvertibleBonds.cpp, DiscreteHedging.cpp, EquityOption.cpp, FittedBondCurve.cpp, FRA.cpp, Repo.cpp, and swapvaluation.cpp.
Constructor & Destructor Documentation
Calendar ()
The default constructor returns a calendar with a null implementation, which is therefore unusable except as a placeholder.
Member Function Documentation
std::string name () const
Returns the name of the calendar.
Warning
- This method is used for output and comparison between calendars. It is not meant to be used for writing switch-on-type code.
bool isBusinessDay (const Date & d) const
Returns true iff the date is a business day for the given market.
bool isHoliday (const Date & d) const
Returns true iff the date is a holiday for the given market.
bool isWeekend (Weekday w) const
Returns true iff the weekday is part of the weekend for the given market.
bool isEndOfMonth (const Date & d) const
Returns true iff the date is last business day for the month in given market.
void addHoliday (const Date &)
Adds a date to the set of holidays for the given calendar.
void removeHoliday (const Date &)
Removes a date from the set of holidays for the given calendar.
Date adjust (const Date &, BusinessDayConvention convention = Following) const
Adjusts a non-business day to the appropriate near business day with respect to the given convention.
Examples: Bonds.cpp, CDS.cpp, ConvertibleBonds.cpp, FittedBondCurve.cpp, and swapvaluation.cpp.
Date advance (const Date &, Integer n, TimeUnit unit, BusinessDayConvention convention = Following, bool endOfMonth = false) const
Advances the given date of the given number of business days and returns the result.
Note:
- The input date is not modified.
Examples: BermudanSwaption.cpp, Bonds.cpp, CallableBonds.cpp, ConvertibleBonds.cpp, FittedBondCurve.cpp, FRA.cpp, and swapvaluation.cpp.
Date advance (const Date & date, const Period & period, BusinessDayConvention convention = Following, bool endOfMonth = false) const
Advances the given date as specified by the given period and returns the result.
Note:
- The input date is not modified.
BigInteger businessDaysBetween (const Date & from, const Date & to, bool includeFirst = true, bool includeLast = false) const
Calculates the number of business days between two given dates and returns the result.
Friends And Related Function Documentation
bool operator== (const Calendar &, const Calendar &) [related]
Returns true iff the two calendars belong to the same derived class.
bool operator!= (const Calendar &, const Calendar &) [related]
std::ostream & operator<< (std::ostream &, const Calendar &) [related]
Author
Generated automatically by Doxygen for QuantLib from the source code.