Summary Module
Contains the classes and functions for scraping a yahoo finance summary page.
SummaryPage
Data scraped from the yahoo finance summary page.
Attributes:
symbolstr - Ticker Symbol
namestr - Ticker Name
quoteQuote - Quote header section of the page.
openfloat - Open price.highfloat - Days high.lowfloat - Days low.
closefloat - Days close price.
changefloat - Dollar change in price.
percent_changefloat - Percent change in price.
previous_closefloat - Previous days close price.
bid_pricefloat - Bid price.
bid_sizeint - Bid size.
ask_pricefloat - Ask price.
ask_sizeint - Ask size.
fifty_two_week_highfloat - High of the fifty two week range.
fifty_two_week_lowfloat - Low of the fifty two week range.
volumeint - Volume.
average_volumeint - Average Volume.
market_capint - Market capitalization.
beta_five_year_monthlyfloat - Five year monthly prices benchmarked against the SPY.pe_ratio_ttmfloat - Share Price divided by Earnings Per Share trailing twelve months.
eps_ttmfloat - Earnings per share trailing twelve months.
earnings_dateDate - Estimated earnings report release date.
forward_dividend_yieldfloat - Estimated dividend yield.forward_dividend_yield_percentagefloat - Estimated divided yield percentage.
exdividend_dateDate - Ex-Dividend Date.
one_year_target_estfloat - 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:
pageSummaryPage - 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:
symbolstr - Ticker symbol.use_fuzzy_searchbool - If True does a symbol lookup validation prior to requesting summary page data.page_not_found_okbool - 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:
symbolsList[str] - Ticker symbols or company names.use_fuzzy_searchbool - If True does a symbol lookup validation prior to requesting data.page_not_found_okbool - If True Returns None when page is not found.with_threadsbool - If True uses threading.thread_countint - Number of threads to use if with_threads is set to True.**kwargs- Pass (session, proxies, and timeout) to the requestor function.progress_barbool - 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.