This repository contains the code for a quantitative finance project that constructs and analyzes an optimal multi-asset investment portfolio. Using 15 years of historical data for the S&P 500, Tesla, Gold, and the SGD/USD exchange rate, this project applies Modern Portfolio Theory to maximize risk-adjusted returns. It provides a deep dive into risk assessment using VaR/CVaR, volatility modeling with GARCH, and return forecasting via Prophet.
Follow these steps to set up and run the project locally.
-
Prerequisites Ensure you have Python 3.8+ and pip installed on your system.
-
Clone the Repository
-
Part 1: Data Preparation Run the data preparation script to download the latest financial data from Yahoo Finance. This will create the
daily_adjusted_prices.csvfile needed for the analysis.python get_prices_adjclose_or_close.py -
Part 2: Run Analysis The entire analysis is contained within the Jupyter Notebook (
portfolio_sql.ipynb). Launch Jupyter and execute the cells in order to reproduce the findings.
The project employs a multi-step quantitative methodology to move from raw data to a fully analyzed and forecasted portfolio. It begins with data extraction from Yahoo Finance using the yfinance library, followed by ETL into a MySQL database and exploratory data analysis. The core of the project is portfolio optimization using a Monte Carlo simulation to identify the Maximum Sharpe Ratio allocation. It provides a deep dive into risk assessment using VaR/CVaR, volatility modeling with GARCH, and return forecasting via Prophet.
For a detailed mathematical and technical breakdown, please see TECHNICAL.md.
-
The optimal portfolio consists of 38.8% GLD, 37.9% SPX, and 23.3% TSLA.
-
It achieves an annualized Sharpe Ratio of 0.9783 and a Sortino Ratio of 1.3764.
-
The portfolio is exposed to significant tail risk, with a historical max drawdown of -30.07%.
-
The GARCH model indicates that volatility is highly persistent, meaning risky periods are prolonged.
Last Update: SEP-2025
Disclaimer This project was developed using technologies and methods prevalent at the time. Users are advised to review and update the code for compatibility with current Python versions and package dependencies.
- The analysis is based on historical data; future performance may vary significantly.
- The Prophet forecasting model is not optimized for highly volatile financial data and should be interpreted with caution.
- Asset correlations are dynamic and may not hold true in future market conditions.
Last Update: SEP-2025
Disclaimer:
This project was developed using technologies and methods prevalent at the time. Users are advised to review and update the code for compatibility with current Python versions and package dependencies.
Quenstance Lau
- Web Portfolio: https://quenstance.pages.dev/
- LinkedIn: https://www.linkedin.com/in/quenstance/
- GitHub: https://github.com/quenstance/N