Programming lesson
Portfolio Optimisation with Market Data: A Step-by-Step Tutorial for FMAT3888
Learn how to estimate parameters, compute efficient frontiers, and solve static and dynamic portfolio optimisation problems using real market data. This tutorial guides you through the key concepts of the FMAT3888 interdisciplinary project.
Introduction to Portfolio Optimisation with Market Data
Portfolio optimisation is a cornerstone of financial mathematics, helping investors allocate assets to maximise returns for a given risk level. In this tutorial, we explore the key concepts from the FMAT3888 Projects in Financial Mathematics assignment, focusing on parameter estimation, static optimisation, and dynamic rebalancing. By understanding these techniques, you can apply them to real-world portfolios—whether you're managing a personal investment account or analysing trends in AI-driven trading apps that have become popular in 2026.
We'll use six asset classes: Cash, Developed Equities (DEQ), Australian Equities (AEQ), Emerging Market Equities (EMEQ), Australian Fixed Interest (AFI), and Developed Government Bonds (DGB). The assignment provides monthly return data from 2001 to 2021, but we'll focus on two estimation periods: (A) 2007–2010 and (B) 2011–2014. These periods cover the Global Financial Crisis and the subsequent recovery, offering contrasting market conditions.
Parameter Estimation: From Monthly Returns to Lognormal Models
The first step is to estimate the parameters of the lognormal model. For each asset class i, the monthly log-return Xit = ln(1 + αit) is assumed to follow a multivariate normal distribution with mean vector a and covariance matrix B. Using the provided spreadsheet, you can compute sample means and covariances for each period.
For example, using Python or Excel, calculate:
import numpy as np
# Assuming data is a T x 6 matrix of monthly returns
log_returns = np.log(1 + data)
mean_vec = np.mean(log_returns, axis=0)
cov_mat = np.cov(log_returns, rowvar=False)These estimates are then used to derive the distribution of multi-period returns. For an n-month return, the log-return is multivariate normal with mean na and covariance nB. This property is essential for computing annual and two-year return distributions.
Static Portfolio Optimisation: Maximising Expected Utility
In static optimisation, the investor chooses weights w for a two-year horizon to maximise expected utility. The assignment uses exponential utility U(x) = −e−γx with γ = 1. Under the assumption that two-year returns are lognormal, the optimisation problem becomes:
max E[−exp(-γ * R_w)] subject to sum(w)=1Since the lognormal distribution is not symmetric, a common approximation is to assume returns are normal with matched mean and variance. This simplifies the problem to a mean-variance optimisation. Using the estimated parameters from period (B), you can solve for the optimal weights.
For instance, using SciPy:
from scipy.optimize import minimize
def neg_utility(w, mu, cov, gamma=1):
port_mean = w @ mu
port_var = w @ cov @ w
return -(-np.exp(-gamma * port_mean + 0.5 * gamma**2 * port_var))
# Constraints and bounds hereWhen you compare results from periods (A) and (B), you'll notice that the optimal portfolio during the crisis period (A) allocates more to safe assets like Cash and Bonds, while the recovery period (B) favours equities. This reflects the different risk environments.
Efficient Frontier and Minimum Variance Portfolio
The efficient frontier plots the maximum expected return for each level of risk (standard deviation). Using the estimated two-year return parameters, you can generate this frontier by solving for optimal weights that minimise variance for a range of target returns.
For a target return of 12% (as in the assignment), find the minimum variance portfolio:
min w^T C w subject to w^T mu >= 0.12, sum(w)=1The solution gives a diversified portfolio. For period (B), you might find weights around: DEQ 30%, AEQ 20%, EMEQ 15%, AFI 20%, DGB 10%, Cash 5%. Compare this with the actual realised return from 2015–2016 to validate the model.
Dynamic Portfolio Optimisation: Two-Period Rebalancing
Dynamic optimisation allows the investor to adjust weights at the start of the second year based on the first year's returns. The two-year return is G(w,u) = (1 + ξ1·w)(1 + ξ2·u) − 1. The investor chooses first-year weights w and second-year weights u (which may depend on ξ1) to maximise expected utility.
This is a multi-stage problem often solved by dynamic programming. For exponential utility, the optimal second-year weights are independent of the first-year outcome (due to constant absolute risk aversion). Thus, the problem reduces to choosing w to maximise:
E[U((1 + ξ1·w)(1 + ξ2·u*) − 1)]where u* is the optimal static weights for a one-year horizon. The solution typically involves numerical integration or simulation.
Connecting to Current Trends in 2026
In 2026, AI-powered robo-advisors have become mainstream, offering personalised portfolio optimisation using similar mean-variance and utility maximisation techniques. Apps like Wealthfront and Betterment now incorporate machine learning to estimate parameters and adjust portfolios dynamically. The concepts you learn in FMAT3888 are directly applicable to these platforms.
Moreover, the rise of crypto assets and ESG investing has expanded the asset universe. While this tutorial focuses on traditional classes, the same optimisation framework can be extended to include Bitcoin or green bonds. Understanding the mathematics behind portfolio optimisation gives you a competitive edge in the finance industry.
Conclusion
This tutorial covered the essential steps of the FMAT3888 interdisciplinary project: parameter estimation, static optimisation, efficient frontier analysis, and dynamic rebalancing. By working through the assignment with real market data, you gain hands-on experience in financial mathematics and portfolio management. Remember to compare results across different estimation periods to appreciate how market conditions affect optimal strategies.
For further practice, try extending the analysis to include transaction costs or constraints on short selling. These extensions are common in quantitative finance and investment science. Good luck with your project!