Skip to content

getSymbols is zoo or xts?

5 messages · Jeff Ryan, Guillaume Yziquel

#
Hello.

I'm currently wrapping up quantmod to Objective Caml using the OCaml-R 
binding I've recently been creating. It seems to be working fine, but 
I'm currently wondering things about the S3 typing of quotes retrieved 
via getSymbols.
It seems that getSymbols returns xts time series, but in the 
documentation, I only see zoo mentionned as output returned by getSymbols.

Should I assume that getSymbols returns zoo time series by default, or 
is it sytematically returning xts time series?

All the best,
#
Hi Guillaume,

It depends on the ultimate getSymbols call (e.g. getSymbols.yahoo or
getSymbols.rda...) but most return xts.

Docs indicate an xts object with getSymbols.yahoo, though this is
settable with return.class=  Can be almost any time-series class.

Make sure you have the most recent documentation (i.e. using the docs
with the package, not the ones at quantmod.com or elsewhere).

Best,
Jeff

On Fri, Dec 4, 2009 at 6:38 PM, Guillaume Yziquel
<guillaume.yziquel at citycable.ch> wrote:

  
    
#
Jeff Ryan a ?crit :
So, as far as I understand it, it mostly returns xts, but if I want to 
be conservative, zoo is guaranteed.
Yes, I saw that. I will have to think of a scheme to cleanly and 
correctly map this kind of dynamic typing to OCaml's static typing. This 
kind of problem is likely to happen often with OCaml-R.
I was indeed using help(getSymbols).
Thanks a lot for the quick feedback.
#
I don't know if guaranteed is correct.  I'd say it is xts more often
than not, but when 'not' it is zoo.

I think I would say xts to be conservative, but I certainly don't
understand your problem completely, so I am afraid I cannot be of more
help.

Jeff

On Fri, Dec 4, 2009 at 7:17 PM, Guillaume Yziquel
<guillaume.yziquel at citycable.ch> wrote:

  
    
#
Jeff Ryan a ?crit :
My problem is very simple: I have to give a type to the timeseries 
object I receive. No type checking will be done at runtime (like Python, 
R). Only type checking at compile time (like C, C++, Java).

So I have to know what the type of the timeseries will be. zoo or xts?

As I understand it, xts is built over zoo. If that means that all zoo 
attributes and methods have the same semantics in xts, then I'd rather 
go for zoo. To be conservative.

Because if I type getSymbol's "output" as an xts timeseries, I will have to:

-1- make a type check at runtime, which isn't really sexy,

-2- if I get a zoo timeseries instead of an xts one, I'll have to throw 
and catch an exception at runtime, which would be cumbersome.

That's my issue: Type safety in OCaml.