使用 Google 而不是 Yahoo 作为数据源下载标准普尔 500 指数数据 [英] download S&P 500 data with Google as a data source, instead of Yahoo

查看:154
本文介绍了使用 Google 而不是 Yahoo 作为数据源下载标准普尔 500 指数数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不确定雅虎财务是否不再有效,但我最近一直在使用谷歌获取股票数据,因为雅虎公共数据不可用.但是,对于标准普尔 500 指数,我曾经使用符号 ^GSPC 曾经与 yahoo 一起使用,但不适用于 google.我尝试了以下方法:

Not sure if yahoo finances are no longer working, but I have been using google for stock data lately because yahoo public data are unavailable. However, for S&P 500 I used to use the symbol ^GSPC that used to work with yahoo, but doesn't work with google. I tried the following:

library(quantmod)
getSymbols('GSPC',src="google")
getSymbols('^GSPC',src="google")

生成错误消息.

谷歌财务是否有不同的符号来代表标准普尔 500 指数?

Is there a different symbol for google finances that represents S&P 500?

推荐答案

Yahoo Finance 运行良好.要下载 GSPC,您可以使用:

Yahoo Finance is working perfectly fine. For downloading GSPC you can use this:

SPX <- getSymbols("^GSPC",auto.assign = FALSE, from = "1980-01-01")

对于 goole 作为来源,您可以使用如下,这是针对 Johnson & 股票的.约翰逊

For goole as source you can use as below, this is for the stock Johnson & Johnson

JNJ <- getSymbols("JNJ",auto.assign = FALSE, from = "1980-01-01",src="google")

不过,对于索引,谷歌目前似乎没有工作.对于标准普尔 500 指数,我在谷歌金融中看到以下代码:

For the indices though, google does not seem to be working at the moment. For the S&P 500, I see the following ticker in google finance:

INDEXSP:.INX

这篇关于使用 Google 而不是 Yahoo 作为数据源下载标准普尔 500 指数数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆