Filters applied
Asset class
Frequency
Engine
Data
Market
Features

Code Library

Trading strategies, research, and tutorials that you can clone into your deployment.

Moonshot Intro

equities eod moonshot sampledata usstock

Introductory tutorial for Moonshot demonstrating data collection, universe selection, and backtesting of an end-of-day momentum strategy. Uses free sample data.

from quantrocket.codeload import clone
clone('moonshot-intro')
quantrocket codeload clone 'moonshot-intro'
 

Zipline Intro

alphalens equities eod intraday pipeline zipline sampledata usstock

Introductory tutorial for Zipline demonstrating data collection, interactive research, and backtesting of a momentum strategy for equities. Uses free sample data.

from quantrocket.codeload import clone
clone('zipline-intro')
quantrocket codeload clone 'zipline-intro'
 

Pipeline Tutorial

alphalens equities eod pipeline usstock

In-depth walkthrough of Pipeline, an API for filtering and performing computations on large universes of securities. The Pipeline API is part of Zipline but can also be used on a standalone basis.

from quantrocket.codeload import clone
clone('pipeline-tutorial')
quantrocket codeload clone 'pipeline-tutorial'
 

Quant Finance Lectures (adapted Quantopian Lectures)

alphalens equities eod pipeline zipline sampledata usstock

Learn quantitative finance with this comprehensive lecture series. Adapted for QuantRocket from the Quantopian Lecture Series. Most lectures use free sample data.

from quantrocket.codeload import clone
clone('quant-finance-lectures')
quantrocket codeload clone 'quant-finance-lectures'
 

Fundamental Factors

fundamentals alphalens pipeline sharadar equities eod us

Learn how to research fundamental factors using Pipeline, Alphalens, and Sharadar price and fundamental data. Demonstrates factor engineering techniques, exploratory data analysis (EDA), Alphalens tear sheet interpretation, sector neutralization, macro analysis, creating multi-factor scores, and more.

from quantrocket.codeload import clone
clone('fundamental-factors')
quantrocket codeload clone 'fundamental-factors'
 

Pairs Trading

equities usstock eod moonshot pairs us global

Pairs trading strategy for Moonshot that includes a research pipeline for identifying and selecting pairs. Tests all possible pairs in a universe for cointegration using the Johansen test, then runs in-sample backtests on all cointegrating pairs, then runs an out-of-sample backtest on the 5 best performing pairs. Calculates daily hedge ratios using the Johansen test and times entries and exits using Bollinger Bands.

from quantrocket.codeload import clone
clone('pairs-pipeline')
quantrocket codeload clone 'pairs-pipeline'
 

FX Business Day

fx ibkr sampledata intraday moonshot livetrading

Intraday FX strategy that exploits the tendency of currencies to depreciate during local business hours and appreciate during foreign business hours. Uses EUR.USD with hourly data from Interactive Brokers. Runs in Moonshot. Interactive Brokers account required but no QuantRocket subscription required.

from quantrocket.codeload import clone
clone('fx-bizday')
quantrocket codeload clone 'fx-bizday'
 

Sell on Gap

equities intraday pipeline zipline us usstock ibkr livetrading

Intraday Zipline strategy for US stocks that sells stocks which gap below their moving average after previously trading above it. Demonstrates live trading with Interactive Brokers or Alpaca.

from quantrocket.codeload import clone
clone('sell-gap')
quantrocket codeload clone 'sell-gap'
 

Machine Learning and the Kitchen Sink

equities eod ibkr us moonshot fundamentals sharadar ml

Machine learning strategy that trains the model using 'everything and the kitchen sink': fundamentals, technical indicators, returns, price levels, volume and volatility spikes, liquidity, market breadth, and more. Runs in Moonshot. Utilizes data from Sharadar and Interactive Brokers.

from quantrocket.codeload import clone
clone('kitchensink-ml')
quantrocket codeload clone 'kitchensink-ml'
 

Dead Cat Drop

equities edi eod moonshot global shortsale

Moonshot strategy that shorts stocks that fell 10% or more the previous day. Demonstrates how to run a multi-country backtest to find where an anomaly works best. Uses global equities data from EDI.

from quantrocket.codeload import clone
clone('dead-cat-drop')
quantrocket codeload clone 'dead-cat-drop'
 

QVAL US Value

equities eod moonshot fundamentals sharadar us

Value strategy for US stocks modeled on Alpha Architect's QVAL ETF, using enterprise multiple and Piotroski F-Score to target cheap, high-quality stocks. Utilizes Sharadar fundamental and price data. Runs in Moonshot.

from quantrocket.codeload import clone
clone('qval')
quantrocket codeload clone 'qval'
 

Intraday Futures Calendar Spreads

futures intraday ibkr sampledata us moonshot pairs livetrading

Intraday trading strategy for futures calendar spreads. Uses crude oil futures and 1-minute bid/ask bars from Interactive Brokers with a Bollinger Band mean reversion strategy. Runs in Moonshot. Demonstrates using exchange native spreads for live/paper trading, and non-native spreads for backtesting. Interactive Brokers account required but no QuantRocket subscription required for backtesting.

from quantrocket.codeload import clone
clone('calspread')
quantrocket codeload clone 'calspread'
 

QMOM US Momentum

equities eod moonshot us

Long-only momentum strategy modeled on Alpha Architect's QMOM ETF, selecting stocks with the smoothest momentum and rebalancing the portfolio before quarter end to capture a window-dressing seasonality effect.

from quantrocket.codeload import clone
clone('qmom')
quantrocket codeload clone 'qmom'
 

VMOT Value/Momentum/Trend

equities eod moonshot us

Value/Momentum/Trend strategy modeled on Alpha Architect's VMOT ETF. This repository provides the trend strategy and walks through backtesting the value, momentum, and trend strategies in tandem. For the value and momentum strategies, see the qval and qmom repositories.

from quantrocket.codeload import clone
clone('vmot')
quantrocket codeload clone 'vmot'
 

Leveraged ETF Intraday Momentum

equities usstock intraday moonshot us

Intraday momentum strategy that buys (sells) leveraged ETFs late in the trading session following a significant intraday gain (loss) and holds until the close. From Ernie Chan's book Algorithmic Trading. Uses 1-minute data from QuantRocket. Runs in Moonshot.

from quantrocket.codeload import clone
clone('trend-day')
quantrocket codeload clone 'trend-day'
 

First Half Hour Predicts Last Half Hour

equities usstock ibkr intraday moonshot us

Intraday momentum strategy that buys (sells) the S&P 500 when the first half hour return and penultimate half hour return are both positive (negative). Uses VIX filter to restrict strategy to high volatility regimes. Uses 1-minute SPY data from QuantRocket and 30-minute VIX data from Interactive Brokers. Runs in Moonshot.

from quantrocket.codeload import clone
clone('first-last')
quantrocket codeload clone 'first-last'
 

Global Market Profiles

equities global

Comparative analysis of stock market characteristics for 17 countries, including number of listings, short sale availability, volatility, distribution of sectors, etc.

from quantrocket.codeload import clone
clone('global-market-profiles')
quantrocket codeload clone 'global-market-profiles'
 

Moonshot Benchmarks

moonshot

Equal-weighted and dollar-volume-weighted benchmark strategies for Moonshot.

from quantrocket.codeload import clone
clone('benchmark')
quantrocket codeload clone 'benchmark'
 

Backtrader Moving Average

equities

Dual moving average crossover strategy for backtrader

from quantrocket.codeload import clone
clone('backtrader-dma')
quantrocket codeload clone 'backtrader-dma'