Calendars and Day Counters in the Finance Package

Overview


The Financial Modeling package supports over 15 calendars which include New York, London, Tokyo and Toronto stock exchanges. In addition, the package provides tools for creating new calendars and manipulating already existing calendars. In addition to this, the Financial Modeling package supports most standard day count conventions used in the industry, which include Actual/Actual, Actual/360 and 30/360 conventions.
Day counting convention defines the way in which interest accrues over time. Generally, we know the interest earned over some reference period (e.g., the time between coupon payments, and we are interested in calculating the interest earned over some other period.
The day counting convention is usually expressed as $\mathit{X}\mathbf{\/}\mathit{Y}$, where $\mathit{X}$ defines the way in which the number of days between the two dates is calculated, and $\mathit{Y}$ defines the way in which the total number of days in the reference period is measured. The interest earned between the two dates is
$\frac{\mathit{Number\_of\_days\_between\_two\_dates}}{\mathit{Number\_of\_days\_in\_reference\_period}}\mathbf{\times}{\mathit{Interest}}_{}\mathit{\_earned\_in\_reference\_period}$
Three day counting conventions commonly used in the United States are Actual/Actual, Actual/360, and 30/360.


Day Count Conventions



Actual/Actual Conventions


The actual/actual interest accrual convention is the recommended for eurodenominated bonds, there are at least three different interpretations of actual/actual. These three interpretations are identified as:
Actual/Actual (ISDA)
Actual/Actual (ISMA)
Actual/Actual (AFB)
The difference between the ISDA, ISMA and AFB methods can be reduced to a consideration of the denominator to be used when calculating accrued interest. The numerator will, in all three cases, be equal to the actual number of days from and including the last coupon payment date ( or period end date) to, but excluding, the current value date (or period end date) therefore:
Under the Actual/Actual (ISDA) approach, the denominator varies depending on whether a portion of the relevant calculation period falls within a leap year. For the portion of the calculation period falling within a leap year, the denominator is 366, for the other portion the denominator is 365. The ISDA convention, also known as Actual/Actual (Historical), Actual/Actual, Act/Act, and according to ISDA also Actual/365, Act/365, and A/365.
Under the Actual/Actual (ISMA) approach, the denominator is the actual number of days in the coupon period multiplied by the number of coupon periods in the year. The ISMA and US Treasury convention, also known as Actual/Actual (Bond).
Under the Actual/Actual (AFB) approach, the denominator is either 365 if the calculation period does not contain February 29th, or 366 if the calculation period includes February 29th. The AFB convention, also known as actual/actual (Euro).
Let's consider some examples.
>

$\mathrm{with}\left(\mathrm{Finance}\right)\:$

First we will use a day counter which follows the ISDA convention.
>

$\mathrm{DayCount}\left(''Jan012006''\,''July012006''\,\mathrm{ISDA}\right)$

The numerator is equal to the actual number of days from and including the last coupon payment date ( or period end date) to, but excluding, the current value date (or period end date) therefore from January 1st, 2006 to July 1st, 2006 can be calculated by adding the number of days in January, February, March, April, May, and June together:
>

$31\+28\+31\+30\+31\+30$

>

$\mathrm{YearFraction}\left(''Jan012006''\,''July012006''\,\mathrm{ISDA}\right)$

The denominator for ISDA is 365 since the year of 2006 is not leap year:
>

$\frac{\mathrm{DayCount}\left(''Jan012006''\,''July012006''\,\mathrm{ISDA}\right)}{365}$

$\frac{{181}}{{365}}$
 (2.1.4) 
>

$\mathrm{evalf}\left(\right)$

>

$\mathrm{DayCount}\left(''Jan012008''\,''April202008''\,\mathrm{ISDA}\right)$

>

$\mathrm{YearFraction}\left(''Jan012008''\,''April202008''\,\mathrm{ISDA}\right)$

>

$\frac{\mathrm{DayCount}\left(''Jan012008''\,''April202008''\,\mathrm{ISDA}\right)}{366}$

$\frac{{55}}{{183}}$
 (2.1.8) 
>

$\mathrm{evalf}\left(\right)$

>

$\mathrm{DayCount}\left(''April202008''\,''Jan012009''\,\mathrm{ISDA}\right)$

>

$\mathrm{YearFraction}\left(''April202008''\,''Jan012009''\,\mathrm{ISDA}\right)$

${0.6994535519}$
 (2.1.11) 
>

$\frac{\mathrm{DayCount}\left(''April202008''\,''Jan012009''\,\mathrm{ISDA}\right)}{366}$

$\frac{{128}}{{183}}$
 (2.1.12) 
>

$\mathrm{evalf}\left(\right)$

${0.6994535519}$
 (2.1.13) 
In the second example we will use the ISMA convention.
>

$\mathrm{DayCount}\left(''Jan012006''\,''July012006''\,\mathrm{ISMA}\right)$

As you can see the number of days between January 1st, 2006 and July 1st, 2006 is the same according to both conventions. The length of the period from January 1st, 2006 to July 1st, 2006 as a fraction of the year is different.
>

$\mathrm{YearFraction}\left(''Jan012006''\,''July012006''\,\mathrm{ISMA}\right)$

${0.5000000000}$
 (2.1.15) 
The denominator is the actual number of days in the coupon period multiplied by the number of coupon periods in the year.
>

$\mathrm{DayCount}\left(''Jan012008''\,''April202008''\,\mathrm{ISMA}\right)$

>

$\mathrm{YearFraction}\left(''Jan012008''\,''April202008''\,\mathrm{ISMA}\right)$

${0.3333333333}$
 (2.1.17) 
>

$\mathrm{DayCount}\left(''Jan012008''\,''April012008''\,\mathrm{ISMA}\right)$

>

$\mathrm{YearFraction}\left(''Jan012008''\,''April012008''\,\mathrm{ISMA}\right)$

${0.2500000000}$
 (2.1.19) 
Finally, consider the AFB day counting convention.
>

$\mathrm{DayCount}\left(''Jan012006''\,''July012006''\,\mathrm{AFB}\right)$

>

$\mathrm{YearFraction}\left(''Jan012006''\,''July012006''\,\mathrm{AFB}\right)$

${0.4958904110}$
 (2.1.21) 
The denominator is either 365 if the calculation period does not contain February 29th, or 366 if the calculation period includes February 29th.
>

$\frac{\mathrm{DayCount}\left(''Jan012006''\,''July012006''\,\mathrm{AFB}\right)}{365}$

$\frac{{181}}{{365}}$
 (2.1.22) 
>

$\mathrm{evalf}\left(\right)$

${0.4958904110}$
 (2.1.23) 
>

$\mathrm{DayCount}\left(''Jan012008''\,''April202008''\,\mathrm{AFB}\right)$

>

$\mathrm{YearFraction}\left(''Jan012008''\,''April202008''\,\mathrm{AFB}\right)$

${0.3005464481}$
 (2.1.25) 
>

$\frac{\mathrm{DayCount}\left(''Jan012008''\,''April202008''\,\mathrm{AFB}\right)}{366}$

$\frac{{55}}{{183}}$
 (2.1.26) 
>

$\mathrm{evalf}\left(\right)$

${0.3005464481}$
 (2.1.27) 
>

$\mathrm{DayCount}\left(''April202008''\,''Jan012009''\,\mathrm{AFB}\right)$

>

$\mathrm{YearFraction}\left(''April202008''\,''Jan012009''\,\mathrm{AFB}\right)$

${0.7013698630}$
 (2.1.29) 
>

$\frac{\mathrm{DayCount}\left(''April202008''\,''Jan012009''\,\mathrm{AFB}\right)}{366}$

$\frac{{128}}{{183}}$
 (2.1.30) 
>

$\mathrm{evalf}\left(\right)$

${0.6994535519}$
 (2.1.31) 
>

$\frac{\mathrm{DayCount}\left(''April202008''\,''Jan012009''\,\mathrm{AFB}\right)}{365}$

$\frac{{256}}{{365}}$
 (2.1.32) 
>

$\mathrm{evalf}\left(\right)$

${0.7013698630}$
 (2.1.33) 


Actual/360 Conventions


Actual/360 is used for U.S. Treasury bills and other money market instruments. The numerator is equal to the actual number of days from and including the last coupon payment date ( or period end date) to, but excluding, the current value date (or period end date) ; while the denominator is always 360. Note that the interest earned in a whole year of 365 is 365/360 times the quoted rate. The actual/360 day count convention, also known as Act/360 or A/360.
The numerator is equal to the actual number of days from and including the last coupon payment date ( or period end date) to, but excluding, the current value date (or period end date).
>

$\mathrm{DayCount}\left(''Jan012006''\,''Jan032007''\,\mathrm{Actual360}\right)$

>

$\mathrm{YearFraction}\left(''Jan012006''\,''Nov012006''\,\mathrm{Actual360}\right)$

The denominator is always 360.
>

$\frac{\mathrm{DayCount}\left(''Jan012006''\,''Jan032007''\,\mathrm{Actual360}\right)}{\mathit{360}}$

$\frac{{367}}{{360}}$
 (2.2.3) 
>

$\mathrm{evalf}\left(\right)$

>

$\mathrm{DayCount}\left(''Jan012006''\,''Jan012007''\,\mathrm{Actual360}\right)$

>

$\mathrm{YearFraction}\left(''Jan012006''\,''Jan012007''\,\mathrm{Actual360}\right)$

>

$\frac{\mathrm{DayCount}\left(''Jan012006''\,''Jan012007''\,\mathrm{Actual360}\right)}{360}$

$\frac{{73}}{{72}}$
 (2.2.7) 
>

$\mathrm{evalf}\left(\right)$

There is an another day count convention, Actual/365 (Fixed), which is very similar with Actual/360, except that the denominator is always 365. Actual/365 (Fixed) day count convention, also know as Act/365 (Fixed), A/365 (Fixed), or A/365F. But Actual/365 (without Fixed) is an alias for Actual/Actual (ISDA).
>

$\mathrm{DayCount}\left(''Jan012008''\,''Jan012009''\,\mathrm{Actual365Fixed}\right)$

>

$\mathrm{YearFraction}\left(''Jan012008''\,''Jan012009''\,\mathrm{Actual365Fixed}\right)$

>

$\frac{\mathrm{DayCount}\left(''Jan012008''\,''Jan012009''\,\mathrm{Actual365Fixed}\right)}{365}$

$\frac{{366}}{{365}}$
 (2.2.11) 
>

$\mathrm{evalf}\left(\right)$



30/360 Conventions


The use of 30/360 for corporate and municipal bonds indicates that we assume 30 days per month and 360 days per year when we carry out calculations. This convention is very simple since it doesn't need to consider how many days each month has or whether the year is leap or not. There are three 30/360 day count conventions:
Thirty360USA

If the ending date is the 31th of a month and the starting date is earlier than the 30th of a month, the ending date becomes equal to the 1st of the next month day, otherwise the ending date becomes equal to the 30th of the same month.

Thirty360European

Starting dates or ending dates that occur on the 31st of a month become equal to the 30th of the same month.

Thirty360Italian

Starting or ending dates that occur in February and are greater than 27 become equal to 30 for computational sake.



Let's consider some examples:
>

$\mathrm{DayCount}\left(''Jan012006''\,''Nov012006''\,\mathrm{Thirty360USA}\right)$

The numerator is 10 time of 30.
If the end day is October 31st, 2006, it returns the same results:
>

$\mathrm{DayCount}\left(''Jan012006''\,''Oct312006''\,\mathrm{Thirty360USA}\right)$

>

$\mathrm{DayCount}\left(''Jan012006''\,''Oct302006''\,\mathrm{Thirty360USA}\right)$

>

$\mathrm{DayCount}\left(''Jan012006''\,''Oct22006''\,\mathrm{Thirty360USA}\right)$

From the above three interesting results, you can see that if the ending date is the 31th of a month and the starting date is earlier than the 30th of a month, the ending date becomes equal to the 1st of the next month day, otherwise the ending date becomes equal to the 30th of the same month.
For Thirty360European convention, starting dates or ending dates that occur on the 31st of a month become equal to the 30th of the same month.
>

$\mathrm{DayCount}\left(''Jan012006''\,''Nov012006''\,\mathrm{Thirty360European}\right)$

>

$\mathrm{DayCount}\left(''Jan012006''\,''Oct312006''\,\mathrm{Thirty360European}\right)$

>

$\mathrm{DayCount}\left(''Jan012006''\,''Oct302006''\,\mathrm{Thirty360European}\right)$

We also assume that February has 30 days too:
>

$\mathrm{DayCount}\left(''Jan012006''\,''Feb282006''\,\mathrm{Thirty360European}\right)$

>

$\mathrm{DayCount}\left(''Jan012006''\,''March12006''\,\mathrm{Thirty360European}\right)$

Finally, the Thirty360Italian day counting convention, assumes that starting or ending dates that occur in February and are greater than 27 become equal to 30.
>

$\mathrm{DayCount}\left(''Jan012006''\,''Feb272006''\,\mathrm{Thirty360Italian}\right)$

>

$\mathrm{DayCount}\left(''Jan012006''\,''Feb282006''\,\mathrm{Thirty360Italian}\right)$

>

$\mathrm{DayCount}\left(''Jan012006''\,''March12006''\,\mathrm{Thirty360Italian}\right)$



Other Day Count Conventions


The Simple day counting convention tries to ensure that the whole month distances are returned as a simple fraction.
>

$\mathrm{DayCount}\left(''Jan012008''\,''Nov212008''\,\mathrm{Simple}\right)$

The above result is: 30*10 + 20 which simply takes 30 days per month for the 10 months plus 20 days in November.
>

$\mathrm{YearFraction}\left(''Jan012008''\,''Nov212008''\,\mathrm{Simple}\right)$

The denominator is always taken 360 days per year.
>

$\frac{\mathrm{DayCount}\left(''Jan012008''\,''Nov212008''\,\mathrm{Simple}\right)}{360}$

$\frac{{8}}{{9}}$
 (2.4.3) 
>

$\mathrm{evalf}\left(\right)$




Working with Calendars


Here is the list of related commands.
AddHoliday



add a holiday to the given calendar

AdvanceDate



adjust a nonbusiness day according to the given convention

AdjustDate



advance a nonbusiness day according to the given convention

IsBusinessDay



check if a given date is a business day according to a given calendar

IsEndOfMonth



check if a given date corresponds to the end of a month according to a given calendar

JoinBusinessDays



create a new calendar obtained by joining business days of the given two calendars

JoinHolidays



create a new calendar obtained by joining holidays of the given two calendars

IsHoliday



check if a given date is a holiday according to a given calendar



Here are some examples.
>

$\mathrm{restart}\;$$\mathrm{with}\left(\mathrm{Finance}\right)\:$

For example, to check whether the 3rd of September, 2007 is a holiday according to the New York Stock Exchange.
>

$\mathrm{IsHoliday}\left(''Sep032007''\,\mathrm{NewYork}\right)\;$

We can adjust this date using one of several supported business day conventions.
>

${\mathrm{Finance}}_{\mathrm{AdjustDate}}\left(''Sep032007''\,\mathrm{NewYork}\,\mathrm{convention}\=\mathrm{Following}\right)\;$

${''Sep042007''}$
 (3.2) 
>

${\mathrm{Finance}}_{\mathrm{AdjustDate}}\left(''Sep032007''\,\mathrm{NewYork}\,\mathrm{convention}\=\mathrm{Preceding}\right)\;$

${''Aug312007''}$
 (3.3) 
>

${\mathrm{Finance}}_{\mathrm{AdjustDate}}\left(''Sep032007''\,\mathrm{NewYork}\,\mathrm{convention}\=\mathrm{Unadjusted}\right)\;$

${''Sep032007''}$
 (3.4) 
We can use StringTools[ParseTime] to determine what day of the week 3rd of September, 2007 is.
>

$\mathrm{StringTools}:\mathrm{ParseTime}\left(''\%b\%d\%Y''\,''Sep032007''\right):\mathrm{weekDay}\;$

In the next example we will create new calendar data structure and add holidays to this calendar.
>

$\mathrm{C1}:=\mathrm{Calendar}\left(\right)\:$

>

$\mathrm{IsHoliday}\left(''Aug182006''\,\mathrm{C1}\right)\;$

>

$\mathrm{AddHoliday}\left(\mathrm{C1}\,''Aug182006''\right)semi;$

>

$\mathrm{AddHoliday}\left(\mathrm{C1}\,''Aug192006''\right)semi;$

How August 18, 2006 is a holiday in the new calendar.
>

$\mathrm{IsHoliday}\left(''Aug182006''\,\mathrm{C1}\right)\;$

>

$\mathrm{C2}:=\mathrm{Calendar}\left(\mathrm{Toronto}\right)\:$

Let us construct two calendars. One obtained by joining holidays and the other one obtained by joining business days from the two calendars above.
>

$\mathrm{C3}:=\mathrm{JoinHolidays}\left(\mathrm{C1}\,\mathrm{C2}\right)\:$

>

$\mathrm{C4}:=\mathrm{JoinBusinessDays}\left(\mathrm{C1}\,\mathrm{C2}\right)\:$

>

$\mathrm{map}\left(t\→\mathrm{IsHoliday}\left(''Aug182006''\,t\right)\,\left[\mathrm{C1}\,\mathrm{C2}\,\mathrm{C3}\,\mathrm{C4}\right]\right)\;$

$\left[{\mathrm{true}}{\,}{\mathrm{false}}{\,}{\mathrm{true}}{\,}{\mathrm{false}}\right]$
 (3.8) 
>

$\mathrm{map}\left(t\→\mathrm{IsHoliday}\left(''Aug192006''\,t\right)\,\left[\mathrm{C1}\,\mathrm{C2}\,\mathrm{C3}\,\mathrm{C4}\right]\right)\;$

$\left[{\mathrm{true}}{\,}{\mathrm{true}}{\,}{\mathrm{true}}{\,}{\mathrm{true}}\right]$
 (3.9) 


Standard Calendars



Bratislava Stock Exchange


Holidays

•

New Year's Day, January 1st

•

Liberation of the Republic, May 8th

•

SS. Cyril and Methodius, July 5th

•

Slovak National Uprising, August 29th

•

Constitution of the Slovak Republic, September 1st

•

Our Lady of the Seven Sorrows, September 15th

•

All Saints Day, November 1st

•

Freedom and Democracy of the Slovak Republic, November 17th

•

Christmas Eve, December 24th

•

Christmas, December 25th

•

St. Stephen, December 26th


References






Budapest Stock Exchange


Holidays

•

New Year's Day, January 1st

•

Liberation of the Republic, May 8th

•

SS. Cyril and Methodius, July 5th

•

Slovak National Uprising, August 29th

•

Constitution of the Slovak Republic, September 1st

•

Our Lady of the Seven Sorrows, September 15th

•

All Saints Day, November 1st

•

Freedom and Democracy of the Slovak Republic, November 17th

•

Christmas Eve, December 24th

•

Christmas, December 25th

•

St. Stephen, December 26th


References






Copenhagen Stock Exchange


Holidays

•

General Prayer Day, 25 days after Easter Monday

•

Whit (Pentecost) Monday

•

New Year's Day, January 1st

•

Constitution Day, June 5th

•

Christmas, December 25th

•

Boxing Day, December 26th


References






Frankfurt Stock Exchange


Holidays

•

New Year's Day, January 1st

•

Christmas' Eve, December 24th

•

Christmas, December 25th

•

Christmas Holiday, December 26th

•

New Year's Eve, December 31st


References






Helsinki Stock Exchange


Holidays

•

New Year's Day, January 1st

•

Midsummer Eve (Friday between June 1824)

•

Independence Day, December 6th

•

Christmas Eve, December 24th

•

Christmas, December 25th

•

Boxing Day, December 26th


References






Johannesburg Securities Exchange


Holidays

•

New Year's Day, January 1st (possibly moved to Monday)

•

Family Day, Easter Monday

•

Human Rights Day, March 21st (possibly moved to Monday)

•

Freedom Day, April 27th (possibly moved to Monday)

•

Workers Day, May 1st (possibly moved to Monday)

•

Youth Day, June 16th (possibly moved to Monday)

•

National Women's Day, August 9th (possibly moved to Monday)

•

Heritage Day, September 24th (possibly moved to Monday)

•

Day of Reconciliation, December 16th (possibly moved to Monday)

•

Christmas December 25th

•

Day of Goodwill December 26th (possibly moved to Monday)


References






Milan Stock Exchange


Holidays

•

New Year's Day, January 1st

•

Assumption, August 15th

•

Christmas' Eve, December 24th

•

Christmas, December 25th

•

St. Stephen, December 26th

•

New Year's Eve, December 31st


References






London Stock Exchange


Holidays

•

New Year's Day, January 1st (possibly moved to Monday)

•

Early May Bank Holiday, first Monday of May

•

Spring Bank Holiday, last Monday of May

•

Summer Bank Holiday, last Monday of August

•

Christmas Day, December 25th (possibly moved to Monday or Tuesday)

•

Boxing Day, December 26th (possibly moved to Monday or Tuesday)


References






New York Stock Exchange


Holidays

•

New Year's Day, January 1st (possibly moved to Monday if falls on Sunday)

•

Martin Luther King's birthday, third Monday in January (since 1998)

•

Presidents' Day (a.k.a. Washington's birthday), third Monday in February

•

Memorial Day, last Monday in May

•

Independence Day, July 4th (moved to Monday if falls on Sunday or Friday if falls on Saturday)

•

Labor Day, first Monday in September

•

Thanksgiving Day, fourth Thursday in November

•

Presidential election day, first Tuesday in November of election years (until 1980)

•

Christmas, December 25th (moved to Monday if falls on Sunday or Friday if falls on Saturday)

•

Special historic closings


References






Oslo Stock Exchange


Holidays

•

New Year's Day, January 1st

•

National Independence Day, May 17st

•

Christmas, December 25th

•

Boxing Day, December 26th


References






Prague Stock Exchange


Holidays

•

New Year's Day, January 1st

•

Liberation Day, May 8th

•

SS. Cyril and Methodius, July 5th

•

Czech Statehood Day, September 28th

•

Independence Day, October 28th

•

Struggle for Freedom and Democracy Day, November 17th

•

Christmas Eve, December 24th

•

Christmas, December 25th

•

St. Stephen, December 26th


References






Stockholm Stock Exchange


Holidays

•

Midsummer Eve (Friday between June 1824)

•

New Year's Day, January 1st

•

Christmas Eve, December 24th

•

Christmas Day, December 25th

•

Boxing Day, December 26th

•

New Year's Eve, December 31th


References






Sydney Stock Exchange


Holidays

•

New Year's Day, January 1st

•

Australia Day, January 26th (possibly moved to Monday)

•

ANZAC Day. April 25th (possibly moved to Monday)

•

Queen's Birthday, second Monday in June

•

Bank Holiday, first Monday in August

•

Labour Day, first Monday in October

•

Christmas, December 25th (possibly moved to Monday or Tuesday)

•

Boxing Day, December 26th (possibly moved to Monday or Tuesday)


References






Tokyo Stock Exchange


Holidays

•

New Year's Day, January 1st

•

Bank Holiday, January 2nd

•

Bank Holiday, January 3rd

•

Coming of Age Day, 2nd Monday in January

•

National Foundation Day, February 11th

•

Greenery Day, April 29th

•

Constitution Memorial Day, May 3rd

•

Holiday for a Nation, May 4th

•

Children's Day, May 5th

•

Marine Day, 3rd Monday in July

•

Respect for the Aged Day, 3rd Monday in September

•

Health and Sports Day, 2nd Monday in October

•

National Culture Day, November 3rd

•

Labor Thanksgiving Day, November 23rd

•

Emperor's Birthday, December 23rd

•

Bank Holiday, December 31st


References






Toronto Stock Exchange


Holidays

•

New Year's Day, January 1st (possibly moved to Monday)

•

Victoria Day, The Monday on or preceding 24 May

•

Canada Day, July 1st (possibly moved to Monday)

•

Provincial Holiday, first Monday of August

•

Labour Day, first Monday of September

•

Thanksgiving Day, second Monday of October

•

Remembrance Day, November 11th

•

Christmas, December 25th (possibly moved to Monday or Tuesday)

•

Boxing Day, December 26th (possibly moved to Monday or Tuesday)


References






Warsaw Stock Exchange


Holidays

•

New Year's Day, January 1st

•

Constitution Day, May 3rd

•

Assumption of the Blessed Virgin Mary, August 15th

•

All Saints Day, November 1st

•

Independence Day, November 11th

•

Christmas, December 25th

•

2nd Day of Christmas, December 26th


References






Wellington Stock Exchange


Holidays

•

New Year's Day, January 1st (possibly moved to Monday or Tuesday)

•

Day after New Year's Day, January 2st (possibly moved to Monday or Tuesday)

    