def current_marketable_securities( stock, date=None, lookback_period: timedelta = timedelta(days=0), period: str = 'Q'): """ Hello Paola! :param stock: ticker(s) in question. Can be a string (i.e. 'AAPL') or a list of strings (i.e. ['AAPL', 'BA']). :param date: Can be a datetime (i.e. datetime(2019, 1, 1)) or list of datetimes. The most recent date of reporting from that date will be used. By default, date=datetime.now(). :param lookback_period: lookback from date (used to compare against previous year or quarter etc.) i.e. timedelta(days=90). :param period: 'FY' for fiscal year, 'Q' for quarter, 'YTD' for calendar year to date, 'TTM' for trailing twelve months. :return: """ return read_financial_statement_entry(financial_statement='BalanceSheet', stock=stock, entry_name=[ 'Assets', 'CurrentAssets', 'CashAndShortTermInvestments', 'MarketableSecurities' ], date=date, lookback_period=lookback_period, period=period)
def total_shares_outstanding(stock, diluted_shares: bool = False, date=None, lookback_period: timedelta = timedelta(days=0), period: str = 'Q'): """ :param stock: :param diluted_shares: Share dilution is when a company issues additional stock, reducing the ownership proportion of a current shareholder. Shares can be diluted through a conversion by holders of optionable securities, secondary offerings to raise additional capital, or offering new shares in exchange for acquisitions or services. :param date: :param lookback_period: :param period: :return: """ entry = ['LiabilitiesAndShareholdersEquity', 'ShareholdersEquity', 'CommonStockAndAdditionalPaidInCapital', 'WeightedAverageNumberOfSharesOutstandingDiluted'] if diluted_shares \ else ['LiabilitiesAndShareholdersEquity', 'ShareholdersEquity', 'CommonStockAndAdditionalPaidInCapital', 'WeightedAverageNumberOfSharesOutstandingBasic'] return read_financial_statement_entry(financial_statement='BalanceSheet', stock=stock, entry_name=entry, date=date, lookback_period=lookback_period, period=period)
def cash_flow_operating_activities( stock, date=None, lookback_period: timedelta = timedelta(days=0), period: str = 'TTM'): ''' Operating cash flow is a measure of cash generated/consumed by a business from its operating activities Computed as Net Income + Depreciation & Amortization + Non-Cash Items (i.e. stock-based compensation, unrealized gains/losses...) - Changes in Net Working Capital Unlike EBITDA, cash from operations is adjusted all non-cash items and changes in net working capital. However, it excludes capital expenditures. :param stock: :param date: :param lookback_period: :param period: :return: ''' return read_financial_statement_entry( financial_statement='CashFlowStatement', stock=stock, entry_name=[ 'OperatingActivities', 'NetCashProvidedByUsedInOperatingActivities' ], date=date, lookback_period=lookback_period, period=period)
def depreciation_and_amortization( stock, date=None, lookback_period: timedelta = timedelta(days=0), period: str = 'TTM'): """ This income statement expense reduces net income but has no effect on cash flow, so it must be added back when reconciling net income and cash flow from operations. :param stock: :param date: :param lookback_period: :param period: :return: """ return read_financial_statement_entry( financial_statement='CashFlowStatement', stock=stock, entry_name=[ 'AdjustmentsToReconcileNetIncome', 'DepreciationDepletionAndAmortization' ], date=date, lookback_period=lookback_period, period=period)
def cash_and_cash_equivalents(stock, date=None, lookback_period: timedelta = timedelta(days=0), period: str = 'Q'): """ **Cash and Cash Equivalents** is the amount of money on deposit in the bank. It is composed of * Short-term investments:sfsf * Cash: fh;ohif :param stock: ticker(s) in question. Can be a string (i.e. 'AAPL') or a list of strings (i.e. ['AAPL', 'BA']). :param date: Can be a datetime (i.e. datetime(2019, 1, 1)) or list of datetimes. The most recent date of reporting from that date will be used. By default, date=datetime.now(). :param lookback_period: lookback from date (used to compare against previous year or quarter etc.) i.e. timedelta(days=90). :param period: 'FY' for fiscal year, 'Q' for quarter, 'YTD' for calendar year to date, 'TTM' for trailing twelve months. :return: """ return read_financial_statement_entry( financial_statement='BalanceSheet', stock=stock, entry_name=['Assets', 'CurrentAssets', 'Cash and Cash Equivalents'], date=date, lookback_period=lookback_period, period=period)
def total_assets(stock, date=None, lookback_period: timedelta = timedelta(days=0), period: str = 'Q'): return read_financial_statement_entry(financial_statement='BalanceSheet', stock=stock, entry_name=['Assets', 'TotalAssets'], date=date, lookback_period=lookback_period, period=period)
def other_non_current_assets(stock, date=None, lookback_period: timedelta = timedelta(days=0), period: str = 'Q'): return read_financial_statement_entry( financial_statement='BalanceSheet', stock=stock, entry_name=['Assets', 'NonCurrentAssets', 'OtherNonCurrentAssets'], date=date, lookback_period=lookback_period, period=period)
def current_deferred_tax_assets(stock, date=None, lookback_period: timedelta = timedelta(days=0), period: str = 'Q'): return read_financial_statement_entry( financial_statement='BalanceSheet', stock=stock, entry_name=['Assets', 'CurrentAssets', 'DeferredTaxAssets'], date=date, lookback_period=lookback_period, period=period)
def assets_held_for_sale(stock, date=None, lookback_period: timedelta = timedelta(days=0), period: str = 'Q'): return read_financial_statement_entry( financial_statement='BalanceSheet', stock=stock, entry_name=['Assets', 'CurrentAssets', 'Assets Held-for-sale'], date=date, lookback_period=lookback_period, period=period)
def net_inventory(stock, date=None, lookback_period: timedelta = timedelta(days=0), period: str = 'Q'): return read_financial_statement_entry( financial_statement='BalanceSheet', stock=stock, entry_name=['Assets', 'CurrentAssets', 'InventoryNet'], date=date, lookback_period=lookback_period, period=period)
def non_operating_income(stock, date=None, lookback_period: timedelta = timedelta(days=0), period: str = 'TTM'): return read_financial_statement_entry( financial_statement='IncomeStatement', stock=stock, entry_name=['NonOperatingIncomeExpense', 'NonOperatingIncomeExpense'], date=date, lookback_period=lookback_period, period=period)
def payments_of_dividends(stock, date=None, lookback_period: timedelta = timedelta(days=0), period: str = 'TTM'): return read_financial_statement_entry( financial_statement='CashFlowStatement', stock=stock, entry_name=['FinancingActivities', 'PaymentsOfDividends'], date=date, lookback_period=lookback_period, period=period)
def total_operating_expenses(stock, date=None, lookback_period: timedelta = timedelta(days=0), period: str = 'TTM'): return read_financial_statement_entry( financial_statement='IncomeStatement', stock=stock, entry_name=['OperatingExpenses', 'TotalOperatingExpenses'], date=date, lookback_period=lookback_period, period=period)
def net_sales(stock, date=None, lookback_period: timedelta = timedelta(days=0), period: str = 'TTM'): return read_financial_statement_entry( financial_statement='IncomeStatement', stock=stock, entry_name=['Revenues', 'NetSales'], date=date, lookback_period=lookback_period, period=period)
def preferred_dividends(stock, date=None, lookback_period: timedelta = timedelta(days=0), period: str = 'TTM'): return np.nan_to_num( read_financial_statement_entry(financial_statement='IncomeStatement', stock=stock, entry_name=['PreferredStockDividends'], date=date, lookback_period=lookback_period, period=period))
def income_tax_expense(stock, date=None, lookback_period: timedelta = timedelta(days=0), period: str = 'TTM'): return read_financial_statement_entry( financial_statement='IncomeStatement', stock=stock, entry_name=['IncomeTaxExpenseBenefit'], date=date, lookback_period=lookback_period, period=period)
def net_income(stock, date=None, lookback_period: timedelta = timedelta(days=0), period: str = 'TTM'): return read_financial_statement_entry( financial_statement='IncomeStatement', stock=stock, entry_name=['NetIncomeLossAttributableToParent'], date=date, lookback_period=lookback_period, period=period)
def current_prepaid_expenses(stock, date=None, lookback_period: timedelta = timedelta(days=0), period: str = 'Q'): return read_financial_statement_entry( financial_statement='BalanceSheet', stock=stock, entry_name=['Assets', 'CurrentAssets', 'PrepaidExpense'], date=date, lookback_period=lookback_period, period=period)
def selling_general_administrative( stock, date=None, lookback_period: timedelta = timedelta(days=0), period: str = 'TTM'): return read_financial_statement_entry( financial_statement='IncomeStatement', stock=stock, entry_name=['OperatingExpenses', 'SellingGeneralAndAdministrative'], date=date, lookback_period=lookback_period, period=period)
def non_current_marketable_securities( stock, date=None, lookback_period: timedelta = timedelta(days=0), period: str = 'Q'): return read_financial_statement_entry( financial_statement='BalanceSheet', stock=stock, entry_name=['Assets', 'NonCurrentAssets', 'MarketableSecurities'], date=date, lookback_period=lookback_period, period=period)
def current_income_taxes_receivable( stock, date=None, lookback_period: timedelta = timedelta(days=0), period: str = 'Q'): return read_financial_statement_entry( financial_statement='BalanceSheet', stock=stock, entry_name=['Assets', 'CurrentAssets', 'IncomeTaxesReceivable'], date=date, lookback_period=lookback_period, period=period)
def interest_income(stock, date=None, lookback_period: timedelta = timedelta(days=0), period: str = 'TTM'): # TODO try InterestAndDividendIncome also return read_financial_statement_entry( financial_statement='IncomeStatement', stock=stock, entry_name=['NonOperatingIncomeExpense', 'InterestIncome'], date=date, lookback_period=lookback_period, period=period)
def research_development_expense( stock, date=None, lookback_period: timedelta = timedelta(days=0), period: str = 'TTM'): return read_financial_statement_entry( financial_statement='IncomeStatement', stock=stock, entry_name=['OperatingExpenses', 'ResearchAndDevelopmentExpense'], date=date, lookback_period=lookback_period, period=period)
def goodwill(stock, date=None, lookback_period: timedelta = timedelta(days=0), period: str = 'Q'): return read_financial_statement_entry(financial_statement='BalanceSheet', stock=stock, entry_name=[ 'Assets', 'NonCurrentAssets', 'IntangibleAssets', 'Goodwill' ], date=date, lookback_period=lookback_period, period=period)
def net_debt_issued(stock, date=None, lookback_period: timedelta = timedelta(days=0), period: str = 'TTM'): proceeds_from_issuance_of_debt = read_financial_statement_entry( financial_statement='CashFlowStatement', stock=stock, entry_name=[ 'Financing Activities', 'ProceedsFromIssuanceOfLongTermDebt' ], date=date, lookback_period=lookback_period, period=period) repayment_of_debt = abs( read_financial_statement_entry( financial_statement='CashFlowStatement', stock=stock, entry_name=['Financing Activities', 'RepaymentsOfLongTermDebt'], date=date, lookback_period=lookback_period, period=period)) return proceeds_from_issuance_of_debt - repayment_of_debt
def cost_of_goods_services(stock, date=None, lookback_period: timedelta = timedelta(days=0), period: str = 'TTM'): return read_financial_statement_entry( financial_statement='IncomeStatement', stock=stock, entry_name=[ 'CostOfGoodsAndServicesSold', 'CostOfGoodsAndServicesSold' ], date=date, lookback_period=lookback_period, period=period)
def acquisition_property_plant_equipment( stock, date=None, lookback_period: timedelta = timedelta(days=0), period: str = 'TTM'): return read_financial_statement_entry( financial_statement='CashFlowStatement', stock=stock, entry_name=[ 'InvestingActivities', 'PaymentsToAcquirePropertyPlantAndEquipment' ], date=date, lookback_period=lookback_period, period=period)
def minority_interest(stock, date=None, lookback_period: timedelta = timedelta(days=0), period: str = 'Q'): return read_financial_statement_entry( financial_statement='BalanceSheet', stock=stock, entry_name=[ 'LiabilitiesAndShareholdersEquity', 'ShareholdersEquity', 'MinorityInterest' ], date=date, lookback_period=lookback_period, period=period)
def cash_flow_financing_activities( stock, date=None, lookback_period: timedelta = timedelta(days=0), period: str = 'TTM'): return read_financial_statement_entry( financial_statement='CashFlowStatement', stock=stock, entry_name=[ 'FinancingActivities', 'NetCashProvidedByUsedInFinancingActivities' ], date=date, lookback_period=lookback_period, period=period)
def retained_earnings(stock, date=None, lookback_period: timedelta = timedelta(days=0), period: str = 'Q'): return read_financial_statement_entry( financial_statement='BalanceSheet', stock=stock, entry_name=[ 'LiabilitiesAndShareholdersEquity', 'ShareholdersEquity', 'RetainedEarningsAccumulatedDeficit' ], date=date, lookback_period=lookback_period, period=period)