Example #1
0
def debt(
    stock: str,
    date: datetime = datetime.now(),
    lookback_period: timedelta = timedelta(days=0),
    period: str = '',
    only_interest_expense=False,  # any interest-bearing liability to qualify
    all_liabilities=False,  # including accounts payable and deferred income
    long_term_debt=True,  # and its associated currently due portion (measures capital structure)
    exclude_current_portion_long_term_debt=False  # if true then also above should be true
):
    if long_term_debt:
        if not exclude_current_portion_long_term_debt:
            return fi.total_long_term_debt(stock=stock,
                                           date=date,
                                           lookback_period=lookback_period,
                                           period=period)
        else:
            return fi.long_term_debt_excluding_current_portion(
                stock=stock,
                date=date,
                lookback_period=lookback_period,
                period=period)

    if all_liabilities:
        return fi.total_liabilities(stock=stock,
                                    date=date,
                                    lookback_period=lookback_period,
                                    period=period)

    if only_interest_expense:
        return fi.interest_expense(stock=stock,
                                   date=date,
                                   lookback_period=lookback_period,
                                   period=period)
Example #2
0
def debt_service(stock: str,
                 date: datetime = datetime.now(),
                 lookback_period: timedelta = timedelta(days=0),
                 period: str = ''):
    return fi.interest_expense(stock=stock,
                               date=date,
                               lookback_period=lookback_period,
                               period=period)
Example #3
0
def cost_of_debt(stock,
                 date=datetime.now(),
                 lookback_period=timedelta(days=0),
                 period: str = 'FY'):
    interest_rate = fi.interest_expense(
        stock=stock, date=date, lookback_period=lookback_period, period=period
    ) / fi.total_long_term_debt(
        stock=stock, date=date, lookback_period=lookback_period, period=period)
    tax_rate = fi.income_tax_expense(
        stock=stock, date=date, lookback_period=lookback_period, period=period
    ) / me.earnings_before_taxes(
        stock=stock, date=date, lookback_period=lookback_period, period=period)
    return abs(interest_rate * (1 - tax_rate))