Portfolio Pulse01
A Python app for exploring portfolios and testing ideas.
In Portfolio Pulse, I work on portfolio analytics and backtesting: returns, drawdowns, risk, allocations, and trading costs. I keep the calculations separate from the Streamlit interface so they can be tested on their own.
HOW A BACKTEST WORKS
- ObserveSignal at close t
- ExecuteNext common close
- AccountCosts, cash & holdings
- InspectLedger + validation
This is a research app. It uses daily adjusted prices and simulated trades, so the results depend on the data and assumptions you choose.
A few decisions behind the code
The maths lives outside the UI. I can check the portfolio and backtest calculations with small, repeatable inputs, without starting Streamlit or fetching market data.
A signal isn’t a trade. The backtest executes a decision at the next common close. It tracks drifting holdings, pays costs from the portfolio, and leaves unused capital in cash.
Fitting and testing are different steps. Walk-forward allocation uses earlier prices to estimate weights, then evaluates them on later observations. The choice of assets and data still affects what you can conclude.
Read the accounting and timing regression tests ↗