【发布时间】:2017-10-21 01:28:47
【问题描述】:
我正在尝试从 Google 财经中提取指数的历史数据,但它不起作用。虽然我能够轻松提取个股的历史数据。我在索引方面做错了吗?
我的股票代码
from pandas_datareader import data
from dateutil.relativedelta import relativedelta
import datetime as dt
enddate = dt.datetime.today()
begdate = enddate + relativedelta(years=-1)
x= data.get_data_google("GOOGL",begdate,enddate)
print(x.head())
输出
Open High Low Close Volume
Date
2016-05-24 719.85 734.20 719.64 733.03 1890195
2016-05-25 735.00 739.89 732.60 738.10 1610773
2016-05-26 736.00 741.10 733.00 736.93 1298295
2016-05-27 737.51 747.91 737.01 747.60 1738913
2016-05-31 748.76 753.48 745.57 748.85 2124248
我的索引代码
x= data.get_data_google(".DJI",begdate,enddate)
错误
RemoteDataError: Unable to read URL: http://www.google.com/finance/historical
【问题讨论】:
标签: python pandas google-finance