QuantRocket logo
Disclaimer

Quant Finance Lectures (adapted Quantopian Lectures)¶

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 three 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. 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.

Version¶

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.

Contents¶

TitleDescriptionRequired Dataset(s)
Data Collection Tutorials
Data Collection 1Free data for US StocksCollect free sample data for US Stocks.
Data Collection 2Sharadar Price and Fundamental Data for US StocksCollect price and 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 NotebooksFree 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 dataFree data
Lecture 5Plotting DataHow to plot data with matplotlibFree data
Topics in Statistics
Lecture 6MeansUnderstanding and calculating different types of meansFree data
Lecture 7VarianceUnderstanding and calculating measures of dispersion-
Lecture 8Statistical MomentsUnderstanding skewness and kurtosisFree data
Lecture 9Linear Correlation AnalysisUnderstanding correlation and its relation to varianceFree data
Lecture 10Instability of EstimatesHow estimates can change with new data observationsFree data
Lecture 11Random VariablesUnderstanding discrete and continuous random variables and probability distributionsFree data
Lecture 12Linear RegressionUsing linear regression to understand the relationship between two variablesFree data
Lecture 13Maximum Likelihood EstimationBasic introduction to maximum likelihood estimation, a method of estimating a probability distributionFree data
Lecture 14Regression Model InstabilityWhy regression coeffecients can change due to factors like regime change and multicollinearityFree data
Lecture 15Multiple Linear RegressionMultiple linear regression generalizes linear regression to multiple variablesFree data
Lecture 16Violations of Regression ModelsDifferent scenarios that can violate regression assumptionsFree data
Lecture 17Model MisspecificationWhat can cause a bad model to look goodFree data
Sharadar data
Lecture 18Residual AnalysisHow to analyze residuals to build healthier modelsFree data
Lecture 19Dangers of OverfittingHow overfitting can make a bad model seem attractiveFree data
Lecture 20Hypothesis TestingStatistical techniques for rejecting the null hypothesisFree data
Lecture 21Confidence IntervalsHow to measure and interpret confidence intervals-
Lecture 22Spearman Rank CorrelationHow to measure monotonic but non-linear relationshipsFree 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 volatilityFree data
Lecture 27Introduction to Volume, Slippage, and LiquidityAn overview of liquidity and how it can affect your trading strategiesFree data
Lecture 28Market Impact ModelsUnderstanding how your own trading activity moves the market priceFree data
Lecture 29Universe SelectionDefining a trading universeFree data
Lecture 30The Capital Asset Pricing Model and Arbitrage Pricing TheoryUsing CAPM and Arbitrage Pricing Theory to evaluate riskFree data
Sharadar data
Lecture 31Beta HedgingHedging your algorithm's market riskFree data
Lecture 32Fundamental Factor ModelsUsing fundamental data in factor modelsSharadar data
Lecture 33Portfolio Analysis with pyfolioEvaluating backtest performance using pyfolio-
Lecture 34Factor Risk ExposureUnderstanding and measuring your algorithm's exposure to common risk factorsSharadar data
Lecture 35Risk-Constrained Portfolio OptimizationManaging risk factor exposureSharadar data
Lecture 36Principal Component AnalysisUsing PCA to understand the key drivers of portfolio returnsFree data
Lecture 37Long-Short EquityIntroduction to market-neutral strategies-
Lecture 38Factor Analysis with AlphalensUsing Alphalens to evaluate alpha factorsFree data
Lecture 39Why You Should Hedge Beta and Sector ExposuresHow hedging common risk exposures can improve portfolio performanceFree data
Lecture 40VaR and CVaRUsing Value at Risk to estimate potential lossFree data
Lecture 41Integration, Cointegration, and StationarityIntroduction to stationarity and cointegration, which underpins pairs tradingFree data
Lecture 42Introduction to Pairs TradingA theoretical and practical introduction to pairs tradingFree data
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 dataFree data

License¶

© Copyright Quantopian, Inc.
© Modifications Copyright QuantRocket LLC

Licensed under the Creative Commons Attribution 4.0.