[Rd] Yahoo bug in tseries::get.hist.quote and its::priceIts
Dirk Eddelbuettel
edd at debian.org
Sun Apr 25 01:51:55 CEST 2004
On Sun, Apr 25, 2004 at 01:16:15AM +0200, Peter Dalgaard wrote:
> Dirk Eddelbuettel <edd at debian.org> writes:
>
> > Both get.hist.quote, and its derivative priceIts, rely on download.file() to
> > fetch financial data series from Yahoo! in .csv format. They allow for nice
> > interactive demonstrations of what one can do with R.
>
> Er, how does this affect get.hist.quote? I see some flakiness, but the
> basic conversion appears to work:
Ah, yes, my bad. I was working with priceIts, and it flakes out as its fails
on the NA the comment turns into:
> spc <- priceIts(instrument = "spc", start = "1998-01-01")
Error in validObject(.Object) : Invalid "its" object: Missing values in dates
Doug's suggestion of simply using '<' as the comment char is good. I was so
fixated on explaining '<!--' as one that I didn't think of '<'.
But ...
> How about this?
>
> > v <- readLines(url("http://chart.yahoo.com/table.csv?s=ibm&a=0&b=01&c=1998&d=3&e=24&f=2004&g=d&q=q&y=0&z=ibm&x=.csv"))
> > x <- read.csv(textConnection(v[-grep("^<!",v)]))
that wins the price. That is pretty much what I was thinking of. Neato.
Doesn't rely on the position of '<!--' within the file, and is less likely
to trigger a false positive as hunting for '<' is.
Thanks!
Dirk
--
The relationship between the computed price and reality is as yet unknown.
-- From the pac(8) manual page
More information about the R-devel
mailing list