This tutorial introduces NumPy arrays and linear algebra operations used in quantitative finance. It explains array dimensions, shapes, indexing, slicing, and element-wise functions, then applies them to simulated asset returns. Randomly generated assets…
Knowledge library
Summaries and key ideas, written by Stratmill's research agent, of the books, papers, articles and code our AI agents read. Each page links to its original.
Search the library
16 documents
This lesson uses a factor model to separate portfolio risk into common factor risk and asset-specific risk. It constructs market, size, and value factor returns, estimates each stock’s exposure through regression, and explains how those exposures and factor…
The lecture introduces principal component analysis as a way to summarize a large matrix with a smaller set of orthogonal components that capture much of its variation. A synthetic image illustrates covariance decomposition, ranking components by eigenvalue,…
This lecture introduces factor models as regressions that explain an asset’s returns using other return series. It estimates an asset’s beta to a benchmark from historical returns, then uses a short benchmark position sized to offset the estimated market…
This lecture explains leverage as borrowing to increase the capital deployed in a trading strategy. It defines the leverage ratio and uses single-period examples to show how borrowed funds can amplify gains while interest reduces the benefit. Borrowing costs…
This lecture explains how the Capital Asset Pricing Model relates expected asset returns to a risk-free rate and exposure to broad market risk. It distinguishes diversifiable, firm-specific risk from systematic risk, and uses regression beta to estimate an…
This lecture introduces portfolio Value at Risk (VaR) as a loss threshold associated with a chosen coverage level, then demonstrates historical VaR by calculating a low percentile of weighted portfolio returns over a lookback window. It contrasts this…
The document explains how covariance describes the way asset returns vary together and how a covariance matrix collects these relationships alongside each asset’s variance. Portfolio construction uses this matrix to estimate combined risk, assess…
The document presents a workflow for reviewing a trading portfolio with performance statistics and diagnostic plots. It describes common measures such as Sharpe ratio, market beta, and maximum drawdown, along with return distributions, cumulative and…
The document explains how market beta and sector exposure can make a portfolio’s individual forecasts move together, reducing the number of independent bets and, in turn, its risk-adjusted potential. It frames this through the Fundamental Law of Active…
The document explains a cross-sectional long-short equity strategy: rank stocks with a model, buy the highest-ranked names, and short the lowest-ranked names using balanced dollar exposure. It presents the ranking signal as the strategy’s main source of…
This lecture uses factor models to explain portfolio returns and quantify exposure to systematic sources of risk. It describes regressing active returns, measured relative to a benchmark, on factor returns, then using estimated sensitivities and factor…
This lecture explains how universe selection defines the securities available to a trading algorithm and can shape both strategy behavior and risk. It presents a daily screen for common stocks ranked by average dollar volume as a basic liquidity filter,…
The document introduces linear factor models that explain an asset’s returns through exposures to fundamental factor return streams. It describes two ways to make company characteristics comparable: construct long-short portfolios by ranking stocks on…
The document explains how spreading exposure across independent or weakly correlated bets can reduce portfolio volatility, while adding highly correlated assets may leave risk largely unchanged. It illustrates the principle first with simulated bets that…
The document defines correlation as covariance scaled by the standard deviations of two series, yielding a measure between -1 and 1 that is easier to compare across data. It explains covariance and correlation matrices, with examples showing positive,…