How can I make BUSDAYS return all weekdays?

2 次查看(过去 30 天)
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.

采纳的回答

MathWorks Support Team
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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Calendar 的更多信息

标签

尚未输入任何标签。

Community Treasure Hunt

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

Start Hunting!

Translated by