[R-SIG-Finance] Create a Monday-Friday time series?

Mark Knecht markknecht at gmail.com
Thu Jan 6 18:18:54 CET 2011

   I think I'm going to have a couple of questions but I figured I'd
start with (I hope) a very simple one. I've not worked with time
series objects before so I'm trying to learn them. I've been looking
at things like ?xts, ?zoo as well as Phil Proctor's book but so far no

   Starting from this little code stub I'd like to create a Monday
through Friday time series into which I can eventually place trading
system results.

   Here's the stub:

TStoDate = function (TSDate) {
	X = strptime(TSDate + 19e6L, "%Y%m%d")

# TradeStation date format
FirstDate = 1100401
LastDate = 1100601

StartDate = TStoDate(FirstDate)
EndDate = TStoDate(LastDate)


   How can I do this, and (if possible and easy) is there a way to
exclude U.S. holidays?

   I did discover

R1 <- as.zoo(StartDate:EndDate )

does create an object, but the values are numbers which I don't
understand but suspect are some internal R code for a date, and it
appears to have enough entries to include weekends.

   Anyway, hopefully this is clear enough to describe what I'm trying
to do and where I'm stuck.


More information about the R-SIG-Finance mailing list