[R-SIG-Finance] NYSE Holiday question for handling holidays that occur on a weekend.

Joe W. Byers ecjbosu at aol.com
Sun Feb 11 01:55:03 CET 2007


All,

The following quote is from the NYSE rule book concerning holidays.

The Exchange Board has also determined that, when any 
<javascript:gotoPreviousHit('traverse_IDAP3JQTIDAP3JQT')>holiday 
<javascript:gotoNextHit('traverse_IDAP3JQTIDAP3JQT')> observed by the 
Exchange falls on a Saturday, the Exchange will not be open for business 
on the preceding Friday and when any 
<javascript:gotoPreviousHit('traverse_IDAP3JQTIDAP3JQT')>holiday 
<javascript:gotoNextHit('traverse_IDAP3JQTIDAP3JQT')> 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.

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.

Currently USIndependenceDay is
function (year = currentYear)
{
    ans = year * 10000 + 704
    timeDate(as.character(ans))
}

For example Independence Day 2009 is a Saturday
isWeekday(USIndenpendenceDay(2009))
2009-07-04
     FALSE
The previous day is the recognized holiday
 isWeekday(USIndependenceDay(2009)-24*3600)
2009-07-03
      TRUE

The question I have is the calender functions to return the explicit 
holiday or the implicit holiday that is determined by accounting for 
weekends?

If the implicit holiday code was the correct code, the functions could 
be modified similar to
USIndependenceDay1<-function (year = currentYear)
{
    ans = year * 10000 + 704
    ret=timeDate(as.character(ans))
    if (weekdays(timeDate(as.character(ans))@Data,T)=='Sat')
      ret=timeDate(as.character(ans)) - 24 * 3600
    if (weekdays(timeDate(as.character(ans))@Data,T)=='Sun')
      ret=timeDate(as.character(ans)) + 24 * 3600

    ret
}
USIndependenceDay1(2009)

But a more efficient code would be a function .holiday.weekend.check as
.holiday.weekend.check<-function (date)
{
    ret=timeDate(as.character(date))
    if (weekdays(timeDate(as.character(date))@Data,T)=='Sat')
      ret=timeDate(as.character(ans)) - 24 * 3600
    if (weekdays(timeDate(as.character(date))@Data,T)=='Sun')
      ret=timeDate(as.character(date)) + 24 * 3600

    ret
}
USIndependenceDay2<-function (year = currentYear)
{
    ans = year * 10000 + 704
    .holiday.weekend.check(ans)
}

this would minimize the editing of the current modules.

Thank you
Joe


-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20070210/5a77566d/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hit-img
Type: image/jpeg
Size: 1089 bytes
Desc: not available
Url : https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20070210/5a77566d/attachment.jpe 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hit-img
Type: image/jpeg
Size: 1006 bytes
Desc: not available
Url : https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20070210/5a77566d/attachment-0001.jpe 


More information about the R-SIG-Finance mailing list