[R-SIG-Finance] isBizday question

Joe Byers joe-byers at utulsa.edu
Thu Oct 5 22:30:57 CEST 2006


Diethelm,

thank you for your reply.

In reference to your comment below,
as I specified the holidays=holidays.NYSE(), it only calculates for the 
default function parameters.  I read that in the document pages, just 
did not understand it until I reviewed the results and the code for the 
two functions.

I figured out something that works, I just wonder if there is a simpler 
method.  I used the atoms and factor methods to get the factor levels of 
my years.  I replaced the line of code that contains isBizday with
#as.numeric(factor(atoms(calday)$Y)@levels)
calday<-calday[isBizday(calday,  
holidays=holiday.NYSE(as.numeric(factor(atoms(calday)$Y)@levels)))]

Thank you
Joe



Diethelm Wuertz wrote:
> Joe Byers wrote:
>
>> I have the following code to create a calendar time sequence to 
>> perform a simulation
>> MTMDate<-'2006-09-25';
>> lastDay<-'2007-03-31';
>> traj<-500;
>> ##############end input section
>> dt<-1/365;
>>
>> #build calendar
>> calday<-timeSequence(from = MTMDate, to = lastDay,by = 
>> "day",FinCenter='America/Eastern')
>> #get rid of holidays and weekends
>> calday<-calday[isBizday(calday,holidays=holiday.NYSE())];
>>  
>>
> You have to set the year,  e.g.
>
> > holiday.NYSE()
> [1] "America/New_York"
> [1] [2006-01-02] [2006-01-16] [2006-02-20] [2006-04-14] [2006-05-29] 
> [2006-07-04]
> [7] [2006-09-04] [2006-11-23] [2006-12-25]
> > holiday.NYSE(2005:2006)
> [1] "America/New_York"
> [1] [2005-01-17] [2005-02-21] [2005-03-25] [2005-05-30] [2005-07-04] 
> [2005-09-05]
> [7] [2005-11-24] [2005-12-26] [2006-01-02] [2006-01-16] [2006-02-20] 
> [2006-04-14]
> [13] [2006-05-29] [2006-07-04] [2006-09-04] [2006-11-23] [2006-12-25]
> > help(holiday.NYSE)
>
>
> regards DW
>
>> The problem is that the holidays are only eliminated for the current 
>> year, 2006, not the next year 2007.
>>  
>>
>
>
>> Does anyone have a suggestion that I can use to get the isBizday 
>> method to also see the multiple years for the holidays?
>>
>> Thank you
>> Joe
>>
>> _______________________________________________
>> R-SIG-Finance at stat.math.ethz.ch mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>>
>>  
>>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: joe-byers.vcf
Type: text/x-vcard
Size: 295 bytes
Desc: not available
Url : https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20061005/83d5a5ef/attachment.vcf 


More information about the R-SIG-Finance mailing list