[R-SIG-Finance] NERC holiday calendar

Diethelm Wuertz wuertz at itp.phys.ethz.ch
Thu May 7 10:04:01 CEST 2009


Joe W. Byers wrote:

Thanks to Joe for his contribution!

The NERC calendar has been added to the timeDate package of Rmetrics.
The function is available on R-forge and will be submitted to CRAN with 
the next
version of timeDate.

Diethelm

> Spencer, Diethelm, and rmetrics followers,
>
> I have created a calendar function to build out the NERC holidays for
> power prices.  NERC: North American Reliability Council.  I started this
> because I needed a NYMEX calendar as the text at the bottom explains,
> but I am still waiting on NYMEX to reply on my questions.
>
> The NERC holiday function is based on teh holidayNYSE function from
> rmetrics and the NERC website rules found at
> http://www.nerc.com/~oc/offpeaks.html
>
> I would appreciate any help in verifying this function.  It returns the
> correct holidays as shown on their website.  I am not sure if the
> historical holidays are correct, especially prior to 1971 when Memorial
> day was on 5/30.  I have sent the NERC contact an email with this 
> question.
>
> I did add a new argument to the function for the FinCenter of the
> timedate class because NERC covers all North America.  User will want to
> set this to the FinCenter appropriate for their use (Chicago,
> Pacific,...).  It would be cool to add NERC regions to the timedate zone
> or fincenter lists, but this is another discussion.
>
> I would be honored if rmetrics would consider adding this function to
> the fCalendar package.
>
> The function is:
> #North American Energy Reliabibity Council Holidays calendar
> # for determining days when the 16 hour on peak hours of a day
> # for the region are recognized as off peak hours.
> holidayNERC<-function (year = currentYear,FinCenter = "Eastern")
> {
>    holidays = NULL
>    for (y in year) {
>        if (y >= 1885)
>            holidays = c(holidays, as.character(USNewYearsDay(y)))
>        if (y >= 1885)
>            holidays = c(holidays, as.character(USIndependenceDay(y)))
>        if (y >= 1885)
>            holidays = c(holidays, as.character(USThanksgivingDay(y)))
>        if (y >= 1885)
>            holidays = c(holidays, as.character(USChristmasDay(y)))
>        if (y >= 1887)
>            holidays = c(holidays, as.character(USLaborDay(y)))
>        if (y <= 1970)
>            holidays = c(holidays,
> as.character(USDecorationMemorialDay(y)))
>        if (y >= 1971)
>            holidays = c(holidays, as.character(USMemorialDay(y)))
>    }
>    holidays = sort(holidays)
>    ans = timeDate(holidays)
>    ans = ans + as.integer(as.POSIXlt(ans at Data)$wday == 0) *
>        24 * 3600
>    posix = as.POSIXlt(ans at Data)
>    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(ans at Data)$wday ==
>        0 & ans != ExceptOnLastFriday) * 24 * 3600
>    ans = ans[!(as.POSIXlt(ans at Data)$wday == 0 |
> as.POSIXlt(ans at Data)$wday ==
>        6)]
>    ans at FinCenter = FinCenter
>    ans
> }
> #########################################################################
>
> Thank you
> Joe Wayne Byers, Ph.D.
>
> Spencer Graves wrote:
> >       What level of help do you need?  Have you tried listing the
> > function 'holidayNYSE', making a local copy, then editing it do what 
> you
> > want?  After you've tried that, please send the results to Diethelm
> > Wuertz and me.  If you can't make it work, please explain the problem.
> >
> >       Hope this helps.
> >       Spencer Graves
> >
> > Joe W. Byers wrote:
> >> Rmetrics
> >>
> >> Can anyone help me create a new holidays calendar method like
> >> holidaysNYSE() for NYMEX holidays.  The only difference is the 
> holidays
> >> for Independence day and thanks giving.
> >> Independence Day
> >>  Monday, July 3*
> >>  Tuesday, July 4
> >>  (Electronic trading closed Sunday and Monday, July 2 and 3; reopens
> >> 6:00 PM, July 4)
> >> Thanksgiving
> >>  Thursday, November 23
> >>  Friday, November 24
> >>  (NYMEX ClearPort® and CME Globex® open both days)
> >>
> >> NYMEX is closed on Monday July 3rd this year since the 4th is on a
> >> Tuesday and Friday the day following Thanksgiving.  This will end in
> >> 2007 according to NYMEX.  The Independence day holiday I think will
> >> observe Friday as a holiday when the 4th is on a Thurs but, 
> according to
> >> NYMEX they are not sure for 2007.  Also the webpage
> >> http://www.nymex.com/holida_schedu.aspx notes that Christmas eve will
> >> become a holiday in 2007 but expirations will not change.  I am 
> sending
> >> their customer service a request to post a document with the holiday
> >> rules as well as these tables for those of us who worry about a
> >> derivatives calendar.
> >>
> >> Thank you
> >> Joe
> >>
> >> _______________________________________________
> >> R-SIG-Finance at stat.math.ethz.ch mailing list
> >> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> >>
> >
>
>



More information about the R-SIG-Finance mailing list