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:

**Intro to Python**: These lectures provide an introduction to Jupyter notebooks, Python, and several key data processing libraries in Python.**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.**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.

Most lectures can be completed using free sample data from QuantRocket. A few lectures are designed to use fundamental data that requires a QuantRocket subscription with Sharadar data subscription. These lectures can still be completed without a QuantRocket subscription by simply reading along (without querying data) or by substituting free Sharadar 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 work with QuantRocket version 2.10.0 or higher.

Title | Description | Required Dataset(s) | |
---|---|---|---|

Data Collection Tutorials | |||

Data Collection 1 | Free data for US Stocks | Collect free sample data for US Stocks. | |

Data Collection 2 | Sharadar Price and Fundamental Data for US Stocks | Collect price and 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 | Free 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 | Free data |

Lecture 5 | Plotting Data | How to plot data with matplotlib | Free data |

Topics in Statistics | |||

Lecture 6 | Means | Understanding and calculating different types of means | Free data |

Lecture 7 | Variance | Understanding and calculating measures of dispersion | - |

Lecture 8 | Statistical Moments | Understanding skewness and kurtosis | Free data |

Lecture 9 | Linear Correlation Analysis | Understanding correlation and its relation to variance | Free data |

Lecture 10 | Instability of Estimates | How estimates can change with new data observations | Free data |

Lecture 11 | Random Variables | Understanding discrete and continuous random variables and probability distributions | Free data |

Lecture 12 | Linear Regression | Using linear regression to understand the relationship between two variables | Free data |

Lecture 13 | Maximum Likelihood Estimation | Basic introduction to maximum likelihood estimation, a method of estimating a probability distribution | Free data |

Lecture 14 | Regression Model Instability | Why regression coeffecients can change due to factors like regime change and multicollinearity | Free data |

Lecture 15 | Multiple Linear Regression | Multiple linear regression generalizes linear regression to multiple variables | Free data |

Lecture 16 | Violations of Regression Models | Different scenarios that can violate regression assumptions | Free data |

Lecture 17 | Model Misspecification | What can cause a bad model to look good | Free data Sharadar data |

Lecture 18 | Residual Analysis | How to analyze residuals to build healthier models | Free data |

Lecture 19 | Dangers of Overfitting | How overfitting can make a bad model seem attractive | Free data |

Lecture 20 | Hypothesis Testing | Statistical techniques for rejecting the null hypothesis | Free 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 | Free 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 | Free data |

Lecture 27 | Introduction to Volume, Slippage, and Liquidity | An overview of liquidity and how it can affect your trading strategies | Free data |

Lecture 28 | Market Impact Models | Understanding how your own trading activity moves the market price | Free data |

Lecture 29 | Universe Selection | Defining a trading universe | Free data |

Lecture 30 | The Capital Asset Pricing Model and Arbitrage Pricing Theory | Using CAPM and Arbitrage Pricing Theory to evaluate risk | Free data Sharadar data |

Lecture 31 | Beta Hedging | Hedging your algorithm's market risk | Free data |

Lecture 32 | Fundamental Factor Models | Using fundamental data in factor models | Sharadar data |

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 | Sharadar data |

Lecture 35 | Risk-Constrained Portfolio Optimization | Managing risk factor exposure | Sharadar data |

Lecture 36 | Principal Component Analysis | Using PCA to understand the key drivers of portfolio returns | Free data |

Lecture 37 | Long-Short Equity | Introduction to market-neutral strategies | - |

Lecture 38 | Factor Analysis with Alphalens | Using Alphalens to evaluate alpha factors | Free data |

Lecture 39 | Why You Should Hedge Beta and Sector Exposures | How hedging common risk exposures can improve portfolio performance | Free data |

Lecture 40 | VaR and CVaR | Using Value at Risk to estimate potential loss | Free data |

Lecture 41 | Integration, Cointegration, and Stationarity | Introduction to stationarity and cointegration, which underpins pairs trading | Free data |

Lecture 42 | Introduction to Pairs Trading | A theoretical and practical introduction to pairs trading | Free data |

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 | Free data |

© Copyright Quantopian, Inc.

© Modifications Copyright QuantRocket LLC

Licensed under the Creative Commons Attribution 4.0.