Esempio n. 1
0
    def calculate_marginal_tax_rate(self)->float:
        """
        Calculates the marginal tax rate of the company or gives a default 30% if lower than 30%
        Returns
        -------
        marginal_tax_rate (float) :
        The tax rate is in percentage
        """

        income_df = self.income_statement

        income_before_tax = float(income_df.loc['Profit/Loss Before Tax', income_df.columns[0]])
        tax_expense = float(income_df.loc['Total Tax Expenses', income_df.columns[0]])

        # calculate marginal tax rate
        marginal_tax_rate = tax_expense / income_before_tax * 100
        default_marginal_tax_rate = resolve_config_value(['default', 'marginal_tax_rate'])
        marginal_tax_rate = marginal_tax_rate if marginal_tax_rate > default_marginal_tax_rate else default_marginal_tax_rate
        return marginal_tax_rate
Esempio n. 2
0
 def __init__(self):
     self.__config_details = resolve_config_value(['nse_india'])
Esempio n. 3
0
    def calculate_roe(self, stock_obj: Stock) -> float:
        """
        Calculates the minimum return on equity for the given stock

        Parameters
        ----------
        stock_obj (entities.Stock) : Contains all relevant information of the stock

        Returns
        -------
        (float) : The expected return on equity

        """

        dividend_df = stock_obj.dividend_history
        current_share_price = stock_obj.stock_price

        #usually the cod by Dividend Gordon method should be possible (as resolved by factory) - incase it is not
        if not stock_obj.check_dividend_history():
            logging.info(
                "Returning default cost of equity as the stock failed dividend check"
            )
            return float(resolve_config_value(['default', 'rate_of_equity']))

        # for the remaining part we will remove the initial years if the Dividend Amount is 0
        start_index = dividend_df['Dividend Amount'].__ne__(0).idxmax()
        dividend_df = dividend_df.loc[start_index:, :]
        # substracting 1 as the first year of dividend payout is not calculated for geometric growth rate
        total_years = len(dividend_df) - 1
        # calculate percentage change of dividend and add it as an additional
        # column in the dataframe
        dividend_df['Percentage Change'] = dividend_df[
            'Dividend Amount'].pct_change()
        # This does not give us in % but only as Delta/original

        # calculate the arithmetic growth rate of dividend
        # for this we need to ignore the first column which is NaN
        ap_growth = dividend_df['Percentage Change'].mean() * 100

        # calculate the geometric growth rate of dividend
        # Formula : {df['Dividend Amount'][-1]/df['Dividend Amount'][0]}^{1/total_years}
        gp_growth = (
            (dividend_df.loc[dividend_df.index[-1], 'Dividend Amount'] /
             dividend_df.loc[dividend_df.index[0], 'Dividend Amount'])
            **(1 / total_years)) * 100

        # Select the more conservative of the growth
        if ap_growth <= gp_growth:
            growth_rate = ap_growth
        else:
            growth_rate = gp_growth

        logging.info(
            "Have selected the growth rate for dividends to be {}".format(
                growth_rate))
        # Project for the next 5 years.
        last_year = dividend_df.index[-1]
        year_of_concern = last_year + 1

        for i in range(5):
            projected_amount = dividend_df.loc[
                last_year, 'Dividend Amount'] * (1 + growth_rate / 100)
            logging.info("Projected dividend for {} is {}".format(
                last_year, projected_amount))
            last_year = last_year + 1
            new_row = pd.Series({'Dividend Amount': projected_amount},
                                name=last_year)
            dividend_df = dividend_df.append(new_row)

            # calculate cost of equity
        logging.info(
            "Calculating the cost of equity with dividend amount: {}, current share price: {} and a conservative growth rate of {}"
            .format(dividend_df.loc[year_of_concern, 'Dividend Amount'],
                    current_share_price, growth_rate))
        roe = (dividend_df.loc[year_of_concern, 'Dividend Amount'] /
               current_share_price) * 100 + growth_rate
        return roe
 def __init__(self):
     self.__config_details = resolve_config_value(['moneycontrol'])
Esempio n. 5
0
 def __init__(self):
     self.__config_details = resolve_config_value(['trendlyne'])
 def __init__(self):
     self.__config_details = resolve_config_value(['investing'])