Pandas-datareader: Unable to Extract stock data from Morningstar

Created on 31 Jul 2018  路  9Comments  路  Source: pydata/pandas-datareader

I'm a beginner in python working with stock data. This morning I was able to extract stock data from the morningstar website fine, however when I try to do so now I receive the following error message shown below. What could be causing this issue and what can I do to fix it? Thanks

Exception Traceback (most recent call last)
in ()
63 '''
64
---> 65 df=web.DataReader('MMM','morningstar', start, end)
66 print(df)
67 stockname=df.to_csv('mmm.csv')

~\Documents\New folder (2)\lib\site-packages\pandas_datareaderdata.py in DataReader(name, data_source, start, end, retry_count, pause, session, access_key)
389 return MorningstarDailyReader(symbols=name, start=start, end=end,
390 retry_count=retry_count, pause=pause,
--> 391 session=session, interval="d").read()
392 elif data_source == 'robinhood':
393 return RobinhoodHistoricalReader(symbols=name, start=start, end=end,

~\Documents\New folder (2)\lib\site-packages\pandas_datareader\mstar\daily.py in read(self)
217 "type %s" % type(self.symbols))
218
--> 219 df = self._dl_mult_symbols(symbols=symbols)
220 if len(df.index.levels[0]) == 0:
221 raise ValueError("None of the provided symbols were valid")

~\Documents\New folder (2)\lib\site-packages\pandas_datareader\mstar\daily.py in _dl_mult_symbols(self, symbols)
128 else:
129 raise Exception("Request Error!: %s : %s" % (
--> 130 resp.status_code, resp.reason))
131
132 time.sleep(self.pause)

Exception: Request Error!: 404 : Not Found

Most helpful comment

Just ran into this 404 error myself.

Don't know if I should find a new method.

Or if we're supposed to wait for a new url?

All 9 comments

Found the same error : the url : http://globalquote.morningstar.com/globalcomponent/RealtimeHistoricalStockData.ashx

gives the following error

Server Error in '/GlobalComponent' Application.
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.

Requested URL: /globalcomponent/RealtimeHistoricalStockData.ashx

Looks like morningstar has changed their url for getting price quotes or there is an issue that they are working on!

Just ran into this 404 error myself.

Don't know if I should find a new method.

Or if we're supposed to wait for a new url?

Same issue here:

Exception                                 Traceback (most recent call last)
<ipython-input-43-9e3077e7f322> in <module>()
----> 1 SPY = web.DataReader('SPY', 'morningstar', start_date, end_date)

~/anaconda/lib/python3.5/site-packages/pandas_datareader/data.py in DataReader(name, data_source, start, end, retry_count, pause, session, access_key)
    389         return MorningstarDailyReader(symbols=name, start=start, end=end,
    390                                       retry_count=retry_count, pause=pause,
--> 391                                       session=session, interval="d").read()
    392     elif data_source == 'robinhood':
    393         return RobinhoodHistoricalReader(symbols=name, start=start, end=end,

~/anaconda/lib/python3.5/site-packages/pandas_datareader/mstar/daily.py in read(self)
    217                             "type %s" % type(self.symbols))
    218 
--> 219         df = self._dl_mult_symbols(symbols=symbols)
    220         if len(df.index.levels[0]) == 0:
    221             raise ValueError("None of the provided symbols were valid")

~/anaconda/lib/python3.5/site-packages/pandas_datareader/mstar/daily.py in _dl_mult_symbols(self, symbols)
    128                 else:
    129                     raise Exception("Request Error!: %s : %s" % (
--> 130                         resp.status_code, resp.reason))
    131 
    132             time.sleep(self.pause)

Exception: Request Error!: 404 : Not Found

Im getting the same issue. Worked fine for months til now.

Traceback (most recent call last):
File "c:\Python27.vscode\Strats\Index_gap_scan_final_saftey.py", line 666, in
strat.runstrat()
File "c:\Python27.vscode\Strats\Index_gap_scan_final_saftey.py", line 635, in runstrat
DF_1 = web.DataReader([i], "morningstar", Inputs.params['Filter_start'], Inputs.params['Filter_end'])
File "C:\Python27\lib\site-packages\pandas_datareaderdata.py", line 394, in DataReader
session=session, interval="d").read()
File "C:\Python27\lib\site-packages\pandas_datareader\mstar\daily.py", line 222, in read
df = self._dl_mult_symbols(symbols=symbols)
File "C:\Python27\lib\site-packages\pandas_datareader\mstar\daily.py", line 131, in _dl_mult_symbols
resp.status_code, resp.reason))
Exception: Request Error!: 404 : Not Found

This morning Morningstar still was not working, however I was able to extract data from Robinhood instead.

df=web.DataReader('MMM','robinhood', start, end)

While robinhood is able to provide stock data, the start and end dates I've set don't appear to work. The start date seems to be locked as July 31, 2017 (or 1 year from today), and the end date seems to be locked as today's date. Has anyone else tried this and had this problem?

Seems like a provider issue. The API isn't documented (I believe it came from here), so it's difficult to tell with certainty what changes were made / if it was taken down.

For now, I would recommend using other sources such as AlphaVantage, Quandl, or IEX. The simplest is IEX, which does not require an API key

df = web.DataReader('MMM', 'IEX', start, end)

cc: @dtemkin

Hey I am also running into the same problem with Morningstar, was working fine but now just returns a 404 error. I tried iex as @addisonlynch suggested but it seems to have a different output format than Morningstar had as its not playing nicely with my modifiers (such as:
#name.reset_index(inplace=True)
#name.set_index('Date', inplace= True)
#name=name.drop('Symbol', axis= 1)
)
The Morningstar module worked a lot nicer
Also, I tried using robinhood as @allenwu25 suggested, but I cant seem to plot the close_price data with matplotlib from
name['close_price'].plot
as I get ...lib\site-packages\pandas\plotting\_core.py", line 373, in _compute_plot_data 'plot'.format(numeric_data.__class__.__name__)) TypeError: Empty 'DataFrame': no numeric data to plot

I have confirmation from Morningstar that this service has been discontinued, it is not a temporary outage.

Thank you, @hubbins. We will likely mark this as deprecated for 0.7.0.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kumaranu7 picture kumaranu7  路  7Comments

vnmabus picture vnmabus  路  8Comments

waswaswas10 picture waswaswas10  路  7Comments

zhongdai picture zhongdai  路  5Comments

BajajAryan310 picture BajajAryan310  路  7Comments