An effective tax rate estimates the tax impact of selling a particular holding by multiplying its percentage gain or loss by the applicable tax rate. It varies with both appreciation and holding period, so shares bought at different prices or times should be evaluated separately as tax lots. section 13.2.3
Comparing four tax lots
With a current price of $110, short-term gains taxed at 40%, and long-term gains at 20%, four lots produce effective rates of 7.5%, 11.76%, 1.90%, and −1.74%. The negative rate reflects a loss, making that lot the first candidate under a lowest-rate rule. section 13.2.3
A practical tax-aware sale process is:
- Compute each lot’s holding period, applicable rate, percentage gain or loss, and effective rate. section 13.2.3
- Order lots by effective rate and sell from the lowest-rate lot until the requested share quantity is reached. section 13.2.3
Listing 13.3 Calculating tax exposure
import datetime as dt
lt_gains_rate = 0.20
income_rate = .40
current_price = 110
current_date = dt.date(2022, 5, 11)
lots = pd.DataFrame({'price': [80, 85, 105, 115],
'quantity': [25, 30, 20, 10],
'purchase_date': ['2021-02-10', '2021-07-21',
'2021-11-23', '2022-03-25']})
tax_info = {}
for i in lots.index:
lot_info = lots.iloc[i]
purchase_date = dt.date.fromisoformat(lot_info['purchase_date'])
holding_period = (current_date - purchase_date).days
if holding_period <= 365:
lot_rate = income_rate
else:
lot_rate = lt_gains_rate
purchase_price = lot_info['price']
gain = (current_price / purchase_price - 1)
effective_rate = gain * lot_rate
tax_info[i] = pd.Series({'holding_period': holding_period,
'applicable_rate': lot_rate,
'pct_gain': gain,
'effective_rate': effective_rate})
tax_info = pd.DataFrame(tax_info).T
Inspect the Python implementation that calculates holding periods, applicable rates, gains, and effective rates for each lot. section 13.2.3
