Quantitative Finance Lecture Series

Learn quantitative finance with this comprehensive lecture series. Adapted from the Quantopian Lecture Series (GitHub source repo) and updated to use QuantRocket APIs and data.

Background

Quantopian was a crowd-sourced hedge fund that operated a research and backtesting platform where users could develop trading algorithms, a selection of which were licensed by Quantopian for inclusion in its hedge fund. To support its business objective, Quantopian developed several open-source Python libraries, including Zipline, one of QuantRocket's two backtesters. Quantopian also developed a comprehensive lecture series on quantitative finance, which it released under a Creative Commons license. The lectures were originally developed to use Python 2 and Quantopian data, but have here been updated to use Python 3 and QuantRocket data.

Following the closure of its crowd-sourced hedged fund, Quantopian shut down in 2020.

Lecture Series Overview

The lectures are divided into four sections:

  1. Intro to Python: These lectures provide an introduction to Jupyter notebooks, Python, and several key data processing libraries in Python.
  2. Topics in Statistics: Covering a variety of topics that are broadly applicable in the field of statistics, these lectures are not specific to finance but typically include example applications to finance.
  3. Topics in Finance: Building on the statistics lectures, these lectures dive into topics more specific to finance and portfolio management.

For computational analysis, the lectures rely most heavily on Python's numerous scientific computing libraries. Some of the lectures on financial topics also rely on the Pipeline API, which is part of Zipline, a backtester which was created by Quantopian and is available in QuantRocket. For data, the lectures utilize randomly generated data as well as actual financial data from QuantRocket.

The primary focus of Quantopian's crowd-sourced hedge fund was to develop market-neutral, long-short equity strategies for institutional investors. Consequently, the lectures are tilted toward this particular style of investment.

Although the lectures use QuantRocket APIs to load data, they are not primarily QuantRocket tutorials. The purpose of the lectures is to provide a theoretical foundation in quantitative finance. Most of the computational methods employed in the lectures (excluding the Pipeline API) are readily available in any Python research environment. For practical guidance on how to backtest and deploy trading strategies in QuantRocket, other examples in the Code Library may be more suitable.

Data Requirements

Most lectures can be completed using free sample data from QuantRocket. Some lectures are designed to use larger datasets that require a QuantRocket subscription. These lectures can still be completed without a QuantRocket subscription by simply reading along (without querying data) or by substituting free sample data.

The data requirements for each lecture are noted in the table below.

Version

Due to the large variety of computational libraries used, the lectures are somewhat sensitive to version changes in the underlying libraries. The lectures were last updated and verified to be working with the library versions available in QuantRocket version 2.4.0.

Contents

TitleDescriptionRequired Dataset(s)
Data Collection Tutorials
Data Collection 1Sample Dataset for US StocksCollect free sample data (minute and daily) for US Stocks-
Data Collection 2Full Dataset for US StocksCollect the full dataset for US Stocks. QuantRocket subscription required.-
Data Collection 3Sharadar US FundamentalsCollect fundamental data for US Stocks from Sharadar. QuantRocket subscription and Sharadar subscription required.-
Intro to Python
Lecture 1Introduction to NotebooksIntroductory tutorial demonstrating how to use Jupyter NotebooksSample Data
Lecture 2Introduction to PythonBasic introduction to Python semantics and data structures-
Lecture 3Introduction to NumPyIntroduction to NumPy, a data computation library-
Lecture 4Introduction to pandasIntroduction to pandas, a library for managing and analyzing dataSample Data
Lecture 5Plotting DataHow to plot data with matplotlibSample Data
Topics in Statistics
Lecture 6MeansUnderstanding and calculating different types of meansSample Data
Lecture 7VarianceUnderstanding and calculating measures of dispersion-
Lecture 8Statistical MomentsUnderstanding skewness and kurtosisSample Data
Lecture 9Linear Correlation AnalysisUnderstanding correlation and its relation to varianceSample Data
Lecture 10Instability of EstimatesHow estimates can change with new data observationsSample Data
Lecture 11Random VariablesUnderstanding discrete and continuous random variables and probability distributionsSample Data
Lecture 12Linear RegressionUsing linear regression to understand the relationship between two variablesSample Data
Lecture 13Maximum Likelihood EstimationBasic introduction to maximum likelihood estimation, a method of estimating a probability distributionSample Data
Lecture 14Regression Model InstabilityWhy regression coeffecients can change due to factors like regime change and multicollinearitySample Data
Lecture 15Multiple Linear RegressionMultiple linear regression generalizes linear regression to multiple variablesSample Data
Lecture 16Violations of Regression ModelsDifferent scenarios that can violate regression assumptionsFull US Stock
Lecture 17Model MisspecificationWhat can cause a bad model to look goodSample Data
Full US Stock
Sharadar fundamentals
Lecture 18Residual AnalysisHow to analyze residuals to build healthier modelsSample Data
Lecture 19Dangers of OverfittingHow overfitting can make a bad model seem attractiveSample Data
Lecture 20Hypothesis TestingStatistical techniques for rejecting the null hypothesisSample Data
Lecture 21Confidence IntervalsHow to measure and interpret confidence intervals-
Lecture 22Spearman Rank CorrelationHow to measure monotonic but non-linear relationshipsSample Data
Lecture 23p-Hacking and Multiple Comparisons BiasHow to avoid getting tricked by false positives-
Topics in Finance
Lecture 24LeverageUsing borrowed money to amplify returns-
Lecture 25Position Concentration RiskThe riskiness of investing in a small number of assets-
Lecture 26Estimating Covariance MatricesUsing covariance matrices to model portfolio volatilityFull US Stock
Lecture 27Introduction to Volume, Slippage, and LiquidityAn overview of liquidity and how it can affect your trading strategiesSample Data
Lecture 28Market Impact ModelsUnderstanding how your own trading activity moves the market priceSample Data
Lecture 29Universe SelectionDefining a trading universeFull US Stock
Sharadar fundamentals
Lecture 30The Capital Asset Pricing Model and Arbitrage Pricing TheoryUsing CAPM and Arbitrage Pricing Theory to evaluate riskFull US Stock
Sharadar fundamentals
Lecture 31Beta HedgingHedging your algorithm's market riskSample Data
Lecture 32Fundamental Factor ModelsUsing fundamental data in factor modelsFull US Stock
Sharadar fundamentals
Lecture 33Portfolio Analysis with pyfolioEvaluating backtest performance using pyfolio-
Lecture 34Factor Risk ExposureUnderstanding and measuring your algorithm's exposure to common risk factorsFull US Stock
Sharadar fundamentals
Lecture 35Risk-Constrained Portfolio OptimizationManaging risk factor exposureFull US Stock
Sharadar fundamentals
Lecture 36Principal Component AnalysisUsing PCA to understand the key drivers of portfolio returnsFull US Stock
Lecture 37Long-Short EquityIntroduction to market-neutral strategies-
Lecture 38Factor Analysis with AlphalensUsing Alphalens to evaluate alpha factorsFull US Stock
Lecture 39Why You Should Hedge Beta and Sector ExposuresHow hedging common risk exposures can improve portfolio performanceFull US Stock
Lecture 40VaR and CVaRUsing Value at Risk to estimate potential lossFull US Stock
Lecture 41Integration, Cointegration, and StationarityIntroduction to stationarity and cointegration, which underpins pairs tradingSample Data
Full US Stock
Lecture 42Introduction to Pairs TradingA theoretical and practical introduction to pairs tradingFull US Stock
Lecture 43Autocorrelation and AR ModelsUnderstanding how autocorrelation creates tail risk-
Lecture 44ARCH, GARCH, and GMMIntroduction to volatility forecasting models-
Lecture 45Kalman FiltersUsing Kalman filters to extract signals from noisy dataSample Data

License

© Copyright Quantopian, Inc.
© Modifications Copyright QuantRocket LLC

Licensed under the Creative Commons Attribution 4.0.