software for
data-driven traders

Research and trade
quantitative strategies
in global markets
using Python

feature icon Watch the Intro Video

See how to run an intraday momentum strategy in QuantRocket, all the way from data collection to backtesting to live trading to performance tracking.

Find more example strategies in the Code Library

feature icon Global Data Made Easy

Research without the wrangling

Most quants spend 80% of their time wrangling data and only 20% doing research.
QuantRocket puts a wealth of global market data at your fingertips so you can focus on analysis.

What will you ask the data?

>>> prices = get_prices('us-stk-1d').loc["Close"]
>>> sectors = get_securities_reindexed_like(prices, fields=["Sector"]).loc["Sector"]
>>> eps = get_sharadar_fundamentals_reindexed_like(prices, fields=["EPS"]).loc["EPS"]
>>> eps.groupby(sectors).mean()
>>> prices = get_prices("us-stk-1d").loc["Close"]
>>> borrow_fees = get_ibkr_borrow_fees_reindexed_like(prices)
>>> borrow_fees.where(prices < 1).rank(axis=1)
>>> at_close = prices.xs("16:00:00", level="Time")
>>> near_close = prices.xs("15:30:00", level="Time")
>>> is_up_for_session = (near_close - at_close.shift()) / at_close.shift()
>>> last_half_hour_returns = (at_close - near_close) / near_close
>>> last_half_hour_returns.where(is_up_for_session)
>>> cl_prices = get_prices("cl-fut-1min", times="14:00:00").loc["Close"]
>>> gold_prices = get_prices("us-stk-1d", sids="FIBBG000CRF6Q8").loc["Close"]
>>> contract_nums = get_contract_nums_reindexed_like(cl_prices, limit=2)
>>> month_1_prices = cl_prices.where(contract_nums==1).mean(axis=1)
>>> month_2_prices = cl_prices.where(contract_nums==2).mean(axis=1)
>>> cl_in_contango = month_2_prices > month_1_prices
>>> gold_prices.where(cl_in_contango)

Find your data in the Data Library

Why trade international markets?
  See reasons

Most traders focus on the US market — the most competitive market in the world. Yet the US stock market represents less than 50% of global market cap and only 25% of global listings.

Escape crowded trades

Academic research shows that market anomalies are more enduring in international markets .

Find the right market

Write your strategy code once and backtest it in numerous countries to find where it works best.

Validate your backtests

A backtest that performs well across several global markets is more robust than one tested on a single market.

Trade around the clock

When the US closes, Asia opens. When Asia closes, Europe opens. Exploit profitable opportunities whenever they occur.

QuantRocket is tailor-made for global markets

feature icon Choose Your Backtester

One size does NOT fit all

The backtester that's right for you depends on the style of your trading strategies. End of day or intraday? 6 symbols, or 6000? QuantRocket supports multiple open-source Python backtesters. Or, plug in your own favorite backtester thanks to QuantRocket's modular, microservice architecture.

Moonshot is the backtester for data scientists

Key features:

  • Based on Pandas, the centerpiece of the Python data science stack
  • Fast, vectorized, multi-strategy backtests and parameter scans
  • Daily or intraday strategies
  • Equities, futures, and FX
  • Live trading
  • Open source, designed by and for QuantRocket
from moonshot import Moonshot

class MovingAverageStrategy(Moonshot):

    CODE = "demo-50ma"
    DB = "demo-stk-1d"

    def prices_to_signals(self, prices):
        # Buy when the close is above the 50-period moving average.
        closes = prices.loc["Close"]
        mavgs = closes.rolling(50).mean()
        signals = closes > mavgs.shift()
        return signals.astype(int)

See Moonshot code examples or read the Moonshot docs

The first professional-grade platform for live trading with Zipline,
the popular backtester that powers Quantopian

Key features:

  • Event-driven backtesting using Python
  • 1-minute US stock data included
  • Support for equities and futures
  • Integrated support for related Quantopian open-source libraries including Alphalens, Pyfolio, and QGrid
  • Live trading with QuantRocket-built adapters. Learn more
import zipline.api as algo

def handle_data(context, data):
    short_mavg = data.history(context.sym, 'price', 100, '1d').mean()
    long_mavg = data.history(context.sym, 'price', 300, '1d').mean()

    if short_mavg > long_mavg:
        algo.order_target_percent(context.sym, 0.2)
    elif short_mavg < long_mavg:
        algo.order_target_percent(context.sym, 0)

Read the Zipline docs or see Zipline code examples

First class support for machine learning strategies with MoonshotML

Key features:

  • Walk-forward optimization: Rolling and expanding walk-forward optimization, widely considered the best technique for validating machine learning models in finance.
  • Incremental/out-of-core learning: Train models and run backtests even when your data is too large to fit in memory.
  • Multiple machine learning/deep learning packages: Including scikit-learn, Keras + TensorFlow, and XGBoost.
from moonshot import MoonshotML

class DemoMLStrategy(MoonshotML):

    CODE = "demo-ml"
    DB = "demo-stk-1d"

    def prices_to_features(self, prices):
        closes = prices.loc["Close"]
        features = {}
        # use past returns...
        features["returns_1d"]= closes.pct_change()
        # ...to predict next day returns
        targets = closes.pct_change().shift(-1)
        return features, targets

    def predictions_to_signals(self, predictions, prices):
        # buy when the model predicts a positive return
        signals = predictions > 0
        return signals.astype(int)

See MoonshotML code examples or read the machine learning docs

Connect third-party backtesters or run custom scripts

A hint of what's possible:

  • Run third-party backtesters such as backtrader
  • Schedule daily downloads of third party data
  • Create an options trading script that uses QuantRocket's Python API to query data and place orders using the blotter
  • Create and schedule multi-step maintenance tasks such as creating futures calendar spreads based on changing rollover rules
import backtrader as bt

class DualMovingAverageStrategy(bt.SignalStrategy):

    params = (
        ('smavg_window', 100),
        ('lmavg_window', 300),
    )

    def __init__(self):

        # Compute long and short moving averages
        smavg = bt.ind.SMA(period=self.p.smavg_window)
        lmavg = bt.ind.SMA(period=self.p.lmavg_window)

        # Go long when short moving average is above long moving average
        self.signal_add(bt.SIGNAL_LONG, bt.ind.CrossOver(smavg, lmavg))

See a complete example or read the custom scripts docs

feature icon Deploy With Ease

Run anywhere

Linux, Mac, or Windows. In the cloud or on your laptop. QuantRocket runs anywhere Docker runs.

Connect from anywhere

Control your cloud-based deployment securely from any location using QuantRocket's JupyterLab web interface.

Flexible architecture

Use QuantRocket as a standalone end-to-end trading platform, or connect to it from other trading applications to query data, submit orders, or use other components you need.

Your servers, your way

Hosted platforms like QuantConnect limit your compute resources and require uploading your secrets to third party servers. QuantRocket's ready-to-use trading infrastructure runs on your servers. Give your hardware as much power as you want, and keep your secrets safe.

Multiple editors

Your IDE or editor is where you spend your time. That's why QuantRocket gives you choices.

Learn more

Powered by Open Source

QuantRocket's flexible, fault-tolerant, and performant stack is built on top of the best open source software available.

feature icon Live Trading

Multi-strategy, multi-account

Trade multiple strategies in multiple accounts, or even with multiple brokers, with different allocations for each. QuantRocket keeps it all straight.

Automated or semi-manual

Fully automate your strategies, or manually review the order file before placing it.

Built-in scheduler

Automate data collection and live trading using standard Unix cron.

Supported Brokers

Interactive Brokers
Alpaca
FIX
FIX adapter available on request to enterprise users
Want us to add your broker? Tell us

feature icon Real-time Data

Real-time market data, powered by Polygon.io or Interactive Brokers.
An intuitive API with a flexible feature set, powered by QuantRocket.

feature icon Track Your Live Trading

Backtesting is only the first step. Once you go live, you need a clear picture of performance to assess whether live trading is mirroring your backtest.