Dynamic Portfolio Optimization
Building and backtesting stock portfolios using 40+ financial indicators, screening models, and time-series forecasting.
This project was developed in collaboration with Vittorio Haardt and Alberto Formigoni for the Financial Markets Analytics course in the Master’s Degree in Data Science.
The goal of the project was to utilize a broad set of key financial indicators from multiple companies to construct a portfolio with the highest expected returns.
More than 40 indicators were used, including: PE ratio, EBITDA, sales and debt per share, stock price and its moving averages, volatility, return on equity, price-to-book ratio, and others.
This wide range of metrics also demonstrates our strong understanding of both fundamental and technical indicators.
In the initial phase, we built all the tools necessary for our analysis.
After a preliminary data cleaning phase, we constructed a benchmark to later compare all portfolio strategies against.
A custom Python function was then implemented to simulate a screening model: this function made monthly decisions on which stocks to buy or sell, based on companies’ indicators.
It also computed the monthly portfolio value by taking into account both the buy/sell operations and price movements.
This screening function was reused, sometimes with minor modifications, throughout the project to evaluate different screening strategies.
We also developed additional functions to compute several key performance metrics for each portfolio: Sharpe ratio, Sortino ratio, and Information ratio.
Once all analytical tools were in place, we implemented various screening strategies and compared their performance.
These included Sequential Screening, Simultaneous Screening, and an approach that accounts for correlations between factors.
We also designed a Volatility-Weighted Portfolio and a Momentum-Based Portfolio.
For the final part of the project, we explored the use of Deep Learning for portfolio construction. We selected Prophet, a time-series forecasting model developed by Meta, to predict future stock prices and guide investment decisions.
The project achieved outstanding results and demonstrated the practical application of advanced financial analysis and machine learning techniques in portfolio optimization.