[R-sig-finance] fCalendar and Bizdays: 8 dec

Parlamis Franklin fparlamis at mac.com
Wed Feb 1 23:23:49 CET 2006


 > isBizday
function (x, holidays = holiday.NYSE())
{
     char.x = substr(as.character(x), 1, 10)
     char.h = substr(as.character(holidays), 1, 10)
     Weekday = as.integer(isWeekday(x))
     nonHoliday = as.integer(!(char.x %in% char.h))
     bizdays = as.logical(Weekday * nonHoliday)
     bizdays
}

looks like default value of holidays is holiday.NYSE()

 > holiday.NYSE()
[1] "America/New_York"
[1] [2005-01-17] [2005-02-21] [2005-03-25] [2005-05-30] [2005-07-04]  
[2005-09-05] [2005-11-24]
[8] [2005-12-26]

which, by the way, is stuck in 2005

 > isBizday(timeDate("2007-12-25"))
[1] TRUE

so i guess you need to specify which holiday calendar you want to use  
as an argument to the isBizday function.  it is not clear to me where  
to find these holiday calendars.
the help pages for fCalendar mention a database holidays.db.  however,

 > data(package="fCalendar")

discloses only the timezones.db data set

as an aside, if you are in vienna, i think you want timeDate 
("2005-12-08", zone = "Vienna") rather than what you wrote.  this  
will ensure your timeDate object actually has the date you specify.   
for example,

 > timeDate("2006-01-01", FinCenter="Honolulu")
[1] "Honolulu"
[1] [2005-12-31 14:00:00]

because timeDate function thinks I am observing the date in GMT but  
want it adjusted to FinCenter "Honolulu"

On Feb 1, 2006, at 12:46 AM, Thomas Steiner wrote:

>>> isBizday(timeDate("2005-12-08"))
>> [1] TRUE
>
> of course it should be
>
> isBizday(timeDate("2005-12-08", FinCenter = "Vienna"))
>
> which returns TRUE as well.
>
> _______________________________________________
> 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