Skip to content

Conversation

@longtu290
Copy link
Contributor

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Code styling or code optimize

Description

A new method named ticker_etf_holders() was added to the quote.py module. This method allows ETF ticker symbols to be extracted from the Finviz page of a specified stock. It enables programmatic access to the list of ETFs that hold the given ticker for analysis and comparison.

  • The ticker_etf_holders() method was implemented to locate and parse the "Held by" hyperlink on the Finviz stock page.

  • ETF ticker symbols were extracted from the query string and returned as a cleaned list.

  • Error handling was added to ensure the method returns an empty list when no ETF holders are available or the structure is invalid.

  • A descriptive docstring was included to document the method's purpose and return type.

Example:

When called for ticker AAPL, the following ETF holders list is returned:
['VTI', 'VOO', 'IVV', 'SPY', 'VUG', 'QQQ', 'VGT', 'IWF', 'XLK', 'SPLG']

Test:

The new ticker_etf_holders() method was tested using pytest to ensure reliability and correctness. A test case was written to verify that the method returns a list of ETF ticker symbols for a given stock (e.g., "AAPL"). The test confirmed that the return type is a list, that the list is not empty, and that all elements are strings. The test was executed successfully with no conflicts, and all assertions passed, confirming that the method behaves as expected under normal conditions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant