[R] Downloading quote data from yahoo finance
Mike Marchywka
marchywka at hotmail.com
Sat Dec 4 22:41:44 CET 2010
----------------------------------------
> From: josh.m.ulrich at gmail.com
> Date: Sat, 4 Dec 2010 14:47:45 -0600
> To: debmidya at yahoo.com
> CC: r-help at r-project.org
> Subject: Re: [R] Downloading quote data from yahoo finance
>
> On Wed, Dec 1, 2010 at 11:15 PM, Deb Midya wrote:
> > Hi R users,
> >
> > Thanks in advance.
> >
> >
> > May I request you to assist me in the following please.
> >
> > 1. I am getting error while downloading quote data from yahoo finance.
> >
> > The example code is below (taken from tseries help):
> >
> > library(tseries)
> >
> > con <- url("http://quote.yahoo.com")
> > if(!inherits(try(open(con), silent = TRUE), "try-error")) {
> > close(con)
> > x <- get.hist.quote(instrument = "^gspc", start = "1998-01-01",
> > quote = "Close")
> > plot(x)
> > x <- get.hist.quote(instrument = "ibm", quote = c("Cl", "Vol"))
> > plot(x, main = "International Business Machines Corp")
> > spc <- get.hist.quote(instrument = "^gspc", start = "1998-01-01",
> > quote = "Close")
> > ibm <- get.hist.quote(instrument = "ibm", start = "1998-01-01",
> > quote = "AdjClose")
> > x <- merge(spc, ibm)
> > plot(x, main = "IBM vs S&P 500")
> > x <- get.hist.quote(instrument = "EUR/USD", provider = "oanda",
> > start = Sys.Date() - 500)
> > plot(x, main = "EUR/USD")
> > }
> >
> > Error message:
> >
> > Warning message:
> > In open.connection(con) :
> > unable to connect to 'quote.yahoo.com' on port 80.
> >
> The example works for me. Are you behind a firewall or proxy?
>
> > 2. How can I download Key Statistics Data from Yahoo Finance
> >
> > A. http://finance.yahoo.com/
> >
> > B. ASH.AX (Using GET QUOTES)
> >
> > C. Key Statistics
> >
> > How can I download Key Statistics dynamically (Using R code)
> >
> library(quantmod)
> getFinancials("IBM")
> viewFinancials(IBM.f)
>
Does this R code talk to yhoo for real time or historical
data? I'm surprised there is a package dedicated to
specific specialized data sources although if the package itself
is as the name implies then code for even scraping html
from some sources may be a nice feature. The reason I ask
is that the SEC is going to more stuctured submissions,
http://xbrl.sec.gov/
and I was curious if anyone has related code
for collating fundamental information such
as this. In one of my rants, I suggested that real
estate transactions be revealed in a similar machine
readable format, a large R constituency would
help make that case more persuasive :)
Commercial downloads are not usually stable enough
for reference from automated packages
although I have lots of my own private
scripts for stuff like that, even scraping data
from adversarial commercial and public sites.
Thanks.
> >
> > Thank you very much for the time you have given.
> >
> > Regards,
> >
> > Deb
> >
> >
> >
>
> Hope that helps,
> --
> Joshua Ulrich | FOSS Trading: www.fosstrading.com
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list