我试图通过r中的Quantmod包从雅虎财经下载每日股票数据,我遇到一个错误消息,指出无法建立连接。
install.packages("quantmod")
library(quantmod)
getSymbols.yahoo(Symbols = "SPY")
Error in new.session() : Could not establish session after 5 attempts
首先请检查互联网,也检查代理,如果有的话,像@r2evans
提到的那样阻止连接。
更新QuantMod(使用remotes
包)并重试:
remotes::install_github("joshuaulrich/quantmod@358-getsymbols-new.session")
选择(使用remotes
或devtools
包):
# lightweight
remotes::install_github("joshuaulrich/quantmod")
# or
devtools::install_github("joshuaulrich/quantmod")
其中一个应该可以…