Back to projects

Quantitative Finance · Analysis · Python

Portfolio Backtesting and Optimization

This project is directly linked to the wealth-tracking application: backtest and simulation outputs help guide allocation decisions inside the main portfolio workflow. It aims to build an analysis environment that can test several investment approaches across multiple assets, compare their performance, and study the risk or return profile of a portfolio. The project follows a practical quantitative-finance logic: clean data, explicit assumptions, comparable metrics, and readable visual outputs.

PythonPandasNumPyPlotlyBacktestingMonte Carlo

What this project demonstrates

Ability to structure a backtesting engine, compare several allocations under a common framework, and add Monte Carlo analysis to assess the distribution of possible portfolio paths.

Portfolio Backtesting and Optimization - detailed view

My role

I defined the assumptions, collected and cleaned market data, implemented the backtests, built the Monte Carlo simulation layer, computed the metrics, and interpreted the results from a financial perspective.

Context

I wanted to complement academic market-finance training with a tool built end to end. The goal was to test investment hypotheses, compare outputs, and interpret performance, volatility, drawdown, diversification, and robustness more concretely.

Objective

Build an analysis framework that can compare several strategies, visualize their outputs, run scenario simulations through Monte Carlo, and assess portfolio robustness across several metrics.

Demo

Project in action

Deep dive

Technical reading of the project

This module is the quantitative engine behind the wealth-tracking stack: it backtests allocations, measures their risk and return profile, and adds Monte Carlo simulations to test path robustness.

  • Multi-strategy backtests on a harmonized asset universe.
  • Comparison of allocation scenarios and rebalancing frequencies.
  • Annualized risk and return metrics plus drawdown analysis.
  • Monte Carlo simulation for portfolio-path distributions.
  • Decision-oriented reporting through comparative charts.

Gallery

Key screens and visualizations

Five-year strategy backtest comparison

Comparison of several strategy performance paths over a five-year period.

Monte Carlo simulation for a portfolio

Monte Carlo projection used to visualize the dispersion of portfolio scenarios.

Architecture

Technical organization

Data layer

Preparation of price and return series, cleaning of missing quotes, and time alignment to ensure consistent comparisons.

Backtest engine

Execution of parameterized strategies with allocation rules, rebalancing logic, horizon, and constraints, while keeping a full portfolio-value history.

Simulation engine

Monte Carlo path generation based on historical returns to assess the range of possible outcomes.

Reporting layer

Generation of KPIs and comparative visuals such as cumulative performance, drawdown, and trajectory dispersion to support allocation decisions.

Pipeline

Data flow

  1. 1.Load market series and normalize timestamps.
  2. 2.Apply strategy rules and run the backtests.
  3. 3.Compute portfolio metrics such as return, risk, and drawdown.
  4. 4.Launch Monte Carlo simulations over the selected horizon.
  5. 5.Consolidate outputs into comparable charts.
  6. 6.Use the conclusions to inform allocation choices in the wealth-tracking application.

Technical choices

Structuring decisions

Unified comparison framework

Strategies are evaluated with the same dataset, the same periods, and the same calculation conventions to limit comparison bias.

Multi-metric risk and return reading

The evaluation combines performance and risk through volatility, drawdown, and Sharpe so conclusions are not driven by raw return alone.

Monte Carlo as a robustness test

The simulations are meant to measure uncertainty and dispersion, not to predict the future with precision.

Integration with wealth tracking

The most robust scenarios are fed back into the broader allocation logic used in the wealth-tracking project.

Reliability

Quality and controls

  • Test parameters are made explicit, including horizon, rules, and base assumptions.
  • The pipeline remains separable between data preparation, calculations, and reporting.
  • Consistency checks are applied to the temporal alignment of the series used.

Limitations

Current attention points

  • Results remain sensitive to the selected historical window and market regime.
  • Monte Carlo outcomes still depend on volatility and distribution assumptions.
  • Real-world frictions are not modeled exhaustively, especially detailed fees, advanced slippage, and full tax treatment.

Roadmap

Next steps

  • Add more refined optimization constraints such as bounds by asset class and risk budgets.
  • Extend stress testing with correlation shocks, severe drawdowns, and macro scenarios.
  • Automate the exchange of results between the backtest module and the wealth-tracking application.

Challenges

Main project challenges

Design a unified framework that can compare very different strategies such as buy and hold, weighted allocations, and periodic rebalancing under the same assumptions.

Integrate Monte Carlo outputs in a readable way without overstating their predictive power.

Preserve a clear separation between raw data, calculation logic, visual reporting, and interpretation so the pipeline remains maintainable.

Outcomes and learnings

What I take away

Reproducible five-year backtests to compare strategies and allocations.

Standardized reading of risk and return metrics, including annualized performance, volatility, drawdown, Sharpe, and relative stability.

Monte Carlo module added to visualize likely portfolio paths and quantify uncertainty around historical results.

Analysis base reused by the wealth-tracking project to connect operational monitoring with allocation decisions.

Other projects

Continue exploring

Wealth Tracking Application - project preview

Personal Finance · Python · PyQt6

Wealth Tracking Application

PyQt6 + SQLite desktop application to centralize multi-asset accounts, rebuild weekly history, and analyze portfolio performance.

View this project
C++ Option Pricing (CRR, Black-Scholes, Monte Carlo) - project preview

Quantitative Finance · C++ · Pricing

C++ Option Pricing (CRR, Black-Scholes, Monte Carlo)

Group project in C++ to price several option types, including European, American, and Asian contracts, with CRR, Black-Scholes, and Monte Carlo.

View this project

Discuss

I can detail technical choices and outcomes during an interview.

If this project is relevant for you, I can detail the initial need, data structure, assumptions, challenges encountered, and analysis limitations.