Exemple #1
0
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)
Exemple #2
0
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

    *   Cash: ticker(s) in question. Can be a string (i.e. 'AAPL') or a list of strings (i.e. ['AAPL', 'BA']).  t
        icker(s) in question. Can be a string (i.e. 'AAPL') or a list of strings (i.e. ['AAPL', 'BA']). ticker(s)
        in question. Can be a string (i.e. 'AAPL') or a list of strings (i.e. ['AAPL', 'BA']). ticker(s) in questio
        n. Can be a string (i.e. 'AAPL') or a list of strings (i.e. ['AAPL', 'BA']). ticker(s) in question.
        Can be a string (i.e. 'AAPL') or a list of strings (i.e. ['AAPL', 'BA']).

    *   Short-term investments:

    :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)
Exemple #3
0
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)
Exemple #4
0
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)
Exemple #5
0
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)
Exemple #6
0
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)
Exemple #7
0
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)
Exemple #8
0
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))
Exemple #9
0
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)
Exemple #10
0
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)
Exemple #11
0
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)
Exemple #12
0
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)
Exemple #13
0
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)
Exemple #14
0
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)
Exemple #15
0
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)
Exemple #16
0
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)
Exemple #17
0
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)
Exemple #18
0
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)
Exemple #19
0
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)
Exemple #20
0
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)
Exemple #21
0
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)
Exemple #22
0
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)
Exemple #23
0
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)
Exemple #24
0
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)
Exemple #25
0
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
Exemple #26
0
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)
Exemple #27
0
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)
Exemple #28
0
def additional_paid_in_capital(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',
            'CommonStockAndAdditionalPaidInCapital', 'AdditionalPaidInCapital'
        ],
        date=date,
        lookback_period=lookback_period,
        period=period)
Exemple #29
0
def preferred_stock_value(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',
            'PreferredStockValueIssued'
        ],
        date=date,
        lookback_period=lookback_period,
        period=period)
Exemple #30
0
def total_liabilities(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', 'Liabilities',
            'TotalLiabilities'
        ],
        date=date,
        lookback_period=lookback_period,
        period=period)