我正在使用两个文件。第一个文件是实际的代码和第二个文件是参考文件无法从谷歌下载R数据
##########################################
## Daily prices from Yahoo
## [email protected] - Nov. 2015
##########################################
library(quantmod)
startDate = "2014-01-01"
thePath = "D:\\daily\\data\\"
cattest <- file("D:\\daily\\error\\error.csv", open = "w")
source(paste("D:\\Reference\\","listOfInstruments.r",sep=""))
cattest <- file("D:\\daily\\error\\error.csv", open = "a")
for (ii in theInstruments)
tryCatch(
{
print(ii)
data = getSymbols(Symbols = ii,
src = "google",
from = startDate,
auto.assign = TRUE,verbose = TRUE)
colnames(data) = c("Date","Open","High","Low","Close","Volume")
write.zoo(data,paste(thePath,ii,".csv",sep=""),sep=",",row.names=FALSE)
}
,error=function(e){cat(ii, "\n", file=cattest)})
close(cattest)
我试图下载使用下面的代码来自谷歌的数据,但它不下载任何东西什么我做错了这里
Reference file
##########################################
## List of securities (Yahoo tickers)
## [email protected] - Nov. 2015
##########################################
theInstruments = c("^GSPC",
"SPY",
"QQQ",
"DDM",
"EFA",
"EEM",
"EWJ")
错误似乎是
done.
Warning messages:
1: In fname %in% c("break", "next") :
closing unused connection 3 (D:\daily\error\error.csv)
2: In download.file(paste(google.URL, "q=", Symbols.name, "&startdate=", :
cannot open URL 'http://finance.google.com/finance/historical?q=^GSPC&startdate=Jan+01,+2014&enddate=Jun+16,+2017&output=csv': HTTP status was '404 Not Found'
你得到什么样的错误/消息的? – AK88
@ AK88更新问题 – NewtoPython