<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
All,<br>
<br>
The following quote is from the NYSE rule book concerning holidays.<br>
<br>
<a name="traverse_IDAP3JQTIDAP3JQT">The Exchange Board has also
determined that, when any </a><a class="hit-navigation" href="javascript:gotoPreviousHit('traverse_IDAP3JQTIDAP3JQT')">
<img name="hit-img" style="visibility: visible;" src="cid:part1.08060000.02050200@aol.com" border="0"></a><font color="blue">holiday</font>
<a class="hit-navigation" href="javascript:gotoNextHit('traverse_IDAP3JQTIDAP3JQT')"><img name="hit-img" style="visibility: visible;" src="cid:part2.03040809.04030005@aol.com" border="0"></a> observed by
the Exchange falls on a Saturday, the Exchange will
not be open for business on the preceding Friday and when any <a class="hit-navigation" href="javascript:gotoPreviousHit('traverse_IDAP3JQTIDAP3JQT')">
<img name="hit-img" style="visibility: visible;" src="cid:part1.08060000.02050200@aol.com" border="0"></a><font color="blue">holiday</font>
<a class="hit-navigation" href="javascript:gotoNextHit('traverse_IDAP3JQTIDAP3JQT')"><img name="hit-img" style="visibility: hidden;" src="cid:part2.03040809.04030005@aol.com" border="0"></a> observed by
the Exchange falls on a Sunday, the Exchange will not
be open for business on the succeeding Monday, unless unusual business
conditions exist, such as the ending of a monthly or the yearly
accounting period.<br>
<br>
This would mean that the calendar functions for the US relating to the
NYSE and other holidays should have Independence day, Christmas, and
New Years test for this condition and return the previous or the
following day for a holiday.<br>
<br>
Currently USIndependenceDay is<br>
function (year = currentYear) <br>
{<br>
ans = year * 10000 + 704<br>
timeDate(as.character(ans))<br>
}<br>
<br>
For example Independence Day 2009 is a Saturday<br>
isWeekday(USIndenpendenceDay(2009))<br>
2009-07-04 <br>
FALSE <br>
The previous day is the recognized holiday<br>
isWeekday(USIndependenceDay(2009)-24*3600)<br>
2009-07-03 <br>
TRUE <br>
<br>
The question I have is the calender functions to return the explicit
holiday or the implicit holiday that is determined by accounting for
weekends?<br>
<br>
If the implicit holiday code was the correct code, the functions could
be modified similar to <br>
USIndependenceDay1<-function (year = currentYear)<br>
{<br>
ans = year * 10000 + 704<br>
ret=timeDate(as.character(ans))<br>
if (weekdays(timeDate(as.character(ans))@Data,T)=='Sat')<br>
ret=timeDate(as.character(ans)) - 24 * 3600<br>
if (weekdays(timeDate(as.character(ans))@Data,T)=='Sun')<br>
ret=timeDate(as.character(ans)) + 24 * 3600<br>
<br>
ret<br>
}<br>
USIndependenceDay1(2009)<br>
<br>
But a more efficient code would be a function .holiday.weekend.check as<br>
.holiday.weekend.check<-function (date)<br>
{<br>
ret=timeDate(as.character(date))<br>
if (weekdays(timeDate(as.character(date))@Data,T)=='Sat')<br>
ret=timeDate(as.character(ans)) - 24 * 3600<br>
if (weekdays(timeDate(as.character(date))@Data,T)=='Sun')<br>
ret=timeDate(as.character(date)) + 24 * 3600<br>
<br>
ret<br>
}<br>
USIndependenceDay2<-function (year = currentYear)<br>
{<br>
ans = year * 10000 + 704<br>
.holiday.weekend.check(ans)<br>
}<br>
<br>
this would minimize the editing of the current modules.<br>
<br>
Thank you<br>
Joe<br>
<br>
<br>
</body>
</html>