How can I make BUSDAYS return all weekdays?

3 views (last 30 days)
I would like to have the BUSDAYS function from Financial Toolbox return all weekdays, including those that coincide with NYSE holidays. This is useful when doing analysis for European markets who continue to trade on such holidays.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 16 Mar 2012
The default holiday schedule is the NYSE holiday schedule, which is also adopted if the parameter holvec is set to '' (empty string) or [] (empty vector).
If you are only interested in getting all weekdays and ignoring NYSE holidays, you could specify any Saturday or Sunday in your date range as a holiday (i.e., as the value for holvec).
As an example, take the time period 16-05-2011 till 31-05-2011. May 30th is a well-known NYSE holiday: Memorial Day. Calling BUSDAYS without passing a holiday argument results in a vector that excludes May 30th:
vec = datestr(busdays('2011-05-16','2011-05-31'))
vec =
16-May-2011
17-May-2011
18-May-2011
19-May-2011
20-May-2011
23-May-2011
24-May-2011
25-May-2011
26-May-2011
27-May-2011
31-May-2011
On the other hand, specifying the 21st of May (a Saturday) as a holiday gives all weekdays in that time period:
vec = datestr(busdays('2011-05-16','2011-05-31','daily','2011-05-21'))
vec =
16-May-2011
17-May-2011
18-May-2011
19-May-2011
20-May-2011
23-May-2011
24-May-2011
25-May-2011
26-May-2011
27-May-2011
30-May-2011
31-May-2011

More Answers (0)

Tags

No tags entered yet.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!