Python: using Google Finance to load index data

I was able to download data from Google Finance, for example:

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) 

I thought I could use the same structure for index data. But this does not work:

 spx = web.DataReader('INDEXSP', 'google', start, end) RemoteDataError: Unable to read URL: http://www.google.com/finance/historical 

Does Google support this for indexes?

Or do I need a different protocol?

+7
python google-finance yahoo-finance google-finance-api quantitative-finance
source share
3 answers

Index data available:

if you made a call with the name <instrument> that the Google API was not ready to display historical records on it, try to find the correct <instrument> name manually.

S & P 500 INDEX ( INDEXCBOE:SPX )
v / s
S & P 500 ( INDEXSP:.INX )


DAX PERFORMANCE-INDEX ( INDEXDB:DAX )


Both work and serve data from Google Finance:

enter image description here

0
source share

For DAX, you can use "NASDAQ: DAX", which is downloaded from Google using the datareader. However, this ETF only starts from 2014-10-23.

0
source share

This is a problem on the part of Google. Compare the page of historical S & P prices with that for Google , and you will see that the latter has a link to “download to a spreadsheet”, and the former does not. pandas-datareader just disconnects from this csv link.

So, to your comment, I would not consider this broken implementation in pandas-datareader , only the one that will not work for cases when Google Finance does not provide this .csv.

0
source share

All Articles