Hello! Welcome to the first lesson of our course on managing your stock portfolio.
Given your goal of using quantitative indicators for asset allocation, our first module, "Quantitative Portfolio Foundations," will build the essential mathematical toolkit you'll need. This lesson starts with the most fundamental task: measuring the two primary characteristics of any portfolio—its expected return and its risk.
Our learning outcome for today is to calculate the expected return and volatility of a multi-asset portfolio using historical data. We will approach this with the mathematical rigor you prefer, using matrix algebra to create a robust and scalable framework. This will set the stage for our subsequent lessons on optimization and strategy.
Let's begin by defining our terms.
1. The Building Blocks: Return and Volatility of a Single Asset
Before we can analyze a portfolio of assets, we must first understand how to measure the risk and return of its individual components.
Expected Return
For our purposes, we'll estimate the expected return of an asset by looking at its historical average return. This is typically calculated as the arithmetic mean of returns over a specific period (e.g., daily, monthly).
Volatility
In finance, volatility is the standard measure of risk. It quantifies how much an asset's price fluctuates around its average. Statistically, volatility is simply the standard deviation of the asset's returns. A higher standard deviation means returns are more spread out and the asset is considered riskier.
To get a clear conceptual and mathematical introduction to volatility, please watch the following video.
Financial Volatility 🔥 Asset Risk for Quants
The video 'Financial Volatility' from the Socratica channel provides an excellent introduction to volatility as the standard deviation of returns. It also covers the essential step of annualizing volatility.
Please watch the first two sections. The first (00:00 - 02:16) defines volatility and shows how to calculate it for a single asset. The second (02:16 - 05:34) explains how to annualize daily volatility, which is a crucial step for comparing investments.
As the video explains, we typically use daily returns to calculate volatility but then annualize the result to make it comparable across different time frames. The key formulas are:
- Annualized Return = Average Daily Return 252
- Annualized Volatility = Daily Volatility (Standard Deviation)
The number 252 is used as it's the approximate number of trading days in a year. The use of the square root of time to scale volatility is a fundamental concept that stems from the assumption that daily returns are independent random variables.
2. From Single Assets to Portfolios: Matrix Algebra
Now, let's extend these concepts to a portfolio containing multiple assets. Doing this one-by-one is cumbersome. A much more powerful and elegant approach is to use matrix algebra. This aligns with your preference for a rigorous, mathematical framework and is the standard method used in quantitative finance.
Let's define our key elements:
- A weights vector, , an column vector where each element is the proportion of the portfolio invested in asset . By definition, .
- A returns vector, , an vector where each element is the return of asset over a single period.
- An expected returns vector, , an vector where each element is the expected return of asset .
Portfolio Expected Return
The expected return of a portfolio is the weighted average of the expected returns of its constituent assets. In matrix notation, this is a simple dot product:
Where is the transpose of the weights vector (a row vector). This compact formula, , efficiently calculates the portfolio's expected return.
Portfolio Volatility
This is where it gets more interesting. Portfolio volatility is not a simple weighted average of individual asset volatilities. We must also account for how the assets move in relation to each other. This is captured by the covariance matrix.
The covariance matrix, denoted by , is an matrix that contains the variance and covariance of all pairs of assets.
- The diagonal elements () are the variances of each individual asset.
- The off-diagonal elements (, where ) are the covariances between asset and asset . Covariance measures the degree to which two assets' returns move together.
With the weights vector and the covariance matrix , the portfolio's variance () is calculated using the following quadratic form:
The portfolio's volatility, , is then simply the square root of the variance. This formula is the cornerstone of modern portfolio theory.
To solidify your understanding of these matrix formulas, please read the following material. It provides the formal definitions and shows how they are represented mathematically.
12 Portfolio Theory with Matrix Algebra - Bookdown
The article 'Portfolio Theory with Matrix Algebra' provides a concise and rigorous mathematical foundation for calculating portfolio return and risk.
Please read the section titled '12.1.1 Portfolio return and risk characteristics using matrix notation'. This section formally presents the matrix equations for portfolio expected return (\mu_{p,x} = \mathbf{x}^{\prime}\mu) and variance (\sigma_{p,x}^{2} = \mathbf{x}^{\prime}\Sigma\mathbf{x}). You can skim the surrounding text, but focus on understanding these core formulas.
The resource Linear Algebra for Quantitative Finance (ID: LINK) also provides excellent explanations in its sections "The Dot Product: Portfolio Returns" and "Portfolio Variance: The Quadratic Form" if you would like another perspective.
3. Practical Calculation with Historical Data
Now let's bridge theory and practice. The video below demonstrates how to perform all of these calculations in Excel using historical price data. It's a comprehensive walkthrough that covers everything from calculating returns to constructing the covariance matrix and finally computing the portfolio's standard deviation.
This practical exercise will show you exactly how the theoretical formula is implemented.
Mastering Multi-Asset Portfolio Analysis: Standard Deviation & Returns in Excel
The video 'Mastering Multi-Asset Portfolio Analysis' by Ryan O'Connell provides a step-by-step guide to calculating portfolio return and standard deviation in Excel.
Please watch the following segments. I've broken them down to connect each step to our theoretical discussion: Calculating Returns (01:16 - 02:20): This shows how to calculate log-normal daily returns from prices. Annualizing Returns & Volatility (02:30 - 04:46): This implements the annualization formulas we discussed for individual assets. Calculating Portfolio Weights (04:46 - 08:33): This demonstrates how to determine the average weight of each asset in the portfolio over time, a crucial input for our calculation. Building the Covariance Matrix (10:25 - 13:00): This is a key practical step. It shows how to use Excel's Data Analysis ToolPak to generate the matrix \Sigma from historical return data. Calculating Portfolio Volatility (13:00 - 14:34): This is the final step. The video uses Excel's MMULT function to implement the \sigma_p^2 = \mathbf{w}^T \Sigma \mathbf{w} formula. The formula MMULT(TRANSPOSE(w), MMULT(Σ, w)) is the direct Excel translation of our matrix equation.
Watching this process should make the abstract formulas feel much more concrete. You now have both the theoretical understanding and a practical method for measuring the risk and return of a multi-asset portfolio.
Conclusion
In this lesson, we established the fundamental quantitative tools for portfolio analysis. Here are the key takeaways:
- Portfolio Expected Return is the weighted average of individual asset expected returns, calculated as .
- Portfolio Volatility (risk) is more complex, depending on both individual asset variances and their covariances.
- The Covariance Matrix () is essential for measuring portfolio risk as it captures the co-movement between all assets.
- The Portfolio Variance is calculated using the formula , and volatility is its square root.
You are now equipped to take a set of historical asset prices and a set of portfolio weights and produce the two most important summary statistics: expected return and volatility.
In our next lesson, we will use these tools to solve a foundational problem in finance: for a given set of assets, what is the 'best' possible combination? We will construct and interpret an efficient frontier, which represents the set of portfolios that offer the highest possible return for any given level of risk.