Mathematica offers holiday calendars, which is GREAT! Especially because adding a days to a date with DatePlus[{2015,4,2},{1,"BusinessDay"}] can skip straight to the next business day. While 4/3/15 would have been a Friday, however, it was a Good Friday, and markets didn't trade on that day. I'd like to add that information without having to rebuild the whole holiday history for the last 100 years of market trading. The only example I found shows how to create a completely new custom holiday calendar:

DayRange[DateObject[{2000, 1, 6}, "Day", "Gregorian", -6.`],
  DateObject[{2018, 7, 6}, "Day", "Gregorian", -6.`], "Holiday", 
  HolidayCalendar -> {"Gregorian" -> {{True &, # == 5 &, # == 9 &}}}]

If I could build upon an existing or combine new with existing, that'd be really useful and would save a bunch of time. Any ideas? Thank you in advance.


You may use CalendarData to identify which market calendar to use for a country.

From the documentation

{"Default", "GovernmentBond", "NERC", "NYSE"}

Use the "NYSE" calendar holidays in DayRange.

DayRange[PreviousDate[Today, "Year"], NextDate[Today, "Year"], "Holiday", 
 HolidayCalendar -> {"UnitedStates", "NYSE"}]

Mathematica graphics

This year's Good Friday can be seen in the list as a holiday. Compare the result to that of HolidayCalendar -> "UnitedStates".

Hope this helps.

  • $\begingroup$ You're my personal hero! :-) Thank you! $\endgroup$ – Gregory Klopper Apr 14 '17 at 21:25
  • $\begingroup$ My CalendarData["UnitedStates"] returns {"Default", "GovernmentBond", "NASDAQ", "NERC", "NYSE"}. Interesting that NYSE works as it should, but NASDAQ is broken: DatePlus[{2015, 4, 2}, {1, "BusinessDay"}, HolidayCalendar -> {"UnitedStates", "NASDAQ"}] returns {2015,4,3}. But FinancialData["QQQ", "OHLC", {{2015, 4, 3}}] returns Missing[NotAvailable] $\endgroup$ – Gregory Klopper Apr 14 '17 at 21:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.