Calendars Overview - Maple Help

Calendar-related Commands in the Finance Package

Overview

The Financial Modeling package supports over 20 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.  Here is the list of related commands.

 - add a holiday to the given calendar - adjust a non-business day according to the given convention - advance a non-business day according to the given convention - create new business calendar - return the day of the week on which the given date falls - check if a given date is a business day according to a given calendar - check if a given date corresponds to the end of a month according to a given calendar - create a new calendar obtained by joining business days of the given two calendars - create a new calendar obtained by joining holidays of the given two calendars - check if a given date is a holiday according to a given calendar

Examples

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("Sep-03-2007",\mathrm{NewYork}\right);$
 ${\mathrm{true}}$ (2.1)

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

 > ${\mathrm{Finance}}_{\mathrm{AdjustDate}}\left("Sep-03-2007",\mathrm{NewYork},\mathrm{convention}=\mathrm{Following}\right);$
 ${"Sep-04-2007"}$ (2.2)
 > ${\mathrm{Finance}}_{\mathrm{AdjustDate}}\left("Sep-03-2007",\mathrm{NewYork},\mathrm{convention}=\mathrm{Preceding}\right);$
 ${"Aug-31-2007"}$ (2.3)
 > ${\mathrm{Finance}}_{\mathrm{AdjustDate}}\left("Sep-03-2007",\mathrm{NewYork},\mathrm{convention}=\mathrm{Unadjusted}\right);$
 ${"Sep-03-2007"}$ (2.4)

Determine on what day of the week the 3rd of September, 2007 falls.

 > $\mathrm{DayOfWeek}\left("September 03, 2007"\right);$
 ${\mathrm{Monday}}$ (2.5)

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

 > ${C}_{1}≔\mathrm{Calendar}\left(\right);$
 ${{C}}_{{1}}{:=}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (2.6)
 > $\mathrm{IsHoliday}\left("Aug-18-2006",{C}_{1}\right);$
 ${\mathrm{false}}$ (2.7)

Add two holidays to this calendar.

 >
 > $\mathrm{AddHoliday}\left({C}_{1},"Aug-19-2006"\right);$

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

 > $\mathrm{IsHoliday}\left("Aug-18-2006",{C}_{1}\right);$
 ${\mathrm{true}}$ (2.8)

Construct another calendar.

 > ${C}_{2}≔\mathrm{Calendar}\left(\mathrm{Toronto}\right);$
 ${{C}}_{{2}}{:=}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (2.9)

Construct two new calendars based on the ones we already have: one obtained by joining holidays, and the other one obtained by joining business days from the two preceding calendars.

 > ${C}_{3}≔\mathrm{JoinHolidays}\left({C}_{1},{C}_{2}\right);$
 ${{C}}_{{3}}{:=}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (2.10)
 > ${C}_{4}≔\mathrm{JoinBusinessDays}\left({C}_{1},{C}_{2}\right);$
 ${{C}}_{{4}}{:=}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (2.11)
 > $\mathrm{AdjustDate}\left("August 18, 2006",{C}_{1},\mathrm{convention}=\mathrm{Following}\right);$
 ${"August 20, 2006"}$ (2.12)
 > $\mathrm{AdjustDate}\left("August 18, 2006",{C}_{2},\mathrm{convention}=\mathrm{Following}\right);$
 ${"August 18, 2006"}$ (2.13)
 > $\mathrm{AdjustDate}\left("August 18, 2006",{C}_{3},\mathrm{convention}=\mathrm{Following}\right);$
 ${"August 21, 2006"}$ (2.14)
 > $\mathrm{AdjustDate}\left("August 18, 2006",{C}_{4},\mathrm{convention}=\mathrm{Following}\right);$
 ${"August 18, 2006"}$ (2.15)

The calendars constructed earlier can now be passed to other routines from the package. These routines will perform date adjustments in accordance with the specified calendars.

 > $\mathrm{SetEvaluationDate}\left("July 10, 2006"\right);$
 ${"December 8, 2006"}$ (2.16)
 > ${\mathrm{schedule}}_{1}:=\mathrm{Schedule}\left("July 18, 2006","September 18, 2006",\mathrm{Monthly},\mathrm{calendar}={C}_{1}\right);$
 ${{\mathrm{schedule}}}_{{1}}{:=}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (2.17)
 > $\mathrm{benchmark}:=\mathrm{BenchmarkRate}\left(1,\mathrm{Months},\mathrm{EURIBOR},0.05\right);$
 ${\mathrm{benchmark}}{:=}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (2.18)
 > ${\mathrm{IRS}}_{1}:=\mathrm{InterestRateSwap}\left(100,\mathrm{benchmark},{\mathrm{schedule}}_{1},0.05,{\mathrm{schedule}}_{1},0.0\right);$
 ${{\mathrm{IRS}}}_{{1}}{:=}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (2.19)
 > $\mathrm{CashFlows}\left({\mathrm{IRS}}_{1},\mathrm{paying}\right);$
 $\left[{\mathrm{.466839741785402273 on \text{'}August 20, 2006\text{'}}}{,}{\mathrm{.384298182901438634 on \text{'}September 18, 2006\text{'}}}\right]$ (2.20)
 > ${\mathrm{schedule}}_{2}:=\mathrm{Schedule}\left("July 18, 2006","September 18, 2006",\mathrm{Monthly},\mathrm{calendar}={C}_{2}\right);$
 ${{\mathrm{schedule}}}_{{2}}{:=}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (2.21)
 > ${\mathrm{IRS}}_{2}:=\mathrm{InterestRateSwap}\left(100,\mathrm{benchmark},{\mathrm{schedule}}_{2},0.05,{\mathrm{schedule}}_{2},0.\right);$
 ${{\mathrm{IRS}}}_{{2}}{:=}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (2.22)
 > $\mathrm{CashFlows}\left({\mathrm{IRS}}_{2},\mathrm{paying}\right);$
 $\left[{\mathrm{.453078103598340831 on \text{'}August 18, 2006\text{'}}}{,}{\mathrm{.398050398536189787 on \text{'}September 18, 2006\text{'}}}\right]$ (2.23)
 > ${\mathrm{schedule}}_{3}:=\mathrm{Schedule}\left("July 18, 2006","September 18, 2006",\mathrm{Monthly},\mathrm{calendar}={C}_{3}\right);$
 ${{\mathrm{schedule}}}_{{3}}{:=}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (2.24)
 > ${\mathrm{IRS}}_{3}:=\mathrm{InterestRateSwap}\left(100,\mathrm{benchmark},{\mathrm{schedule}}_{3},0.05,{\mathrm{schedule}}_{3},0.\right);$
 ${{\mathrm{IRS}}}_{{3}}{:=}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (2.25)
 > $\mathrm{CashFlows}\left({\mathrm{IRS}}_{3},\mathrm{paying}\right);$
 $\left[{\mathrm{.466839741785402273 on \text{'}August 21, 2006\text{'}}}{,}{\mathrm{.384298182901438634 on \text{'}September 18, 2006\text{'}}}\right]$ (2.26)

Western-Style Calendars

Bratislava Stock Exchange

 • Holidays
 – Saturdays
 – Sundays
 – New Year's Day, January 1st
 – Epiphany, January 6th
 – Good Friday
 – Easter Monday
 – May Day, May 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
 – Saturdays
 – Sundays
 – New Year's Day, January 1st
 – Epiphany, January 6th
 – Good Friday
 – Easter Monday
 – May Day, May 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
 – Saturdays
 – Sundays
 – Maundy Thursday
 – Good Friday
 – Easter Monday
 – General Prayer Day, 25 days after Easter Monday
 – Ascension
 – 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
 – Saturdays
 – Sundays
 – New Year's Day, January 1st
 – Good Friday
 – Easter Monday
 – Labour Day, May 1st
 – Christmas' Eve, December 24th
 – Christmas, December 25th
 – Christmas Holiday, December 26th
 – New Year's Eve, December 31st
 • References
 –

Helsinki Stock Exchange

 • Holidays
 – Saturdays
 – Sundays
 – New Year's Day, January 1st
 – Epiphany, January 6th
 – Good Friday
 – Easter Monday
 – Ascension Thursday
 – Labour Day, May 1st
 – Midsummer Eve (Friday between June 18-24)
 – Independence Day, December 6th
 – Christmas Eve, December 24th
 – Christmas, December 25th
 – Boxing Day, December 26th
 • References
 –

Johannesburg Securities Exchange

 • Holidays
 – Saturdays
 – Sundays
 – New Year's Day, January 1st (possibly moved to Monday)
 – Good Friday
 – 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
 – Saturdays
 – Sundays
 – New Year's Day, January 1st
 – Good Friday
 – Easter Monday
 – Labour Day, May 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
 – Saturdays
 – Sundays
 – New Year's Day, January 1st (possibly moved to Monday)
 – Good Friday
 – Easter 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
 – Saturdays
 – Sundays
 – 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
 – Good Friday
 – 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
 – Saturdays
 – Sundays
 – Holy Thursday
 – Good Friday
 – Easter Monday
 – Ascension
 – Whit(Pentecost) Monday
 – New Year's Day, January 1st
 – May Day, May 1st
 – National Independence Day, May 17th
 – Christmas, December 25th
 – Boxing Day, December 26th
 • References
 –

Prague Stock Exchange

 • Holidays
 – Saturdays
 – Sundays
 – New Year's Day, January 1st
 – Easter Monday
 – Labour Day, May 1st
 – Liberation Day, May 8th
 – SS. Cyril and Methodius, July 5th
 – Jan Hus Day, July 6th
 – Czech Statehood Day, September 28th
 – Independence Day, October 28th
 – Christmas Eve, December 24th
 – Christmas, December 25th
 – St. Stephen, December 26th
 • References
 –

Stockholm Stock Exchange

 • Holidays
 – Saturdays
 – Sundays
 – Good Friday
 – Easter Monday
 – Ascension
 – Whit(Pentecost) Monday
 – Midsummer Eve (Friday between June 18-24)
 – New Year's Day, January 1st
 – Epiphany, January 6th
 – May Day, May 1st
 – National Day, June 6th
 – Christmas Eve, December 24th
 – Christmas Day, December 25th
 – Boxing Day, December 26th
 – New Year's Eve, December 31th
 • References
 –

Sydney Stock Exchange

 • Holidays
 – Saturdays
 – Sundays
 – New Year's Day, January 1st
 – Australia Day, January 26th (possibly moved to Monday)
 – Good Friday
 – Easter 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
 – Saturdays
 – Sundays
 – New Year's Day, January 1st
 – Bank Holiday, January 2nd
 – Bank Holiday, January 3rd
 – Coming of Age Day, second Monday in January
 – National Foundation Day, February 11th
 – Vernal Equinox
 – Greenery Day, April 29th
 – Constitution Memorial Day, May 3rd
 – Holiday for a Nation, May 4th
 – Children's Day, May 5th
 – Marine Day, third Monday in July
 – Respect for the Aged Day, third Monday in September
 – Autumnal Equinox
 – Health and Sports Day, second 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
 – Saturdays
 – Sundays
 – New Year's Day, January 1st (possibly moved to Monday)
 – Family Day, third Monday of February
 – Good Friday
 – Easter Monday
 – Victoria Day, the Monday on or preceding May 24th
 – 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
 –

United Kingdom General

 • Holidays
 – Saturdays
 – Sundays
 – New Year's Day, January 1st (possibly moved to Monday)
 – Good Friday
 – Easter 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
 –

United States Bond Market

 • Holidays
 – Saturdays
 – Sundays
 – New Year's Day, January 1st (possibly moved to Monday if falls on Sunday)
 – Martin Luther King's birthday, third Monday in January
 – 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
 – Columbus Day, second Monday in October
 – Veterans' Day, November 11th (moved to Monday if falls on Sunday or Friday if falls on Saturday)
 – Thanksgiving Day, fourth Thursday in November
 – Christmas, December 25th (moved to Monday if falls on Sunday or Friday if falls on Saturday)

United States General

 • Holidays
 – Saturdays
 – Sundays
 – New Year's Day, January 1st (possibly moved to Monday if falls on Sunday, or to Friday if falls on Saturday)
 – Martin Luther King's birthday, third Monday in January
 – 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 to Friday if falls on Saturday)
 – Labor Day, first Monday in September
 – Columbus Day, second Monday in October
 – Veterans' Day, November 11th (moved to Monday if falls on Sunday or to Friday if falls on Saturday)
 – Thanksgiving Day, fourth Thursday in November
 – Christmas, December 25th (moved to Monday if falls on Sunday or to Friday if falls on Saturday)
 • References
 –

Warsaw Stock Exchange

 • Holidays
 – Saturdays
 – Sundays
 – Easter Monday
 – Corpus Christi
 – New Year's Day, January 1st
 – May Day, May 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
 – Saturdays
 – Sundays
 – New Year's Day, January 1st (possibly moved to Monday or Tuesday)
 – Day after New Year's Day, January 2nd (possibly moved to Monday or Tuesday)
 – Anniversary Day, Monday nearest January 22nd
 – Waitangi Day, February 6th
 – Good Friday
 – Easter Monday
 – ANZAC Day, April 25th
 – Queen's Birthday, first Monday in June
 – Labour Day, fourth Monday in October
 – Christmas, December 25th (possibly moved to Monday or Tuesday)
 – Boxing Day, December 26th (possibly moved to Monday or Tuesday)
 • References

Zurich Stock Exchange

 • Holidays
 – Saturdays
 – Sundays
 – New Year's Day, January 1st
 – Berchtoldstag, January 2nd
 – Good Friday
 – Easter Monday
 – Ascension Day
 – Whit Monday
 – Labour Day, May 1st
 – National Day, August 1st
 – Christmas, December 25th
 – St. Stephen's Day, December 26th
 • References
 –