1

I'm new to python and I need help.When I'm trying to get stock data from yahoo finance,I get this error.Here is my code.Thanks for helping.

from matplotlib.mpl_finance import quotes_historical_yahoo_ochl
from datetime import date
import pandas as pd
today=date.today()
start=(today.year-2,today.month,today.day)
quotesMS=quotes_historical_yahoo_ochl('MSFT',start,today)
attributes=['date','open','close','high','low','volume']
quotesdfMS=pd.DataFrame(quotesMS,columns=attributes)
print(quotesdfMS)

and the problem is at the line 6

captain
  • 21
  • 1
  • 4
  • Possible duplicate of [URLError: ](https://stackoverflow.com/questions/45518528/urlerror-urlopen-error-errno-11001-getaddrinfo-failed) – greg_data Oct 10 '17 at 10:31

1 Answers1

2

Old question, sure, but the answer is that the API this library depends on has been discontinued:

Yahoo finance ichart service availability

A workaround is discussed here:

Python and Yahoo finance weird "YQLQueryError(response['error']['description'])" get_historical

greg_data
  • 2,247
  • 13
  • 20