Automatically download finance data via Google API

As Yahoo! Finance deprecated the API in late 2017 and Google changed their Finance URL, below is an alternative to download finance data.



from pandas_datareader.google.daily import GoogleDailyReader

@property
def url(self):
    return 'http://finance.google.com/finance/historical'

GoogleDailyReader.url = url

# get data
import pandas_datareader as pdr
from datetime import datetime
start = datetime(2014,1,1)
end = datetime(2018,2,5)
ret = pdr.get_data_google(['FB'], start, end)


Reference
  • Documentation about other alternative API for downloading finance data here
  • GitHub discussion about Google new Finance URL here

Comments