two more functions implemented
This commit is contained in:
@ -61,14 +61,22 @@ def extract_row_data(tr: Tag) -> tuple[str, tuple[int]]:
|
||||
Returns the name of the item displayed in the table row (of a financial statement)
|
||||
as well as a number for each reporting period.
|
||||
"""
|
||||
pass
|
||||
item_name = str(tr.td.div.string).strip()
|
||||
data_div = tr.find_all('td')[-1].div.div
|
||||
values_str: str = data_div.attrs['data-chart-data']
|
||||
values = tuple(int(float(s)) for s in values_str.split(','))
|
||||
return item_name, values
|
||||
|
||||
|
||||
def extract_all_data(soup: BeautifulSoup) -> ResultDict:
|
||||
"""
|
||||
Extracts financials from the page.
|
||||
"""
|
||||
pass
|
||||
output = {constants.END_DATE: extract_end_dates(soup)}
|
||||
for row in find_relevant_table_rows(soup):
|
||||
row_data = extract_row_data(row)
|
||||
output[row_data[0]] = row_data[1]
|
||||
return output
|
||||
|
||||
|
||||
async def _get_financial_statement(statement: str, ticker_symbol: str, quarterly: bool = False,
|
||||
|
Reference in New Issue
Block a user