Class implements calendar object. More...

#include <calendar.hpp>

Public Member Functions

 Calendar ()
 Constructor. More...
 
 Calendar (DayRollingConvention, int, const std::vector< Date > &, const std::vector< Date > &, const std::vector< SmartPointer< Holiday > > &, bool end_of_month, const SmartPointer< SettlementDateConvention > &)
 Constructor. More...
 
bool isBusinessDay (const Date &) const
 Method returns true if a given date is business day and false otherwise. More...
 
bool isHoliday (const Date &) const
 Method returns true if a given date is holiday and false otherwise. More...
 
bool isWeekend (const Date &) const
 Method returns true if a given date is a Saturday or Sunday and false otherwise. More...
 
Date adjust (const Date &) const
 Method adjusts a date according to a given day rolling convention. More...
 
int businessDaysBetween (const Date &, const Date &) const
 Method returns number of business days between date1 and date2. More...
 
int numberOfHolidaysBetween (const Date &, const Date &) const
 Method returns number of holidays between date1 and date2. More...
 
Date workingDays (const Date &, int) const
 Method returns nth working day from a given date. More...
 
Date getSpot (const Date &) const
 Method returns spot date for a given date. More...
 
Date getON (const Date &) const
 Method returns next working day of a calendar's date. More...
 
Date getTN (const Date &) const
 Method returns second working day from a calendar's date. More...
 
Date expiryDate (const Date &d, const Tenor &t) const
 
Date settlementDate (const Date &d, const Tenor &t) const
 Calculates settlement date. More...
 
int getSpotLag () const
 
bool isEndOfMonth (const Date &) const
 
Date getLastWorkingDateOfMonth (const Date &) const
 

Private Member Functions

template<class Archive >
void serialize (Archive &ar, const unsigned int)
 interface used by Boost serialization library More...
 

Private Attributes

int spot_lag_
 This integer define how many working days is between today date and spot date. More...
 
DayRollingConvention day_rolling_convention_
 Variable defines the day rolling convention. More...
 
bool end_of_month_
 Boolean variable defining if end of month convention is applied. More...
 
std::vector< Datebusiness_days_
 Vector of dates that are recognized as working dates. More...
 
std::vector< Dateholidays_dates_
 Vector of dates that are recognized as holidays. More...
 
std::vector< SmartPointer< Holiday > > holidays_
 Vector of holidays objects (see Holiday). More...
 
SmartPointer< SettlementDateConventionsettlement_
 This variable holds object defining settlement date convention. More...
 

Friends

class boost::serialization::access
 
std::ostream & operator<< (std::ostream &, Calendar &)
 

Detailed Description

Class implements calendar object.

This class provides methods for determining whether a date is a business day or a holiday. It also allows to increment or decrement a date of a given number of business days or by a given tenor. The calendar also provides methods for calculating number of working days/holidays between two dates.

Examples:
algebraicBootstrapperExample.cpp, bondsExample.cpp, bootstrapperComparison.cpp, constrainedBootstrapperExample.cpp, DatesAndCalendarExample.cpp, DepositExample.cpp, optionPricingExample.cpp, rootFindingBootstrapperExample.cpp, and unconstrainedBootstrapperExample.cpp.

Constructor & Destructor Documentation

julian::Calendar::Calendar ( )

Constructor.

Constructor creating calendar object on the basis of given date, day rolling convention and spot lag. Also three vectors that are used in process of establishing whether a day is business day are provided.

julian::Calendar::Calendar ( DayRollingConvention  day_rolling_convention,
int  spot_lag,
const std::vector< Date > &  business_days,
const std::vector< Date > &  holidays_dates,
const std::vector< SmartPointer< Holiday > > &  holidays,
bool  end_of_month,
const SmartPointer< SettlementDateConvention > &  settlement 
)

Constructor.

Constructor creating calendar object on the basis of given date, day rolling convention and spot lag. Also three vectors that are used in process of establishing whether a day is business day are provided.

Member Function Documentation

Date julian::Calendar::adjust ( const Date date) const

Method adjusts a date according to a given day rolling convention.

int julian::Calendar::businessDaysBetween ( const Date date1,
const Date date2 
) const

Method returns number of business days between date1 and date2.

Date julian::Calendar::expiryDate ( const Date date,
const Tenor t 
) const

Method returns expiry date for a given start date and tenor. The calculation is performed according to settlement day convention provided is calendar construction process.

Warning
Expiry date can not be calculated for tenor like Spot Overnight, Tomorrow Next and Today.
Date julian::Calendar::getLastWorkingDateOfMonth ( const Date d) const

Method calculates the last working date of the month.

Date julian::Calendar::getON ( const Date d) const

Method returns next working day of a calendar's date.

Date julian::Calendar::getSpot ( const Date aDate) const

Method returns spot date for a given date.

int julian::Calendar::getSpotLag ( ) const

Returns spot lag

Date julian::Calendar::getTN ( const Date d) const

Method returns second working day from a calendar's date.

bool julian::Calendar::isBusinessDay ( const Date input) const

Method returns true if a given date is business day and false otherwise.

bool julian::Calendar::isEndOfMonth ( const Date d) const

Method returns true if the given date is the last working day of month.

bool julian::Calendar::isHoliday ( const Date input) const

Method returns true if a given date is holiday and false otherwise.

Firstly method checks if date is listed in set of holidays vector. Secondly method check if date is listed in set of business day vector.

Lastly it checks if date is holiday according to given Holiday objects.

bool julian::Calendar::isWeekend ( const Date date) const

Method returns true if a given date is a Saturday or Sunday and false otherwise.

int julian::Calendar::numberOfHolidaysBetween ( const Date date1,
const Date date2 
) const

Method returns number of holidays between date1 and date2.

template<class Archive >
void julian::Calendar::serialize ( Archive &  ar,
const unsigned  int 
)
inlineprivate

interface used by Boost serialization library

Date julian::Calendar::settlementDate ( const Date d,
const Tenor t 
) const

Calculates settlement date.

Method returns settlement date for a given start date and tenor. The calculation is performed according to settlement day convention provided is calendar construction process.

Date julian::Calendar::workingDays ( const Date date,
int  n 
) const

Method returns nth working day from a given date.

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  s,
Calendar c 
)
friend

This is overloading of std::cout<< operator that allows to print object's informations on console.

Member Data Documentation

std::vector<Date> julian::Calendar::business_days_
private

Vector of dates that are recognized as working dates.

DayRollingConvention julian::Calendar::day_rolling_convention_
private

Variable defines the day rolling convention.

bool julian::Calendar::end_of_month_
private

Boolean variable defining if end of month convention is applied.

std::vector<SmartPointer<Holiday> > julian::Calendar::holidays_
private

Vector of holidays objects (see Holiday).

std::vector<Date> julian::Calendar::holidays_dates_
private

Vector of dates that are recognized as holidays.

SmartPointer<SettlementDateConvention> julian::Calendar::settlement_
private

This variable holds object defining settlement date convention.

int julian::Calendar::spot_lag_
private

This integer define how many working days is between today date and spot date.


The documentation for this class was generated from the following files:
  • C:/Unix/home/OEM/jULIAN/src/dates/calendars/calendar.hpp
  • C:/Unix/home/OEM/jULIAN/src/dates/calendars/calendar.cpp