使用DataReader从Google财经下载货币数据

时间:2017-03-06 12:33:17

标签: python currency datareader google-finance

我正在尝试使用DateReader从Google财经下载EUR / USD历史数据,但我收到了错误,我无法处理它。

我的代码:

imported_data = data.DataReader('CURRENCY:EUR', 'google')

适用于纳斯达克:AAPL' NYSEARCA:GLD'和任何其他股票代码,但我无法使其适用于货币。

错误:

RemoteDataError                           Traceback (most recent call last)
<ipython-input-111-946aab4f973f> in <module>()
----> 1 imported_data = data.DataReader('CURRENCY:EUR', 'google',start=start_date)

C:\Users\user\Anaconda3\lib\site-packages\pandas_datareader\data.py in DataReader(name, data_source, start, end, retry_count, pause, session, access_key)
    130                                  chunksize=25,
    131                                  retry_count=retry_count, pause=pause,
--> 132                                  session=session).read()
    133 
    134     elif data_source == "enigma":

C:\Users\user\Anaconda3\lib\site-packages\pandas_datareader\base.py in read(self)
    153         # If a single symbol, (e.g., 'GOOG')
    154         if isinstance(self.symbols, (compat.string_types, int)):
--> 155             df = self._read_one_data(self.url, params=self._get_params(self.symbols))
    156         # Or multiple symbols, (e.g., ['GOOG', 'AAPL', 'MSFT'])
    157         elif isinstance(self.symbols, DataFrame):

C:\Users\user\Anaconda3\lib\site-packages\pandas_datareader\base.py in _read_one_data(self, url, params)
     72         """ read one data from specified URL """
     73         if self._format == 'string':
---> 74             out = self._read_url_as_StringIO(url, params=params)
     75         elif self._format == 'json':
     76             out = self._get_response(url, params=params).json()

C:\Users\user\Anaconda3\lib\site-packages\pandas_datareader\base.py in _read_url_as_StringIO(self, url, params)
     83         Open url (and retry)
     84         """
---> 85         response = self._get_response(url, params=params)
     86         text = self._sanitize_response(response)
     87         out = StringIO()

C:\Users\user\Anaconda3\lib\site-packages\pandas_datareader\base.py in _get_response(self, url, params)
    118         if params is not None and len(params) > 0:
    119             url = url + "?" + urlencode(params)
--> 120         raise RemoteDataError('Unable to read URL: {0}'.format(url))
    121 
    122     def _read_lines(self, out):

RemoteDataError: Unable to read URL: http://www.google.com/finance/historical?output=csv&startdate=Jan+01%2C+2012&enddate=Mar+06%2C+2017&q=CURRENCY%3AEUR

我非常感谢任何帮助!

Python 3.5.2 / Anaconda 4.2.0 / IPython 5.1.0

0 个答案:

没有答案