[R-SIG-Finance] Convertion of a zoo object to a ts object
Sylvain BARTHELEMY
barth at tac-financial.com
Thu May 24 11:18:06 CEST 2007
Hi Ulrich,
Thanks for your answer and it surely helps. I didn't known about CCAPI and
SlimFX and both seem to be very interesting projects.
---
Sylvain Barthélémy
Head of Quantitative Research, TAC
www.tac-financial.com | www.sylbarth.com
-----Message d'origine-----
De : Ulrich Staudinger [mailto:us at activestocks.de]
Envoyé : jeudi 24 mai 2007 11:01
À : Sylvain BARTHELEMY
Cc : r-sig-finance at stat.math.ethz.ch
Objet : Re: [R-SIG-Finance] Convertion of a zoo object to a ts object
Hi Sylvain,
i know this is a R mailing list, but let me add some information on how i
solve the very same problem.
I usually do the whole data obtaining and preparation in ccapi2, i then
export this data from ccapi2 as a CSV file which i load into R.
Data preparation includes for example aligning multiple timeseries, dealing
with extreme outliers due to unreasonable trades.
For aligning multiple time series i use the java method alignTimeSeries
viewable at
http://activestocks.de:8081/viewrep/ccapi3/src/core/ccapi/core/util/TimeSeri
esUtil.java?r=1.7#l44
Would be good if RMetrics would integrate such a method. Yahoo does drop a
few days in long timeseries, usually.
Hope this helps,
Best regards,
Ulrich Staudinger
Sylvain BARTHELEMY schrieb:
> Dear All,
>
> I use get.hist.quote to read historical prices on various quotes from
> Finance Yahoo. It works fine on daily prices and most of the time on
> monthly prices but it is sometimes difficult to synchronize monthly
> data without duplicating months when extracting more than one quote.
>
> Here is an example where many months are duplicated (see at the end of
> the time series that 2006-05 is duplicated because CAC40 is quoted on
> 2006-05-02 and AXA on 2006-05-01):
> x <- get.hist.quote("^FCHI", compression = "m", start = as.Date(0),
> quote =
> "Close")
> x <- cbind( xx, get.hist.quote("CS.PA", compression = "m", start =
> as.Date(0), quote = "Close") )
>
> For the moment, to avoid these problems, I use something like:
> readFromYahooM <- function(nam,quote) { xx.0 <- get.hist.quote(nam,
> compression = "m", start = as.Date(0), quote =
> quote)
> xx <- ts( coredata(xx.0), frequency = 12, start =
> as.numeric(as.yearmon(as.Date(start(xx.0)[1]))) ) xx } x <-
> readFromYahooM("^FCHI","Close") x <- cbind(x,
> readFromYahooM("CS.PA","Close"))
> colnames(x) <- c("FCHI","CS.PA")
>
> It works, but there is a strong assumption that all the months are
> present in the two time series and the fact is that xx is a zoo object
> and zoo objects can contain irregular time series ! I am sure that
> there should be a more elegant way to do a conversion from a zoo
> object to a ts object or to replace the "start" parameter by the exact
> vector of zoo dates and or yearmon but I don't find any way do to that.
>
> I anyone can help me, I would appreciate.
> Thanks in advance.
>
> ---
> Sylvain Barthélémy
> Head of Quantitative Research, TAC
> www.tac-financial.com | www.sylbarth.com
>
>
>
>
> 15:59
>
> _______________________________________________
> R-SIG-Finance at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only.
> -- If you want to post, subscribe first.
>
No virus found in this incoming message.
15:59
15:59
More information about the R-SIG-Finance
mailing list