Project 01 | Quantitative finance
Quantitative Portfolio Research Pipeline
A reproducible portfolio research system that loads historical ETF prices into SQL, analyzes returns and risk in Python with pandas, validates optimization logic against MATLAB, and produces a tested walk-forward report.
- Focus
- Portfolio analytics · optimization · research engineering
- Dataset
- 12,066 ETF price records
- Status
- Live report and notebook
Research question
Can a constrained ETF portfolio improve risk-adjusted performance?
The experiment tests a six-ETF portfolio covering Canadian equities, US equities, developed international equities, emerging markets, aggregate bonds, and gold.
The strategy maximizes expected Sharpe ratio subject to long-only weights, full investment, and a 30% cap per asset. It is compared with SPY using only information available before each rebalance date, with transaction costs charged whenever allocations change.
The result is intentionally not presented as a trading product. It is a research workflow: define assumptions, load data, calculate risk and return, optimize under constraints, backtest out of sample, and validate the calculation path.
System architecture
A configuration change reruns the complete experiment and regenerates every output.
Historical ETF data
Frozen adjusted prices are stored in SQLite and validated before analysis.
Python analytics
Pandas and NumPy calculate returns, covariance, volatility, drawdown, Sharpe, and VaR.
Optimizer and backtest
Weights are solved under constraints, frozen for the next quarter, and charged transaction costs.
Validation layer
MATLAB cross-checks and pytest tests protect the calculations and chronology.
Research finding
From research idea to reproducible system
SPY produced the higher raw return in this sample. The optimized portfolio produced lower volatility, a smaller maximum drawdown, and a higher Sharpe ratio after modeled transaction costs. The report presents that trade-off directly instead of claiming an unrealistic win.
The important point is not that the model wins every comparison. The important point is that the assumptions, calculations, constraints, costs, and validation checks are visible enough to review.
Engineering controls
- Python and pandas return/risk pipeline
- SQL CTEs, joins, aggregations, and window functions
- Independent MATLAB implementation cross-check
- Pytest validation for returns, constraints, drawdowns, costs, and chronology
- No look-ahead in the rebalance loop
- Configuration-driven assumptions for lookback, rebalance frequency, weight caps, costs, and benchmark
Explore the evidence
Open the report or inspect the notebook
The notebook shows the working code, SQL examples, research architecture, optimization functions, visual checks, MATLAB comparison, and calculation tests.