[R-SIG-Finance] Futures prices in quantmod?

Guillaume Yziquel guillaume.yziquel at citycable.ch
Mon Dec 7 23:55:32 CET 2009


Konrad Hoppe a écrit :
> Hi Guillaume,

Hi, Konrad.

> I tried a future from the first site you presented below. And you can load
> futures prices in the same way you use for "normal" assets:
> 
> from.dat <- as.Date("01/01/03", format="%m/%d/%y")
> to.dat <- as.Date(Sys.Date(), format="%m/%d/%y")
> 
> getSymbols("^XAU", src="yahoo", from = from.dat, to = to.dat)
> 
> regards
> Konrad

It seems that this depends on the specific future:

> > from.dat <- as.Date("01/01/03", format="%m/%d/%y")
> > to.dat <- as.Date(Sys.Date(), format="%m/%d/%y")
> > getSymbols("^XAU", src="yahoo", from = from.dat, to = to.dat)
> [1] "XAU"
> > getSymbols("^DJS2", src="yahoo", from = from.dat, to = to.dat)
> Erreur dans download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=", from.m,  : 
>   impossible d'ouvrir l'URL 'http://chart.yahoo.com/table.csv?s=^DJS2&a=0&b=01&c=2003&d=11&e=07&f=2009&g=d&q=q&y=0&z=^DJS2&x=.csv'
> De plus : Message d'avis :
> In download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=", from.m,  :
>   ouverture impossible : le statut HTTP était '404 Not Found'

Perhaps yahoo's policy prevents from downloading the Dow Jones 
Industrial Average, but not less common futures... (getQuote works fine 
though, so I'm a bit surprised).

Anyone knows, or knows how to know?

-- 
      Guillaume Yziquel
http://yziquel.homelinux.org/



More information about the R-SIG-Finance mailing list