【问题标题】:Is Earnings history from Yahoo finance broken? (yfinance, yahoo_fin in Python)雅虎财经的盈利历史是否被打破? (yfinance,Python 中的 yahoo_fin)
【发布时间】: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


    【解决方案1】:

    同样的事情发生在我身上,我只是进去并注释掉了 base.py 中导致错误的两行,它运行得很好。

    【讨论】:

      猜你喜欢
      • 2023-03-16
      • 1970-01-01
      • 2022-12-05
      • 2018-04-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-11-29
      • 2015-05-07
      相关资源
      最近更新 更多