fCalendar and Bizdays: 8 dec

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

fCalendar and Bizdays: 8 dec

Thomas Steiner
8.12. is not a businessday in Austria (Mariä Empfängnis). The Vienna
stock exchange is closed, but:

> isBizday(timeDate("2005-12-08"))
[1] TRUE

compare the eg to
http://www.indices.cc/cms/5/199/2163

Thomas

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
Reply | Threaded
Open this post in threaded view
|

Re: fCalendar and Bizdays: 8 dec

Thomas Steiner
> > isBizday(timeDate("2005-12-08"))
> [1] TRUE

of course it should be

isBizday(timeDate("2005-12-08", FinCenter = "Vienna"))

which returns TRUE as well.

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
Reply | Threaded
Open this post in threaded view
|

Re: fCalendar and Bizdays: 8 dec

Parlamis Franklin
 > 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.
>
> _______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
Reply | Threaded
Open this post in threaded view
|

Re: fCalendar and Bizdays: 8 dec

Diethelm Wuertz
In reply to this post by Thomas Steiner
You have to proceed in the following way:


# Write your holiday Calendar, see holiday.NYSE(), eg for the ATX
Trading Days ...
holiday.ATX =
function(y = 2005)
{
    # See: http://www.indices.cc/cms/5/199/2163
    if (y == 2005) {
        holidays = c(
            "2005-01-06", "2005-03-25", "2005-01-28",
            "2005-05-05", "2005-05-16", "2005-05-26",
            "2005-08-15", "2005-10-26", "2005-11-01",
            "2005-12-08", "2006-12-26", "2005-12-30")
    } else {
        # Do it for all the other years of interest ...
        # or generate them from some trading rules ...
        stop("Not implemented")
    }
   
    ans = timeDate(charvec = holidays, format = NULL, zone = "Vienna",
        FinCenter = "Vienna")

    ans@FinCenter = "Europe/Vienna"
   
    ans
}


# The data are recorded in zone="Vienna" and the Financial Center (where
to use the data) is also Vienna:
test = timeDate(c("2005-12-08", "2005-12-25"), zone = "Vienna",
FinCenter = "Vienna")

# Test ...
isBizday(test, holidays = holiday.ATX())


gives the right results.

DW


PS: There is a bug - currentYear - returns 2005
use to fix: currentYear = .currentYear()
This bug will be fixed with the next release/


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.
>
>_______________________________________________
>[hidden email] mailing list
>https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>
>  
>

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance