diff --git a/src/mwfin/functions.py b/src/mwfin/functions.py index 4454204..2f9cf18 100644 --- a/src/mwfin/functions.py +++ b/src/mwfin/functions.py @@ -138,7 +138,11 @@ async def get_cash_flow_statement(*ticker_symbols: str, quarterly: bool = False, @in_async_session async def _get_single_company_financials(ticker_symbol: str, quarterly: bool = False, session: ClientSession = None) -> Dict[str, ResultDict]: - pass + return { + constants.BS: await _get_financial_statement(constants.BS, ticker_symbol, quarterly, session), + constants.IS: await _get_financial_statement(constants.IS, ticker_symbol, quarterly, session), + constants.CF: await _get_financial_statement(constants.CF, ticker_symbol, quarterly, session) + } @in_async_session @@ -149,15 +153,5 @@ async def get_company_financials(*ticker_symbols: str, quarterly: bool = False, 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=quarterly, session=session), - constants.IS: await get_income_statement(ticker_symbols[0], quarterly=quarterly, session=session), - constants.CF: await get_cash_flow_statement(ticker_symbols[0], quarterly=quarterly, session=session) - } - return { - sym: { - constants.BS: await get_balance_sheet(sym, quarterly=quarterly, session=session), - constants.IS: await get_income_statement(sym, quarterly=quarterly, session=session), - constants.CF: await get_cash_flow_statement(sym, quarterly=quarterly, session=session) - } for sym in ticker_symbols - } + return await _get_single_company_financials(ticker_symbols[0], quarterly, session) + return {symbol: await _get_single_company_financials(symbol, quarterly, session) for symbol in ticker_symbols} diff --git a/tests/test_functions.py b/tests/test_functions.py index 250b57a..0ae8e1a 100644 --- a/tests/test_functions.py +++ b/tests/test_functions.py @@ -181,7 +181,6 @@ class FunctionsTestCase(IsolatedAsyncioTestCase): mock__get_single_company_financials.assert_called_once_with(symbol, quarterly, mock_session) mock__get_single_company_financials.reset_mock() - # keep test_symbol1, test_symbol2 = 'x', 'y' expected_output = {test_symbol1: expected_output, test_symbol2: expected_output} output = await functions.get_company_financials(test_symbol1, test_symbol2,