2

i am trying to download EUR/USD historical data from Google Finance with DateReader but i got error and i can't deal with it.

My code:

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

It works for 'NASDAQ:AAPL', 'NYSEARCA:GLD' and any other stock ticker but i can't make it work for currencies.

Error:

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

I would greatly appreciate any help!

Python 3.5.2 / Anaconda 4.2.0 / IPython 5.1.0

overb
  • 127
  • 2
  • 10
  • Based on the link below it seems that `output=csv` is erroneus. But it seems that `output=json` or `output=xml` would work. Perhaps consider changing reader api? – Piotr Kamoda Mar 06 '17 at 12:41
  • Also response file for some reason is empty – Piotr Kamoda Mar 06 '17 at 12:42
  • @PiotrKamoda I've tried Yahoo instead and the problem remains. What it's interesting that "EUR=X" (which is actually USD/EUR) works but "EURUSD=X" (EUR/USD) does not. The error is exactly the same as with Google Finance which bring me a conclusion that maybe there is needed a diffrent syntax for currencies but still i don't have idea how it may looks like. – overb Mar 06 '17 at 13:21
  • Did you find a solution for this? – Yster Jun 17 '17 at 08:32
  • @Yster Unfortunately not. I've used Yahoo finance but it stopped working couple of weeks ago (changes in Yahoo). – overb Jun 28 '17 at 08:11

0 Answers0