You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Got KeyError: 'insiderTransactions' when invoke get_major_holders()
It seems that _fetch_and_parse() return data that does not contain "insiderTransactions" any more.
Simple code that reproduces your problem
def ticker_employees(symbol):
result = yf.Ticker(symbol,proxy=local_proxy,session=session).get_major_holders().to_dict()
return Response(result)
Debug log
Traceback (most recent call last):
File "/home/kn/PyProjects/ticker-api/.venv/lib/python3.10/site-packages/yfinance/scrapers/holders.py", line 103, in _fetch_and_parse
self._parse_insider_transactions(data["insiderTransactions"])
KeyError: 'insiderTransactions'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/kn/PyProjects/ticker-api/.venv/lib/python3.10/site-packages/flask/app.py", line 2552, in call
return self.wsgi_app(environ, start_response)
File "/home/kn/PyProjects/ticker-api/.venv/lib/python3.10/site-packages/flask/app.py", line 2532, in wsgi_app
response = self.handle_exception(e)
File "/home/kn/PyProjects/ticker-api/.venv/lib/python3.10/site-packages/flask/app.py", line 2529, in wsgi_app
response = self.full_dispatch_request()
File "/home/kn/PyProjects/ticker-api/.venv/lib/python3.10/site-packages/flask/app.py", line 1825, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/kn/PyProjects/ticker-api/.venv/lib/python3.10/site-packages/flask/app.py", line 1823, in full_dispatch_request
rv = self.dispatch_request()
File "/home/kn/PyProjects/ticker-api/.venv/lib/python3.10/site-packages/flask/app.py", line 1799, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
File "/home/kn/PyProjects/ticker-api/app.py", line 106, in ticker_employees
result = yf.Ticker(symbol,proxy=local_proxy,session=session).get_major_holders().to_dict()
File "/home/kn/PyProjects/ticker-api/.venv/lib/python3.10/site-packages/yfinance/base.py", line 175, in get_major_holders
data = self._holders.major
File "/home/kn/PyProjects/ticker-api/.venv/lib/python3.10/site-packages/yfinance/scrapers/holders.py", line 35, in major
self._fetch_and_parse()
File "/home/kn/PyProjects/ticker-api/.venv/lib/python3.10/site-packages/yfinance/scrapers/holders.py", line 107, in _fetch_and_parse
raise YFinanceDataException("Failed to parse holders json data.")
yfinance.exceptions.YFinanceDataException: Failed to parse holders json data.
Bad data proof
No response
yfinance version
0.2.37
Python version
No response
Operating system
No response
The text was updated successfully, but these errors were encountered:
I have the same issue, I iterated these elements in bold failing
But I noted this only with SPOTify, many other tickers OK like 'MA', 'PFE', 'META', 'INTC', 'MSFT', 'NFLX'
could it by some kind of random rate limiter in yfinance?
ticker = yf.Ticker('SPOT')
Describe bug
Got KeyError: 'insiderTransactions' when invoke get_major_holders()
It seems that _fetch_and_parse() return data that does not contain "insiderTransactions" any more.
Simple code that reproduces your problem
def ticker_employees(symbol):
result = yf.Ticker(symbol,proxy=local_proxy,session=session).get_major_holders().to_dict()
return Response(result)
Debug log
Traceback (most recent call last):
File "/home/kn/PyProjects/ticker-api/.venv/lib/python3.10/site-packages/yfinance/scrapers/holders.py", line 103, in _fetch_and_parse
self._parse_insider_transactions(data["insiderTransactions"])
KeyError: 'insiderTransactions'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/kn/PyProjects/ticker-api/.venv/lib/python3.10/site-packages/flask/app.py", line 2552, in call
return self.wsgi_app(environ, start_response)
File "/home/kn/PyProjects/ticker-api/.venv/lib/python3.10/site-packages/flask/app.py", line 2532, in wsgi_app
response = self.handle_exception(e)
File "/home/kn/PyProjects/ticker-api/.venv/lib/python3.10/site-packages/flask/app.py", line 2529, in wsgi_app
response = self.full_dispatch_request()
File "/home/kn/PyProjects/ticker-api/.venv/lib/python3.10/site-packages/flask/app.py", line 1825, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/kn/PyProjects/ticker-api/.venv/lib/python3.10/site-packages/flask/app.py", line 1823, in full_dispatch_request
rv = self.dispatch_request()
File "/home/kn/PyProjects/ticker-api/.venv/lib/python3.10/site-packages/flask/app.py", line 1799, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
File "/home/kn/PyProjects/ticker-api/app.py", line 106, in ticker_employees
result = yf.Ticker(symbol,proxy=local_proxy,session=session).get_major_holders().to_dict()
File "/home/kn/PyProjects/ticker-api/.venv/lib/python3.10/site-packages/yfinance/base.py", line 175, in get_major_holders
data = self._holders.major
File "/home/kn/PyProjects/ticker-api/.venv/lib/python3.10/site-packages/yfinance/scrapers/holders.py", line 35, in major
self._fetch_and_parse()
File "/home/kn/PyProjects/ticker-api/.venv/lib/python3.10/site-packages/yfinance/scrapers/holders.py", line 107, in _fetch_and_parse
raise YFinanceDataException("Failed to parse holders json data.")
yfinance.exceptions.YFinanceDataException: Failed to parse holders json data.
Bad data proof
No response
yfinance
version0.2.37
Python version
No response
Operating system
No response
The text was updated successfully, but these errors were encountered: