Nathan Gomes

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.

Open live reportView notebookView source
Focus
Portfolio analytics · optimization · research engineering
Dataset
12,066 ETF price records
Status
Live report and notebook
Annual return12.2%
Volatility11.7%
Sharpe ratio0.79
Automated tests6/6

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.

01

Historical ETF data

Frozen adjusted prices are stored in SQLite and validated before analysis.

02

Python analytics

Pandas and NumPy calculate returns, covariance, volatility, drawdown, Sharpe, and VaR.

03

Optimizer and backtest

Weights are solved under constraints, frozen for the next quarter, and charged transaction costs.

04

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.

View reportView notebookDownload notebook