liveBook · Manning

Tax deferral

As explained in Build a Robo-Advisor with Python (From Scratch)

Tax deferral is the postponement of tax recognition or payment until a later taxable event.

Tax deferral postpones a tax payment or recognition event, leaving money available to invest until tax is ultimately due. Its value is the return earned on the deferred tax amount, not the elimination of the eventual liability. In tax-loss harvesting, realizing a loss can offset tax owed on gains today while preserving invested cash; the replacement investment carries a lower cost basis, which can create a larger taxable gain later. section 14.1 section 14.1.1

Deferring a $1,000 tax bill

Suppose a $100,000 ETF falls to $95,000 and a 20% tax rate makes its $5,000 loss worth $1,000. Realizing the loss can offset a $1,000 current tax bill, so the $1,000 cash remains invested. Buying a similar ETF with the $95,000 proceeds broadly preserves exposure, but resets basis from $100,000 to $95,000. If it later sells for $150,000, the realized gain is $55,000 rather than $50,000, shifting tax into the future. section 14.1.1

Deferral also shapes asset location. Unrecognized stock gains in a taxable account are already deferred until sale, while bond interest is typically paid currently and taxed at a relatively high rate. Placing bonds in an IRA and stocks in taxable can therefore direct the IRA’s deferral toward the more heavily taxed payouts, although IRA distributions are taxed as ordinary income. section 8.1

Listing 8.1 Defining the Asset() class
class Asset():
    def __init__(self, avg_ret=0.08, payout_rate=0.0, tax_rate_payout=0.2,  #1
                 tax_rate_cap_gains=0.2, tax_rate_ord_inc=0.35,  
                 turnover_rate=0, starting_value=500000, cost_basis=500000):
        self.avg_ret = avg_ret
        self.payout_rate = payout_rate
        self.tax_rate_payout = tax_rate_payout
        self.tax_rate_cap_gains = tax_rate_cap_gains
        self.tax_rate_ord_inc = tax_rate_ord_inc
        self.turnover_rate = turnover_rate
        self.starting_value = starting_value
        self.cost_basis = cost_basis
    def IRA_value(self, horizon=30):
        pretax_value = self.starting_value * (1+self.avg_ret)**horizon
        aftertax_value = pretax_value * (1-self.tax_rate_ord_inc)
        return aftertax_value
    def Taxable_value(self, horizon=30):
        curr_cost_basis = self.cost_basis
        curr_value = self.starting_value
        for year in range(1, horizon+1):
            taxes_div = self.payout_rate * curr_value * self.tax_rate_payout
            taxes_cap_gain = (self.turnover_rate * curr_value
                              * self.tax_rate_cap_gains)
            curr_cost_basis += ((self.payout_rate * curr_value)   #2
                               + (self.turnover_rate * curr_value)
                               - (taxes_div + taxes_cap_gain))
            curr_value = (curr_value * (1+self.avg_ret) 
                          - (taxes_div + taxes_cap_gain))
        aftertax_value = (curr_value 
                          - (curr_value - curr_cost_basis) 
                          * self.tax_rate_cap_gains)
        return aftertax_value
    def Taxable_minus_IRA(self, horizon=30):
        difference = (self.Taxable_value(horizon) - self.IRA_value(horizon) 
                      - self.starting_value * self.tax_rate_ord_inc)  #3
        return difference        
   
    def Roth_value(self, horizon=30):
        aftertax_value = self.starting_value * (1+self.avg_ret)**horizon
        return aftertax_value  

Compare projected after-tax IRA and taxable values by specifying return, payout, turnover, tax rates, starting value, and cost basis for an asset. section 8.1

Deferral is most useful when its assumptions hold:

  • Maintain a sufficiently long horizon; a horizon shorter than a year generally leaves little practical benefit because taxes are usually paid at year-end. section 14.1.3
  • Expect future tax rates to stay flat or decline; a higher future rate can outweigh the benefit of reducing tax today. section 14.1.3
  • Separate deferral from tax-rate conversion: harvesting may also produce a lower eventual rate, but that is a distinct benefit. section 14.1

How Build a Robo-Advisor with Python (From Scratch) covers it

How deep it goes
Works through cash, basis, future-gain, horizon, and tax-rate trade-offs without deriving a general present-value formula.
Examples
Uses stocks and bonds across an IRA and taxable account, plus a depreciated ETF used to offset a $1,000 tax bill.
What it assumes
Introduces the necessary account, payout, capital-gains, and cost-basis mechanics through concrete investment examples.
What you can do after
Evaluate/understand when postponing tax can improve after-tax value and when short horizons or rising rates can negate it.
How it connects
Connects tax deferral with tax-loss harvesting, cost basis, capital gains, asset location, IRAs, and tax rates.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build a Robo-Advisor with Python (From Scratch). The section links point to the parts of the book it draws on.