From 4a68d45bc41528fb020bba252ae0379d9705ee52 Mon Sep 17 00:00:00 2001 From: Daniil Fajnberg Date: Sun, 28 Nov 2021 16:42:21 +0100 Subject: [PATCH] implemented last idea --- src/mwfin/functions.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/mwfin/functions.py b/src/mwfin/functions.py index a060183..e89875e 100644 --- a/src/mwfin/functions.py +++ b/src/mwfin/functions.py @@ -114,13 +114,21 @@ async def get_cash_flow_statement(ticker_symbol: str, quarterly: bool = False, return await _get_financial_statement(constants.CF, ticker_symbol, quarterly, session) -async def get_company_financials(ticker_symbol: str, quarterly: bool = False, +async def get_company_financials(*ticker_symbols: str, quarterly: bool = False, session: ClientSession = None) -> Dict[str, ResultDict]: """ Returns all fundamentals (balance sheet, income statement and cash flow statement) of the specified company. """ + if len(ticker_symbols) == 1: + return { + constants.BS: await get_balance_sheet(ticker_symbols[0], quarterly, session), + constants.IS: await get_income_statement(ticker_symbols[0], quarterly, session), + constants.CF: await get_cash_flow_statement(ticker_symbols[0], quarterly, session) + } return { - constants.BS: await get_balance_sheet(ticker_symbol, quarterly, session), - constants.IS: await get_income_statement(ticker_symbol, quarterly, session), - constants.CF: await get_cash_flow_statement(ticker_symbol, quarterly, session) + sym: { + constants.BS: await get_balance_sheet(sym, quarterly, session), + constants.IS: await get_income_statement(sym, quarterly, session), + constants.CF: await get_cash_flow_statement(sym, quarterly, session) + } for sym in ticker_symbols }