Yahoo changed access?
I tried the code in the example of yfinance and it returns an error. Code: import yfinance as yf msft = yf.Ticker("MSFT")
get stock info
msft.info
get historical market data
hist = msft.history(period="max") Error: Traceback (most recent call last):
File "C:\Users\Win-7\anaconda3\lib\site-packages\requests\models.py", line 971, in json return complexjson.loads(self.text, **kwargs)
File "C:\Users\Win-7\anaconda3\lib\site-packages\simplejson_init_.py", line 525, in loads return _default_decoder.decode(s)
File "C:\Users\Win-7\anaconda3\lib\site-packages\simplejson\decoder.py", line 370, in decode obj, end = self.raw_decode(s)
File "C:\Users\Win-7\anaconda3\lib\site-packages\simplejson\decoder.py", line 400, in raw_decode return self.scan_once(s, idx=_w(s, idx).end())
File "C:\Users\Win-7\anaconda3\lib\site-packages\simplejson\scanner.py", line 79, in scan_once return _scan_once(string, idx)
File "C:\Users\Win-7\anaconda3\lib\site-packages\simplejson\scanner.py", line 70, in _scan_once raise JSONDecodeError(errmsg, string, idx)
JSONDecodeError: Expecting value
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "F:\AI\Wavelets\Production\untitled1.py", line 16, in
File "C:\Users\Win-7\anaconda3\lib\site-packages\yfinance\base.py", line 157, in history data = data.json()
File "C:\Users\Win-7\anaconda3\lib\site-packages\requests\models.py", line 975, in json raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
JSONDecodeError: Expecting value
I can't get any earnings or other info although I don't get any errors during the call
msft.quarterly_balancesheet.size
0
same thing here, nothing return with any of the method or attributes.
I am experiencing the same issue with some of my apps in production. I think yahoo finance has revoked access to yfinance. The api is not working anymore.
It does work in development on my local machine, it could be a conflict with different versions of the package and python. Running some tests to see if that is the issue, will post on this thread if I was able to fix it.
Update
solution
package works fine, I had to delete env and reinstall packages then redeploy. It works now :)
Deleted and reloading yfinance then using yfinance directly works. pandas datareader is not working. I bet you need to reload pandas. I tried updating pandas but that did not work.