implemented last idea

This commit is contained in:
Daniil Fajnberg 2021-11-28 16:42:21 +01:00
parent e7f3730c64
commit 4a68d45bc4

View File

@ -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) 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]: session: ClientSession = None) -> Dict[str, ResultDict]:
""" """
Returns all fundamentals (balance sheet, income statement and cash flow statement) of the specified company. 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 { return {
constants.BS: await get_balance_sheet(ticker_symbol, quarterly, session), sym: {
constants.IS: await get_income_statement(ticker_symbol, quarterly, session), constants.BS: await get_balance_sheet(sym, quarterly, session),
constants.CF: await get_cash_flow_statement(ticker_symbol, 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
} }