Tax-location plan: taxable account vs IRA per fund

fundlab/taxplan.py categorizes the 16-fund shortlist, the 22 N-PORT
cross-checked candidates, and all 250 screened candidates by the
expected CHARACTER of their distributions, given the user's premise
that the current LTCG rate < the post-retirement ordinary rate:

  qualified div + LTCG      -> TAXABLE  (score >= 0.60)
  tax-exempt (munis)        -> TAXABLE
  ordinary / STCG / REIT    -> IRA      (score <= 0.35)
  in between                -> MIXED (pull the 1099-DIV)
  cash                      -> FLEXIBLE

score = estimated share of distributions that are tax-favorable,
from three tiers of ground truth: N-PORT keyword buckets (16), SEC
assetCat/issuerCat buckets (22), sleeve loadings (250), with a
sleeve fallback when the keyword parser left >50% of a book
unclassified, and a manual override for the Leuthold wrappers
(91.7% Leuthold Core ETF, no return history yet).

Key findings:
- shortlist: TAXABLE = ATESX, JLPSX, LAMHX, LCORX, LCRIX (equity);
  IRA = ATRFX, COSIX, CVSIX, PMORX, SVARX, EAGMX/EGRSX;
  MIXED = MBXIX, QSPNX, PMAIX/PMFKX (same fund, two classes)
- cross-checked: 4 munis -> TAXABLE; HMEZX + MERVX are the merger-
  arb trap - equity-looking books whose distributions are mostly
  SHORT-TERM gains -> IRA
- candidates: 109 munis TAXABLE, 127 IRA, 6 equity TAXABLE, 7 MIXED

App: Fund Lab "Tax location" expander. Output:
fundlab/taxplan_results.json. Tests: test_taxplan() (9 checks).
97/32 suites green.
This commit is contained in:
gmp
2026-08-27 14:08:15 -04:00
parent d0ae2ec348
commit 8a9ca25750
5 changed files with 2919 additions and 0 deletions
+63
View File
@@ -452,6 +452,68 @@ def test_xcheck() -> None:
and s.endswith("Advantage Fund"), str(s))
def test_taxplan() -> None:
print("taxplan", flush=True)
import fundlab.taxplan as tp
# equity book -> taxable
r = tp.classify("Some US Equity Fund",
buckets=[{"name": "Equity (common)", "pct": 80},
{"name": "Cash/MMF (short-term)", "pct": 20}])
check("equity fund -> TAXABLE", r["location"] == "TAXABLE",
f"{r['location']} {r['score']}")
# bond book -> IRA
r = tp.classify("Some Bond Fund",
buckets=[{"name": "Corporate bond", "pct": 70},
{"name": "US Treasury", "pct": 25},
{"name": "Cash/MMF (short-term)", "pct": 5}])
check("bond fund -> IRA", r["location"] == "IRA",
f"{r['location']} {r['score']}")
# muni name override wins regardless of sleeves
r = tp.classify("X Municipal Bond Fund", betas={"shv": 5.0})
check("muni name -> TAXABLE (munis)",
r["location"] == "TAXABLE (munis)" and r["score"] == 1.0,
f"{r['location']}")
# merger arb: equity book but STCG character -> capped to IRA
r = tp.classify("The Merger Fund",
buckets=[{"name": "Equity (common)", "pct": 90},
{"name": "Cash/MMF (short-term)", "pct": 10}])
check("merger arb capped (STCG) -> IRA",
r["location"] == "IRA" and r["score"] <= 0.35,
f"{r['location']} {r['score']}")
# money market -> flexible
r = tp.classify("Plain Money Market Account",
buckets=[{"name": "Cash/MMF (short-term)", "pct": 100}])
check("money market -> FLEXIBLE", r["location"] == "FLEXIBLE (cash)",
r["location"])
# mostly pass-through, no sleeves -> MIXED
r = tp.classify("Wrapper Fund",
buckets=[{"name": "Fund/ETF holdings", "pct": 100}])
check("100% FOF no sleeves -> MIXED",
r["location"] == "MIXED (check 1099)", r["location"])
# sleeve proxy: pure rates -> IRA; pure equity -> TAXABLE
check("sleeve proxy rates -> IRA",
tp.classify("F", betas={"tlt": 0.9, "shv": 0.2})["location"]
== "IRA", "")
check("sleeve proxy equity -> TAXABLE",
tp.classify("F", betas={"ivv": 0.8, "qqq": 0.2})["location"]
== "TAXABLE", "")
# manual override for the Leuthold wrappers
r = tp.finalize("LCORX", tp.classify("Leuthold Core Investment",
buckets=[
{"name": "Fund holdings",
"pct": 100}]))
check("LCORX manual -> TAXABLE", r["location"] == "TAXABLE",
r["location"])
def test_drawdown() -> None:
print("drawdown", flush=True)
import pandas as pd
@@ -498,6 +560,7 @@ def main() -> int:
test_overnight()
test_curated()
test_xcheck()
test_taxplan()
test_drawdown()
test_edgar_live()
print(f"\n{PASS} passed, {FAIL} failed")