Date Generation Functions

Formulas & Technical Details

Description of Supported Business Day Conventions

Non End-of-Month Conventions

When generating a sequence of dates (for example, when generating the coupon payment dates for a swap or a bond), it may be necessary to adjust the dates for weekends and holidays.  Weekends can be defined to include Saturdays and Sundays, or just Sundays.  Several adjustment methods are provided.

Business Day Convention

Description

no date adjustment

Dates are not adjusted.

next good business day

If a date falls on a weekend or a holiday, the next good business day is used.

previous good business day

If a date falls on a weekend or a holiday, the previous good business day is used.

modified following business day

If a date falls on a weekend or a holiday, the next good business day is used.  If the next good business day falls in the next month, the previous good business day is used.

End-of-Month Conventions

When generating a sequence of dates, there are different conventions regarding how dates are generated at the end of the month.  The preceding non end-of-month conventions will generate cash flow dates that fall on the same day of the month, and then possibly adjust the date to a business day.  End-of-month conventions will generate dates in the same way, except when the base date (or cycle date) falls on the last day of the month.  In this case, the end-of-month convention will generate subsequent cash flow dates that fall on the last day of each cash flow month (and then possibly adjust to a business day.  For example, suppose today is 28-Feb-1995 (the last day of February) and suppose we would like to generate a date 6 months from this date.  This generated date is ambiguous as both 28-Aug-1995 and 31-Aug-1995 seem reasonable.  The preceding non-end-of month business day conventions will generate the 28th of August (and then possibly adjust to a business day) while the end-of-month business day conventions will generate the 31st of August (and then possibly adjust to a business day).  The end-of-month adjustment methods provided are:

Business Day Convention

Description

end of month – no date adjustment

Dates are generated according to the end-of-month rule described above.  Generated dates are not adjusted for business days.

end of month – next good business day

Dates are generated according to the end-of-month rule described above.  If a generated date falls on a weekend or a holiday, the next good business day is used.

end of month – previous good business day

Dates are generated according to the end-of-month rule described above.  If a generated date falls on a weekend or a holiday, the previous good business day is used.

end of month – modified following business day

Dates are generated according to the end-of-month rule described above.  If a generated date falls on a weekend or a holiday, the next good business day is used.  If the next good business day falls in the next month, the previous good business day is used.

end of month – ignore leap years

Dates are generated according to the end of month rule described above.  Generated dates are not adjusted for business days.  In a leap year, the end of month for February will be February 28. 

Third Wednesday Conventions

Two other date adjustment methods are provided, both relating to exchange traded contracts where trading stops two business days prior to the third Wednesday of the month, or on the third Wednesday of the month.

Business Day Convention

Description

two business days prior to third Wednesday

For annual, semi-annual, quarterly, or monthly frequencies, generated dates are adjusted to fall 2 business days prior to the third Wednesday of the month.  For all other frequencies, dates are generated as usual, with no adjustment for weekends or holidays.  Note: The maturity date is not adjusted.

third Wednesday

For annual, semi-annual, quarterly, or monthly frequencies, generated dates are adjusted to fall on the third Wednesday of the month.  For all other frequencies, dates are generated as usual, with no adjustment for weekends or holidays.  Note: The maturity date is not adjusted.

Odd First and/or Last Coupon Periods

For bonds (and swaps), the coupon payment dates generally follow a regular payment schedule (e.g. every 6 months).  If there is any irregularity, generally, it is either an odd first coupon period and / or an odd last coupon period.

Case 1 – no odd coupons:

In this case d_l_cpn = d_f_cpn  = 0.  If d_e is prior to d_s, it is ignored.  Note that if d_e < d_s, d_e can be set to 0, in which case the function will calculate the previous regular coupon date.

Case 2 – odd first coupon:

In this case d_l_cpn = 0, d_e < d_f_cpn < d_t.  By assumption, d_f_cpn and d_t will be on the same cycle (e.g. if the frequency is semi-annual, d_t = 20-Aug-2005 and d_f_cpn = 20-Feb-2000 would be acceptable but d_f_cpn = 2-Jan-1999 would produce an error).  Note that if d_f_cpn < d_s, the odd first coupon period has passed and it no longer has any relevance to future cash flows.

Case 3 – odd last coupon:

In this case d_f_cpn = 0, d_e < d_l_cpn < d_t.  Note that by assumption, d_l_cpn and d_e will be on the same cycle (e.g. if the frequency is annual, d_l_cpn = 20-Aug-2005 and d_e = 20-Aug-2000 would be acceptable).

Case 4 – odd first and odd last coupons:

In this case, d_e < d_f_cpn < d_l_cpn < d_t.  Note that by assumption, d_l_cpn and d_f_cpn will be on the same cycle (e.g. if the frequency is annual, d_l_cpn = 20-Aug-2005 and d_e = 20-Aug-2000 would be acceptable).

FINCAD Functions

The first class of functions generates a date which is a specified number of adjustment units (days, weeks, months, etc.) forward or backwards from a given base date.

The most general functions are:

aaDateAdjust2(d_to_adj, num_units, adj_units, d_rul, weekend, hl)

Adjusts a base date a specified number of market days, calendar days, weeks, months, years, Mondays, … Sundays.  Weekends can be defined to include Saturdays and Sundays, or Sundays only.

 

aaDateAdjust(d_to_adj, num_units, adj_units, d_rul, hl)

Adjusts a base date a specified number of market days, calendar days, weeks, months, years, Mondays, … Sundays.

 

Other functions are:

aaMaturity_date2(d_to_adj, jump_by, jump_fwd, d_rul, hl)

Adjusts a base date a specified number of days or months using the specified business day convention.

 

aaDateSettle(d_to_adj, days_adj, hl)

Adjusts a base date by a specified number of business days.

 

The second type of function generates tables of dates.  The most general functions are:

aaDateGen2(d_s, d_t, d_e, d_f_cpn, d_l_cpn, freq, hl, d_rul, weekend, table_type)

Generates a one or two column table of dates (for example bond or swap coupon dates).  Weekends can be defined to include Saturdays and Sundays, or Sundays only.  The sequence may have odd first and / or odd last periods, and the frequency may be annual, semi-annual, quarterly, monthly, biweekly, weekly, 35 day, 28 day, 21 day, 42 day, market days, calendar days.

 

aaDateGen(d_s, d_t, d_e, d_f_cpn, d_l_cpn, freq, hl, d_rul, table_type)

Generates a one or two column table of dates (for example bond or swap coupon dates).  The sequence may have odd first or / and odd last periods, and the frequency may be annual, semi-annual, quarterly, monthly, biweekly, weekly, 35 day, 28 day, 21 day, 42 day.

 

aaDateGen_daily(d_e, d_t, freq, hl, table_type)

Generates a one (or two) column table of market of calendar dates.

 

aaSamplingDates2(sam_freq, d_exp, d_e, hl)

Generates the sampling dates for a given frequency.  This function exposes the internal sampling dates used in many path dependent option functions (e.g. Super Asian option).

 

aaSamplingDates(sam_freq, d_exp, d_aver)

Generates the sampling dates for a given frequency.  This function exposes the internal sampling dates used in many path dependent option functions (e.g. Asian, discrete lookback, average strike, double average).

 

aaDates1(d_e, d_t, freq, hl, orientation, d_rul, odd, d_dir)

Generates a one column date list using a specified frequency and business day convention.

 

aaDates2(d_e, d_t, freq, hl, orientation, d_rul, odd, d_dir)

Generates a two column date list using a specified frequency and business day convention.

 

Description of Inputs

Input Argument

Description

d_to_adj

date to be adjusted

num_units

number of units to adjust the base date by

adj_units

date adjustment method

d_rul

business day convention

weekend

weekend definition

hl

holiday list

jump_by

adjust by days or months

jump_fwd

adjustment period

days_adj

number of days to adjust the base date

d_s

settlement date

d_t

terminating date

d_e

effective date

d_f_cpn

date of first coupon.  This is an optional argument and a value of 0 means that it will be ignored.  A date should only be entered if the structure has an odd first coupon period.  If d_f_cpn < d_s, the odd coupon period has expired and this input has no effect.

d_l_cpn

date of last coupon.  This is an optional argument and a value of 0 means that it will be ignored.  A date should only be entered if the structure has an odd last coupon period.

freq

cash flow frequency

table_type

output table selection

sam_freq

sampling frequency

d_exp

expiry date

d_aver

date when averaging starts

orientation

orientation of output table

odd

odd date list

d_dir

direction for date generation

 

Description of Outputs

aaDateAdjust and aaDateAdjust2

Output

Description

d_adj

date adjusted for weekends and holidays

aaMaturity_date2 and aaDateSettle

Output

Description

d_adj

date adjusted for business day convention

aaDateGen, aaDateGen2, aaDateGen_daily, and aaDates2

Output

Description

d_tbl

date table - two column - effective date, terminating date

aaSamplingDates, aaSamplingDates2 and aaDates1

Output

Description

d_list

date list - one column

 

Examples

Example 1

Using the function aaDateGen2() (with adjustment to the next good business day).

aaDateGen2

Argument

Description

Example Data

Switch

d_s

settlement date

1-Jun-1990

 

d_t

terminating date

30-Nov-1996

 

d_e

effective date

1-Apr-1988

 

d_f_cpn

date of first coupon

20-Feb-1991

 

d_l_cpn

date of last coupon

20-Feb-1995

 

freq

cash flow frequency

1

annual

hl

holiday list

0

 

d_rul

business day convention

2

next business day

weekend

weekend definition

1

Sat. and Sun.

table_type

output table type

2

2 column

Results

Output 

1-Apr-1988 Fri

20-Feb-1991 Wed

odd first

20-Feb-1991 Wed

20-Feb-1992 Thu

 

20-Feb-1992 Thu

22-Feb-1993 Mon

 

22-Feb-1993 Mon

21-Feb-1994 Mon

 

21-Feb-1994 Mon

20-Feb-1995 Mon

 

20-Feb-1995 Mon

2-Dec-1996 Mon

odd last

 

Example 2

Using the function aaDateGen2() (with adjustment to the third Wednesday).

aaDateGen2

Argument

Description

Example Data

Switch

d_s

settlement date

24-Sep-2003

 

d_t

terminating date

12-Jan-2006

 

d_e

effective date

2-May-2003

 

d_f_cpn

date of first coupon

 

 

d_l_cpn

date of last coupon

 

 

freq

cash flow frequency

3

quarterly

hl

holiday list

0

 

d_rul

business day convention

10

3rd Wed.

weekend

weekend definition

1

Sat. and Sun.

table_type

output table type

2

2 column

Results

Output 

16-Jul-2003 Wed

15-Oct-2003 Wed

15-Oct-2003 Wed

21-Jan-2004 Wed

21-Jan-2004 Wed

21-Apr-2004 Wed

21-Apr-2004 Wed

21-Jul-2004 Wed

21-Jul-2004 Wed

20-Oct-2004 Wed

20-Oct-2004 Wed

19-Jan-2005 Wed

19-Jan-2005 Wed

20-Apr-2005 Wed

20-Apr-2005 Wed

20-Jul-2005 Wed

20-Jul-2005 Wed

19-Oct-2005 Wed

19-Oct-2005 Wed

12-Jan-2006 Thu

 

*       Note:  Maturity date is not adjusted to a Wednesday

 

Example 3

Using the function aaDateGen2() to generate Market days (where Saturday is a market day)

aaDateGen2

Argument

Description

Example Data

Switch

d_s

settlement date

8-Jan-2003

 

d_t

terminating date

20-Jan-2003

 

d_e

effective date

1-Jan-2003

 

d_f_cpn

date of first coupon

 

 

d_l_cpn

date of last coupon

 

 

freq

cash flow frequency

11

market days

hl

holiday list

0

 

d_rul

business day convention

1

no adjustment

weekend

weekend definition

2

Sun. only

table_type

output table type

2

2 column

Results

Output

08-Jan-2003 Wed

09-Jan-2003 Thu

09-Jan20-03 Thu

10-Jan-2003 Fri

10-Jan-2003 Fri

11-Jan-2003 Sat

11-Jan-2003 Sat

13-Jan-2003 Mon

13-Jan-2003 Mon

14-Jan-2003 Tue

14-Jan-2003 Tue

15-Jan-2003 Wed

15-Jan20-03 Wed

16-Jan-2003 Thu

16-Jan-2003 Thu

17-Jan-2003 Fri

17-Jan-2003 Fri

18-Jan-2003 Sat

18-Jan-2003 Sat

20-Jan-2003 Mon

 

 

Disclaimer

 

With respect to this document, FinancialCAD Corporation (“FINCAD”) makes no warranty either express or implied, including, but not limited to, any implied warranty of merchantability or fitness for a particular purpose. In no event shall FINCAD be liable to anyone for special, collateral, incidental, or consequential damages in connection with or arising out of the use of this document or the information contained in it. This document should not be relied on as a substitute for your own independent research or the advice of your professional financial, accounting or other advisors.

 

This information is subject to change without notice. FINCAD assumes no responsibility for any errors in this document or their consequences and reserves the right to make changes to this document without notice.

 

Copyright

 

Copyright © FinancialCAD Corporation 2008. All rights reserved.