Beispiel #1
0
def compute_after_tax_amount(hh, year, common, prices):
    """
    Compute net nominal return and net amount from withdrawal
    for unregistered assets.

    Parameters
    ----------
    hh: Hhold
        household
    year : int
        year
    common : Common
        instance of the class Common
    prices : Prices
        instance of the class Prices
    """
    nom = tools.create_nom(year, prices)
    hh_srd = file_household_inc_to_tax(hh, year, common, prices)
    hh_srd_0 = file_household(hh, year, common, prices)

    for who, p in enumerate(hh.sp):
        if p.liquidation_to_tax:
            p.liquidation_after_tax = nom(
                hh_srd.sp[who].disp_inc - hh_srd_0.sp[who].disp_inc)
        else:
            p.fin_assets['unreg'].amount_after_tax = nom(
                hh_srd.sp[who].disp_inc - hh_srd_0.sp[who].disp_inc)
Beispiel #2
0
    def update(self, d_returns, year, common, prices):
        """
        Function to update the balance for contributions, withdrawals and returns.

        Parameters
        ----------
        d_returns : dict of float
            dictionary of returns
        year : int
            year
        common : Common
            instance of the class Common
        prices : Prices
            instance of the class Prices
        """
        self.nom = tools.create_nom(year, prices)
        self.compute_income(d_returns, year)
        self.update_balance()
        self.prepare_withdrawal()
        self.adjust_income()
        self.withdrawal_cap_losses = self.adjust_cap_losses(
            self.withdrawal_cap_gains)
        self.adjust_final_balance()
        self.amount_after_tax = 0
        self.income_to_tax = bool(self.inc_div + self.inc_int)
Beispiel #3
0
def prepare_taxes(hh, year, common, prices):
    """
    Function to prepare the variables used in the SRD (in nominal terms).

    Parameters
    ----------
    hh: Hhold
        household
    year : int
        year
    common : Common
        instance of the class Common
    prices : Prices
        instance of the class Prices
    """
    nom = tools.create_nom(year, prices)

    for p in hh.sp:
        p.earn = p.d_wages[year]
        compute_rpp(p, nom, common)
        get_benefits_cpp(p, year, common)
        p.net_cap_gains = p.fin_assets['unreg'].withdrawal_cap_gains
        p.prev_cap_losses = p.fin_assets['unreg'].withdrawal_cap_losses
        p.div_elig = (common.share_div_elig
                      * p.fin_assets['unreg'].withdrawal_div)
        p.div_other_can = (hh.business.dividends_business / (1 + hh.couple)
                           if hasattr(hh, 'business') else 0)
        get_other_taxable(p, nom, common)
        get_other_non_taxable(p, nom)
        get_inc_rrsp(p, nom)
        get_contributions_assets(p, year, common)
        get_assets(p, common)
Beispiel #4
0
def get_gis_oas_allowances(hh, hh_tax, year, prices):
    """
    Computes nominal GIS, OAS and allowance benefits.

    Parameters
    ----------
    hh: Hhold
        household
    hh_tax : Hhold
        household
    year : int
        year
    prices : Prices
        instance of the class Prices
    """
    nom_2018 = tools.create_nom(year, prices)

    for who, p in enumerate(hh.sp):
        p.inc_gis = nom_2018(hh_tax.sp[who].inc_gis)
        p.inc_oas = nom_2018(hh_tax.sp[who].inc_oas)
        p.allow_surv = nom_2018(hh_tax.sp[who].allow_surv)
        p.allow_couple = nom_2018(hh_tax.sp[who].allow_couple)
Beispiel #5
0
def compute_bs_bef_ret(hh, year, common, prices):
    """
    Function to compute the pre-retirement balance sheet.

    Parameters
    ----------
    hh: Hhold
        household
    year : int
        year
    common : Common
        instance of the class Common
    prices : Prices
        instance of the class Prices
    """
    nom = tools.create_nom(year, prices)

    hh_srd = taxes.file_household(hh, year, common, prices)

    for who, p in enumerate(hh.sp):
        p.disp_inc_bef_ret = nom(hh_srd.sp[who].disp_inc)
    compute_cons_bef_ret(hh, year, prices)
Beispiel #6
0
def manage_liquidations(hh, year, common, prices):
    """
    Function that manages the liquidation of assets upon retirement.

    Parameters
    ----------
    hh: Hhold
        household
    year : int
        year
    common : Common
        instance of the class Common
    prices: Prices
        instance of the class Prices
    """
    nom = tools.create_nom(year, prices)

    for p in hh.sp:
        p.liquidation_non_taxable = 0
        p.liquidation_cap_gains = 0
        p.liquidation_cap_losses = 0
        p.liquidation_business_exempt = 0

    if year == getattr(hh, 'partial_ret_year', np.nan) - 1:
        unreg = hh.sp[0].fin_assets['unreg']
        unreg.liquidate()
        hh.sp[0].liquidation_non_taxable += unreg.liquidation_non_taxable
        hh.sp[0].liquidation_cap_gains += unreg.liquidation_cap_gains
        hh.sp[0].liquidation_cap_losses += unreg.liquidation_cap_losses

    if year == hh.ret_year - 1:
        for p in hh.sp:
            unreg = p.fin_assets['unreg']
            unreg.liquidate()
            p.liquidation_non_taxable += unreg.liquidation_non_taxable
            p.liquidation_cap_gains += unreg.liquidation_cap_gains
            p.liquidation_cap_losses += unreg.liquidation_cap_losses

        if common.sell_first_resid & ('first_residence' in hh.residences):
            first_res = hh.residences['first_residence']
            first_res.impute_rent(hh, year, common, prices)
            first_res.liquidate()
            liquidation_value = (first_res.liquidation_non_taxable
                                 + first_res.liquidation_cap_gains)
            if 'first_mortgage' in hh.debts:
                liquidation_value -= hh.debts['first_mortgage'].balance
                hh.debts['first_mortgage'].balance = 0
            for p in hh.sp:
                p.liquidation_non_taxable += (liquidation_value
                                              / (1 + hh.couple))

        if common.sell_second_resid & ('second_residence' in hh.residences):
            second_res = hh.residences['second_residence']
            second_res.liquidate()
            if 'second_mortgage' in hh.debts:
                second_res.liquidation_non_taxable -= (
                    hh.debts['second_mortgage'].balance)
                hh.debts['second_mortgage'].balance = 0
            for p in hh.sp:
                p.liquidation_non_taxable += (
                    second_res.liquidation_non_taxable / (1 + hh.couple))
                p.liquidation_cap_gains += (
                    second_res.liquidation_cap_gains / (1 + hh.couple))

        if common.sell_business & hasattr(hh, 'business'):
            hh.business.liquidate(common)
            liquidation_business_exempt = min(
                hh.business.liquidation_cap_gains, nom(common.lcge_real))
            for p in hh.sp:
                p.liquidation_non_taxable += (
                    hh.business.liquidation_non_taxable / (1 + hh.couple))
                p.liquidation_cap_gains += (
                    hh.business.liquidation_cap_gains / (1 + hh.couple))
                p.liquidation_business_exempt += (
                        liquidation_business_exempt / (1 + hh.couple))