yfinance icon indicating copy to clipboard operation
yfinance copied to clipboard

Index Components

Open BeThaGlo opened this issue 3 years ago • 1 comments

Hi, would it be possible to add functionality allowing access to an index's component stocks. So for example, a get_components() method for a Ticker for the S&P500 (^GSPC)? Thanks a lot!

BeThaGlo avatar Jan 19 '22 02:01 BeThaGlo

It seems possible with utils.get_json(ticker_url + '/components', proxy, self.session) and then more specifically by extracting the components with data['components']['components'] at yfinance.utils line 108.

ProgrammingDao avatar Jan 30 '22 13:01 ProgrammingDao