John Putz wrote: > Thanks. > > */ > email: /**/[EMAIL PROTECTED]/* <mailto:[EMAIL PROTECTED]> > */home: 206-632-6522 > cell: 206-910-5229/* > > > ----- Original Message ---- > From: Joe W. Byers <[EMAIL PROTECTED]> > To: John Putz <[EMAIL PROTECTED]> > Cc: [EMAIL PROTECTED] > Sent: Friday, December 7, 2007 9:26:29 PM > Subject: Re: holidayNYSE missing some > > > John Putz wrote: > > The correct behavior is to shift the holiday to Friday (from Sat) or > to Monday (from Sun). I'm not actually using this for NYSE holidays > but for power industry holidays and made a version to handle those > changes as well as some other idiosyncracies. Thanks for the > suggestion though. > > > > Message: 5 > > Date: Thu, 6 Sep 2007 16:51:49 -0400 > > From: "Charles Naylor" <[EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>> > > Subject: Re: [R-SIG-Finance] holidayNYSE missing some > > To: <[EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>> > > Message-ID: > > <[EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>> > > Content-Type: text/plain; charset="us-ascii" > > > > This is deliberate behavior. If you check the code, the third-to-last > > line is as follows: > > ans = ans[!(as.POSIXlt([EMAIL PROTECTED])$wday == 0 | > > as.POSIXlt([EMAIL PROTECTED])$wday== 6)] > > > > > > You could make an alternate version of holidayNYSE that omits this line, > > if you like. > > > > -CN > > > > Charles Naylor > > Assistant Vice President > > Global Dynamic Asset Allocation Group > > Nikko Alternative Asset Management, Inc. > > 535 Madison Avenue, Suite 2500 > > New York, NY 10022 > > T: 212.610.6158 > > F: 212.610.6148 > > E: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > > > > -----Original Message----- > > From: [EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]> > > [mailto:[EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>] On Behalf Of John Putz > > Sent: Thursday, September 06, 2007 4:44 PM > > To: [EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]> > > Subject: [R-SIG-Finance] holidayNYSE missing some > > > > Hello, > > > > I'm not sure if this is the correct list to email this too, but it > > appears that at least in R 2.5.0 that the holidayNYSE function in > > fCalendar does not include holidays that occur on Saturday. E.g. > > holidayNYSE(2004) does not list Christmas. > > > > Thanks, John. > > [[alternative HTML version deleted]] > > > > > > > > email: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > > home: 206-632-6522 > > cell: 206-910-5229 > > [[alternative HTML version deleted]] > > > John, > > I wrote this function for the NERC holidays you might have some interest > in trying. I also made some suggestions in a previous post in this list > about this holidayNYSE problem, but did not hear from anyone on the > feasibility of the suggestions. This is also a problem with other US > holidays, not just NYSE. I would like to correct this for all the > holiday functions but I do not want to have to overload the fCalendar > functions every time I load fCalendar. > > here is my holidayNERC() > > #Method name: holidayNERC > #Written by: Joe W. Byers > #Creation Date: > #Modification Date: Modifier: > #Inputs: vector of Years > #Returns: holidays dates > #Example: > > #******************************************************************************* > #Required Libraries > > #******************************************************************************* > #Input and Temporary variables > > #Holidays for the North American Energy Reliability Council (data from > http://www.nerc.com/~oc/offpeaks.html > <http://www.nerc.com/%7Eoc/offpeaks.html>): > # * Saturdays > # * Sundays > # * New Year's Day, January 1st (possibly moved to Monday if actually > on Sunday) > # * Memorial Day, last Monday in May > # * Independence Day, July 4th (moved to Monday if Sunday) > # * Labor Day, first Monday in September > # * Thanksgiving Day, fourth Thursday in November > # * Christmas, December 25th (moved to Monday if Sunday) > > holidayNERC<-function (year = > currentYear,West=F,FinCenter='America/NewYork') > { > holidays = NULL > for (y in year) { > holidays = c(holidays, as.character(USNewYearsDay(y))) > holidays = c(holidays, as.character(USIndependenceDay(y))) > holidays = c(holidays, as.character(USThanksgivingDay(y))) > holidays = c(holidays, as.character(USChristmasDay(y))) > holidays = c(holidays, as.character(USLaborDay(y))) > holidays = c(holidays, as.character(USMemorialDay(y))) > } > holidays = sort(holidays) > ans = timeDate(holidays) > ans = ans + as.integer(as.POSIXlt([EMAIL PROTECTED])$wday == 0) * > 24 * 3600 > posix = as.POSIXlt([EMAIL PROTECTED]) > y = posix$year + 1900 > m = posix$mon + 1 > lastday = as.POSIXlt((timeCalendar(y = y + (m + 1)%/%13, > m = m + 1 - (m + 1)%/%13 * 12, d = 1) - 24 * 3600)@Data)$mday > ExceptOnLastFriday = timeDate(as.character(.last.of.nday(year = y, > month = m, lastday = lastday, nday = 5))) > ans = ans - as.integer(ans >= timeDate("1959-07-03") & > as.POSIXlt([EMAIL PROTECTED])$wday == > 0 & ans != ExceptOnLastFriday) * 24 * 3600 > if (West==F) { > ans = ans[!(as.POSIXlt([EMAIL PROTECTED])$wday == 0 | > as.POSIXlt([EMAIL PROTECTED])$wday == > 6)] > } else { > ans = ans[!as.POSIXlt([EMAIL PROTECTED])$wday == 0] > ans = ans[!(as.POSIXlt([EMAIL PROTECTED])$wday == 6 & > !as.POSIXlt([EMAIL PROTECTED])$mon == > 6)] > } > [EMAIL PROTECTED] = FinCenter > ans > } > > I would like to note and that I forgot to in the function header that this function is based on the holidaysNYSE() function from rmetrics and sincerely apologize for that oversight to rmetrics.
Joe [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.