Skip to content

Summary Module

Contains the classes and functions for scraping a yahoo finance summary page.

SummaryPage

Data scraped from the yahoo finance summary page.

Attributes:

  • symbol str - Ticker Symbol
  • name str - Ticker Name

  • quote Quote - Quote header section of the page.

  • open float - Open price.

  • high float - Days high.
  • low float - Days low.
  • close float - Days close price.

  • change float - Dollar change in price.

  • percent_change float - Percent change in price.

  • previous_close float - Previous days close price.

  • bid_price float - Bid price.

  • bid_size int - Bid size.

  • ask_price float - Ask price.

  • ask_size int - Ask size.

  • fifty_two_week_high float - High of the fifty two week range.

  • fifty_two_week_low float - Low of the fifty two week range.

  • volume int - Volume.

  • average_volume int - Average Volume.

  • market_cap int - Market capitalization.

  • beta_five_year_monthly float - Five year monthly prices benchmarked against the SPY.

  • pe_ratio_ttm float - Share Price divided by Earnings Per Share trailing twelve months.
  • eps_ttm float - Earnings per share trailing twelve months.

  • earnings_date Date - Estimated earnings report release date.

  • forward_dividend_yield float - Estimated dividend yield.

  • forward_dividend_yield_percentage float - Estimated divided yield percentage.
  • exdividend_date Date - Ex-Dividend Date.

  • one_year_target_est float - One year target estimation.

Notes:

This class inherits from the pydantic BaseModel which allows for the use of .json() and .dict() for serialization to json strings and dictionaries.

  • .json() - Serialize to a JSON object.
  • .dict() - Serialize to a dictionary.

__lt__

 | def __lt__(other) -> bool

Compare SummaryPage objects to allow ordering by symbol.

SummaryPageGroup

Group of SummaryPage objects from multiple symbols.

Attributes:

pages (SummaryPage):

Notes:

This class inherits from the pydantic BaseModel which allows for the use of .json() and .dict() for serialization to json strings and dictionaries.

  • .json() - Serialize to a JSON object.
  • .dict() - Serialize to a dictionary.

append

 | def append(page: SummaryPage) -> None

Append a SummaryPage to the SummaryPageGroup.

Arguments:

  • page SummaryPage - A SummaryPage object to add to the group.

symbols

 | def symbols() -> List[str]

List of symbols in the SummaryPageGroup.

sort

 | def sort() -> None

Sort SummaryPage objects by symbol.

dataframe

 | def dataframe() -> Optional[DataFrame]

Return a dataframe of multiple SummaryPage objects.

__iter__

 | def __iter__() -> Iterable

Iterate over SummaryPage objects.

__len__

 | def __len__() -> int

Length of SummaryPage objects.

parse_summary_table

def parse_summary_table(html: HTML) -> Optional[Dict]

Parse data from summary table HTML element.

get_summary_page

def get_summary_page(symbol: str, use_fuzzy_search: bool = True, page_not_found_ok: bool = False, **kwargs, ,) -> Optional[SummaryPage]

Get summary page data.

Arguments:

  • symbol str - Ticker symbol.
  • use_fuzzy_search bool - If True does a symbol lookup validation prior to requesting summary page data.
  • page_not_found_ok bool - If True Returns None when page is not found.
  • **kwargs - Pass (session, proxies, and timeout) to the requestor function.

Returns:

  • SummaryPage - When data is found.
  • None - No data is found and page_not_found_ok is True.

Raises:

  • AttributeError - When a page is not found and the page_not_found_ok arg is false.

get_multiple_summary_pages

def get_multiple_summary_pages(symbols: List[str], use_fuzzy_search: bool = True, page_not_found_ok: bool = True, with_threads: bool = False, thread_count: int = 5, progress_bar: bool = True, **kwargs, ,) -> Optional[SummaryPageGroup]

Get multiple summary pages.

Arguments:

  • symbols List[str] - Ticker symbols or company names.
  • use_fuzzy_search bool - If True does a symbol lookup validation prior to requesting data.
  • page_not_found_ok bool - If True Returns None when page is not found.
  • with_threads bool - If True uses threading.
  • thread_count int - Number of threads to use if with_threads is set to True.
  • **kwargs - Pass (session, proxies, and timeout) to the requestor function.
  • progress_bar bool - If True shows the progress bar else the progress bar is not shown.

Returns:

  • SummaryPageGroup - When data is found.
  • None - No data is found and page_not_found_ok is True.

Raises:

  • AttributeError - When a page is not found and the page_not_found_ok arg is false.