Closed yunhongz closed 1 month ago
There were multiple efforts to support ETF and Mutual Funds Data. Some efforts were specific to expense ratios (https://github.com/ranaroussi/yfinance/pull/557), or holdings (https://github.com/ranaroussi/yfinance/pull/1872). These efforts also attempted to solve the issues in different methods (i.e. scraping html or using api).
Rather than implementing piece-wise, I think fund level data should be supported holistically as started by https://github.com/ranaroussi/yfinance/pull/1784 using the api method.
I will take this issue and also attempt to resolve the following issues/discussions in one go:
hi @yunhongz, following https://github.com/ranaroussi/yfinance/pull/2041, you are now able to query annualReportExpenseRatio
via:
spy = yf.Ticker('SPY')
data = spy.funds_data
data.fund_operations
Attributes | SPY | Category Average |
---|---|---|
Annual Report Expense Ratio | 0.000945 | 0.007769 |
Annual Holdings Turnover | 0.020000 | 0.490600 |
Total Net Assets | 308649.800000 | 308649.800000 |
Describe bug
With over 1100 ETFs traded in NYSE/Nasdaq, I couldn't find the 'annualReportExpenseRatio' value frrom their info records. Is this field no longer available?
import yfinace as yf
ticker='SPYI'
yf_ticker = yf.Ticker(ticker)
info = yf_ticker.get_info()
info.get('annualReportExpenseRatio')
Simple code that reproduces your problem
import yfinace as yf
ticker='SPYI'; yf_ticker = yf.Ticker(ticker); info = yf_ticker.get_info(); info.get('annualReportExpenseRatio')
ticker='QQQ'; yf_ticker = yf.Ticker(ticker); info = yf_ticker.get_info(); info.get('annualReportExpenseRatio')
ticker='SPY'; yf_ticker = yf.Ticker(ticker); info = yf_ticker.get_info(); info.get('annualReportExpenseRatio')
ticker='SPY'; yf_ticker = yf.Ticker(ticker); info = yf_ticker.get_info(); info.get('annualReportExpenseRatio')
Debug log
Bad data proof
No response
yfinance
versionyfinance 0.2.38
Python version
python3.10
Operating system
No response