Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to Extract stock data from Morningstar #557

Closed
allenwu25 opened this issue Jul 31, 2018 · 9 comments · Fixed by #558
Closed

Unable to Extract stock data from Morningstar #557

allenwu25 opened this issue Jul 31, 2018 · 9 comments · Fixed by #558

Comments

@allenwu25
Copy link

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_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,

~\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

@just2610
Copy link

just2610 commented Jul 31, 2018

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!

@jmercadodev
Copy link

jmercadodev commented Jul 31, 2018

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?

@luisocam
Copy link

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

alessandrozamberletti added a commit to alessandrozamberletti/sp500-forecaster that referenced this issue Jul 31, 2018
@Sagittar1us19
Copy link

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_datareader\data.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

@allenwu25
Copy link
Author

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?

@addisonlynch
Copy link
Contributor

addisonlynch commented Jul 31, 2018

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

@josephneuman502
Copy link

josephneuman502 commented Jul 31, 2018

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

@hubbins
Copy link

hubbins commented Aug 1, 2018

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

@addisonlynch
Copy link
Contributor

addisonlynch commented Aug 1, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants