[R-SIG-Finance] Timedate problems in Rmetrics

Yohan Chalabi chalabi at phys.ethz.ch
Wed Mar 10 09:48:54 CET 2010


>>>> "JK" == John Kerpel <john.kerpel at gmail.com>
>>>> on Tue, 9 Mar 2010 17:00:35 -0600

   JK> Hi folks!
   JK>
   JK> Shouldn't the following code cut out New Year's Day (2008-01-01)
   JK> and MLK day
   JK> (2008-01-21) ?
   JK>
   JK> I need a sequence without holidays as well as weekends.  Thx!
   JK>
   JK> John
   JK>
   JK> tS<-timeSequence(from = "2008-01-01", to = "2008-01-31", by =
   JK> "day")
   JK>
   JK> tS[isBizday(tS, holidayNYSE())]

Hi John,

You need to specify the year in holidayNYSE otherwise it uses the
current one.

try with

tS[isBizday(tS, holidayNYSE(2008))]


HTH,
Yohan


   JK>
   JK> GMT
   JK> [1] [2008-01-01] [2008-01-02] [2008-01-03] [2008-01-04]
   JK> [2008-01-07]
   JK> [2008-01-08] [2008-01-09]
   JK> [8] [2008-01-10] [2008-01-11] [2008-01-14] [2008-01-15]
   JK> [2008-01-16]
   JK> [2008-01-17] [2008-01-18]
   JK> [15] [2008-01-21] [2008-01-22] [2008-01-23] [2008-01-24]
   JK> [2008-01-25]
   JK> [2008-01-28] [2008-01-29]
   JK> [22] [2008-01-30] [2008-01-31]
   JK>
   JK> holidayNYSE(2008)
   JK> NewYork
   JK> [1] [2008-01-01] [2008-01-21] [2008-02-18] [2008-03-21]
   JK> [2008-05-26]
   JK> [2008-07-04] [2008-09-01]
   JK> [8] [2008-11-27] [2008-12-25]

-- 
PhD candidate
Swiss Federal Institute of Technology
Zurich

www.ethz.ch



More information about the R-SIG-Finance mailing list