How to access all the holdings in an ETF with yahooquery?

78 Views Asked by At

Is it possible to grab all of the holdings of an ETF within yahooquery?

The example code below shows the top 10 holdings of an example ETF, but not all of them. Is it possible to get all the holdings of an ETF within the yahooquery/yfinance packages?

from yahooquery import Ticker

t=Ticker("QQQ")
holdings = t.fund_holding_info['QQQ']['holdings']

holdings = pd.DataFrame.from_records(holdings)
print(holdings)

which returns the top 10 holdings of the given ETF.

  symbol                 holdingName  holdingPercent
0   MSFT              Microsoft Corp        0.089336
1   AAPL                   Apple Inc        0.086706
2   AMZN              Amazon.com Inc        0.048489
3   NVDA                 NVIDIA Corp        0.045946
4   AVGO                Broadcom Inc        0.043041
5   META  Meta Platforms Inc Class A        0.041650
6   TSLA                   Tesla Inc        0.027246
7  GOOGL        Alphabet Inc Class A        0.025067
8   GOOG        Alphabet Inc Class C        0.024543
9   COST       Costco Wholesale Corp        0.024024

If it's not possible with yahooquery is there another package that can do it?

0

There are 0 best solutions below