【发布时间】:2023-01-11 12:00:27
【问题描述】:
因为大约 2-3 周后,当我尝试使用 yfinance 或 yahoo_fin 包从 Yahoo Finance 请求收益数据时,我突然出现错误。
之前在 yfinance 中请求它的代码是:
import yfinance as yf
yf.Ticker("AMZN").earnings_dates
-> 现在它产生错误
\venv\lib\site-packages\yfinance\base.py", line 979, in get_earnings_dates
tz=self.info["exchangeTimezoneName"])
KeyError: 'exchangeTimezoneName'
(即使 earnings_dates() 与当地时区一起提供为 tz=...)
之前在 yahoo_fin 中请求它的代码是:
import yahoo_fin.stock_info as si
si.get_earnings_history("AMZN")
-> 现在它产生错误
\venv\lib\site-packages\yahoo_fin\stock_info.py", line 838, in get_earnings_history
return result["context"]["dispatcher"]["stores"]["ScreenerResultsStore"]["results"]["rows"]
TypeError: string indices must be integers
直到 2-3 周前,上述方法才可靠地工作,所以我怀疑雅虎财经主页的布局发生了变化,这些包从中获取数据,这些包还没有更新吗?
也许你们中有人知道其他事情?
亲切的问候,约翰内斯
【问题讨论】:
标签: python yahoo-finance yfinance