Shubha Vishwanath Karanth
2007-Sep-01 13:33 UTC
[R] Problem in downloading Yahoo Finance data from R
Hi R users, I have a problem in downloading Yahoo Finance data from R. I have tried an example given in R, to download. The error is given below:>library(fCalendar)> yahooImport("s=IBM&a=11&b=1&c=1999&d=0&q=31&f=2000&z=IBM&x=.csv ",file = "D:\\ Downlaod",source = "http://ichart.yahoo.com/table.csv?", save = FALSE, sep = ";", swap = 20, try = TRUE) trying URL 'http://ichart.yahoo.com/table.csv?s=IBM&a=11&b=1&c=1999&d=0&q=31&f=2000 &z=IBM&x=.csv' Error in download.file(url = url, destfile = file, method = method) : cannot open URL 'http://ichart.yahoo.com/table.csv?s=IBM&a=11&b=1&c=1999&d=0&q=31&f=2000 &z=IBM&x=.csv In addition: Warning message: unable to connect to 'ichart.yahoo.com' on port 80. in: download.file(url = url, destfile = file, method = method) [1] "No Internet Access">But the same URL, I can download in the same machine. So, What could be the problem? BR, Shubha [[alternative HTML version deleted]]
Hello Shubha,
alternative method that gets closing prices of the SP500 Index, last line
calculates the logreturns, easy to use data.
sp500 <- get.hist.quote("^GSPC",start=(today <-
Sys.Date())-735,quote="Cl")
rsp500 <- diff(log(sp500))
Shubha Vishwanath Karanth wrote:>
> Hi R users,
>
> I have a problem in downloading Yahoo Finance data from R. I have tried
> an example given in R, to download. The error is given below:
>
>
>>library(fCalendar)
>
>>
yahooImport("s=IBM&a=11&b=1&c=1999&d=0&q=31&f=2000&z=IBM&x=.csv
",
> file = "D:\\ Downlaod",source =
"http://ichart.yahoo.com/table.csv?",
> save = FALSE, sep = ";", swap = 20, try = TRUE)
>
> trying URL
>
'http://ichart.yahoo.com/table.csv?s=IBM&a=11&b=1&c=1999&d=0&q=31&f=2000
> &z=IBM&x=.csv'
>
> Error in download.file(url = url, destfile = file, method = method) :
>
> cannot open URL
>
'http://ichart.yahoo.com/table.csv?s=IBM&a=11&b=1&c=1999&d=0&q=31&f=2000
> &z=IBM&x=.csv
>
> In addition: Warning message:
>
> unable to connect to 'ichart.yahoo.com' on port 80. in:
> download.file(url = url, destfile = file, method = method)
>
> [1] "No Internet Access"
>
>>
>
>
>
> But the same URL, I can download in the same machine. So, What could be
> the problem?
>
>
>
> BR, Shubha
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>
>
--
View this message in context:
http://www.nabble.com/Problem-in-downloading-Yahoo-Finance-data-from-R-tf4364565.html#a12454603
Sent from the R help mailing list archive at Nabble.com.