Python:使用Google财经下载索引数据

tro*_*rob 7 python google-finance google-finance-api quantitative-finance yahoo-finance

我成功地从Google财经下载了股票数据,如下所示:

import pandas as pd
from pandas_datareader import data as web   
import datetime
start = datetime.datetime(2016,1,1)
end   = datetime.date.today()
apple = web.DataReader('aapl', 'google', start, end)
Run Code Online (Sandbox Code Playgroud)

我以为我能够为索引数据使用相同的框架.但这不起作用:

spx = web.DataReader('INDEXSP', 'google', start, end)

RemoteDataError: Unable to read URL: http://www.google.com/finance/historical
Run Code Online (Sandbox Code Playgroud)

谷歌不支持索引吗?

或者我需要一个不同的协议?

use*_*197 0

可用指数数据:

鉴于您的调用已命名<instrument>Google API 尚未准备好映射到其历史记录,请首先尝试手动查找正确的<instrument>名称。

S&P 500 指数(INDEXCBOE:SPX)
vs
S&P 500 (INDEXSP:.INX)
...
DAX 表现指数 (INDEXDB:DAX)


两者都在 Google Finance 端工作并提供数据:

在此输入图像描述