[R] quantmod Some Single Letter Tickers Not getFin

Sparks, John James jspark4 at uic.edu
Fri Mar 18 04:48:13 CET 2011


Hi,

I have been learning the quantmod package over the last several days.  I
went to check some of my data pulls against other sources and was
surprised to find that a few tickers that have single characters do not
successfully scrape from Google Finance using getFin().  Particularly

require(quantmod)
getFin("A")
getFin("E")
getFin("F")
getFin("G")
getFin("M")

all result in a file not found error.  I show the last one below.

> getFin("M")
Error in download.file(paste(google.fin, Symbol, sep = ""), quiet = TRUE,  :
  cannot open URL 'http://finance.google.com/finance?fstype=ii&q=M'
In addition: Warning message:
In download.file(paste(google.fin, Symbol, sep = ""), quiet = TRUE,  :
  cannot open: HTTP status was '400 Bad Request'


I checked out the financial statement pages for all of these and they
exist and are as expected:  5 quarters worth of quarterly figures (except
for cash-flow which has 4 quarters) and 4 years of annual figures.  All
the rows are also present by comparing a scrape to excel with the figures
for "Y", which does getFin("Y") without a problem.

I was hoping that someone who knows a lot more about scraping then I do
could look into this.

Best wishes to all,
--John Sparks



More information about the R-help mailing list