2017-07-05 45 views
1

我寫:無法和getSymbols連接到雅虎quantmod

library(quantmod) 
getSymbols("AAPL") 

我得到:

Error in curl::curl_download(cu, tmp, handle = h) : 
    Couldn't connect to server 

sessionInfo

> sessionInfo() 
R version 3.4.1 (2017-06-30) 



attached base packages: 
[1] stats  graphics grDevices utils  datasets methods base  

other attached packages: 
[1] quantmod_0.4-10 TTR_0.23-1  xts_0.9-7  zoo_1.8-0  

loaded via a namespace (and not attached): 
[1] compiler_3.4.1 tools_3.4.1  curl_2.7  grid_3.4.1  lattice_0.20-35 
> 

任何想法?

+0

嘗試重新運行它幾次 – AK88

+0

我試圖重新運行它幾次,仍然得到相同的答案...任何建議? – user8258891

+0

錯誤提示'curl'無法連接到互聯網。運行這個命令並編輯它的輸出到你的問題中:'w < - curl :: curl_fetch_memory(「https://finance.yahoo.com」,curl :: new_handle(verbose = TRUE))''。 –

回答

1

Yahoo! Finance API has been officially discontinued

您可能想要使用其他來源。對於谷歌:getSymbols("AAPL", src = "google")


您也可能想嘗試quandl,從許多出版商去抓取數據。 您也可以存儲在POSIXct數據索引xts對象,所以你仍然可以用quantmod繪製它:

Quandl("SOURCE/SYMBOL", type="xts") 

如果你打算每天通話50餘名,您將需要一個免費的API密鑰,對頻率或通話量沒有任何限制。

相關問題