Direct Indexing, with Equity Factor Risk Model + Tax Alpha
Built in under 4 days with Claude Code.
This proof-of-concept is the result of about four working days of collaboration with Claude Code — not a black-box creation, but a running partnership where I reviewed and edited each function in python as it came together:
~2½ days on the backend Python logic — building the risk model, optimizer, and analytics functions one at a time, in a normal Python editor.
~1 day on the frontend — HTML and JavaScript — mostly spent refining the process flow and visual layout.
~½ day integrating into this WordPress page, working around a few WP limitations along the way.
What it does
– Builds an equity risk model from historical data, including macro and style factors.
– Analyzes an existing portfolio — tracking error, embedded gains, sector/size/factor exposures.
– Constructs an optimal portfolio subject to user-set constraints, with features like tax-loss harvesting.
– Produces comparison tables and charts that view the portfolio from multiple dimensions.
Where it could go next: This is a proof-of-concept, not a production system — there’s plenty of runway for a real-world use case:
– Broker API connections to pull live holdings and push trade tickets for production portfolios.
– Re-weighting the constraint hierarchy to suit different priorities — e.g. putting tax management ahead of tracking-error minimization.
– Refining the risk model for the user’s actual rebalance frequency (daily, monthly, quarterly).