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.
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.
The lectures are divided into three sections:
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.
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.
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.8.0.
Title | Description | Required Dataset(s) | |
---|---|---|---|
Data Collection Tutorials | |||
Data Collection 1 | Sample Dataset for US Stocks | Collect free sample data (minute and daily) for US Stocks | - |
Data Collection 2 | Full Dataset for US Stocks | Collect the full dataset for US Stocks. QuantRocket subscription required. | - |
Data Collection 3 | Sharadar US Fundamentals | Collect fundamental data for US Stocks from Sharadar. QuantRocket subscription and Sharadar subscription required. | - |
Intro to Python | |||
Lecture 1 | Introduction to Notebooks | Introductory tutorial demonstrating how to use Jupyter Notebooks | Sample Data |
Lecture 2 | Introduction to Python | Basic introduction to Python semantics and data structures | - |
Lecture 3 | Introduction to NumPy | Introduction to NumPy, a data computation library | - |
Lecture 4 | Introduction to pandas | Introduction to pandas, a library for managing and analyzing data | Sample Data |
Lecture 5 | Plotting Data | How to plot data with matplotlib | Sample Data |
Topics in Statistics | |||
Lecture 6 | Means | Understanding and calculating different types of means | Sample Data |
Lecture 7 | Variance | Understanding and calculating measures of dispersion | - |
Lecture 8 | Statistical Moments | Understanding skewness and kurtosis | Sample Data |
Lecture 9 | Linear Correlation Analysis | Understanding correlation and its relation to variance | Sample Data |
Lecture 10 | Instability of Estimates | How estimates can change with new data observations | Sample Data |
Lecture 11 | Random Variables | Understanding discrete and continuous random variables and probability distributions | Sample Data |
Lecture 12 | Linear Regression | Using linear regression to understand the relationship between two variables | Sample Data |
Lecture 13 | Maximum Likelihood Estimation | Basic introduction to maximum likelihood estimation, a method of estimating a probability distribution | Sample Data |
Lecture 14 | Regression Model Instability | Why regression coeffecients can change due to factors like regime change and multicollinearity | Sample Data |
Lecture 15 | Multiple Linear Regression | Multiple linear regression generalizes linear regression to multiple variables | Sample Data |
Lecture 16 | Violations of Regression Models | Different scenarios that can violate regression assumptions | Full US Stock |
Lecture 17 | Model Misspecification | What can cause a bad model to look good | Sample Data Full US Stock Sharadar fundamentals |
Lecture 18 | Residual Analysis | How to analyze residuals to build healthier models | Sample Data |
Lecture 19 | Dangers of Overfitting | How overfitting can make a bad model seem attractive | Sample Data |
Lecture 20 | Hypothesis Testing | Statistical techniques for rejecting the null hypothesis | Sample Data |
Lecture 21 | Confidence Intervals | How to measure and interpret confidence intervals | - |
Lecture 22 | Spearman Rank Correlation | How to measure monotonic but non-linear relationships | Sample Data |
Lecture 23 | p-Hacking and Multiple Comparisons Bias | How to avoid getting tricked by false positives | - |
Topics in Finance | |||
Lecture 24 | Leverage | Using borrowed money to amplify returns | - |
Lecture 25 | Position Concentration Risk | The riskiness of investing in a small number of assets | - |
Lecture 26 | Estimating Covariance Matrices | Using covariance matrices to model portfolio volatility | Full US Stock |
Lecture 27 | Introduction to Volume, Slippage, and Liquidity | An overview of liquidity and how it can affect your trading strategies | Sample Data |
Lecture 28 | Market Impact Models | Understanding how your own trading activity moves the market price | Sample Data |
Lecture 29 | Universe Selection | Defining a trading universe | Full US Stock Sharadar fundamentals |
Lecture 30 | The Capital Asset Pricing Model and Arbitrage Pricing Theory | Using CAPM and Arbitrage Pricing Theory to evaluate risk | Full US Stock Sharadar fundamentals |
Lecture 31 | Beta Hedging | Hedging your algorithm's market risk | Sample Data |
Lecture 32 | Fundamental Factor Models | Using fundamental data in factor models | Full US Stock Sharadar fundamentals |
Lecture 33 | Portfolio Analysis with pyfolio | Evaluating backtest performance using pyfolio | - |
Lecture 34 | Factor Risk Exposure | Understanding and measuring your algorithm's exposure to common risk factors | Full US Stock Sharadar fundamentals |
Lecture 35 | Risk-Constrained Portfolio Optimization | Managing risk factor exposure | Full US Stock Sharadar fundamentals |
Lecture 36 | Principal Component Analysis | Using PCA to understand the key drivers of portfolio returns | Full US Stock |
Lecture 37 | Long-Short Equity | Introduction to market-neutral strategies | - |
Lecture 38 | Factor Analysis with Alphalens | Using Alphalens to evaluate alpha factors | Full US Stock |
Lecture 39 | Why You Should Hedge Beta and Sector Exposures | How hedging common risk exposures can improve portfolio performance | Full US Stock |
Lecture 40 | VaR and CVaR | Using Value at Risk to estimate potential loss | Full US Stock |
Lecture 41 | Integration, Cointegration, and Stationarity | Introduction to stationarity and cointegration, which underpins pairs trading | Sample Data Full US Stock |
Lecture 42 | Introduction to Pairs Trading | A theoretical and practical introduction to pairs trading | Full US Stock |
Lecture 43 | Autocorrelation and AR Models | Understanding how autocorrelation creates tail risk | - |
Lecture 44 | ARCH, GARCH, and GMM | Introduction to volatility forecasting models | - |
Lecture 45 | Kalman Filters | Using Kalman filters to extract signals from noisy data | Sample Data |
© Copyright Quantopian, Inc.
© Modifications Copyright QuantRocket LLC
Licensed under the Creative Commons Attribution 4.0.