QuantRocket 2.10.0 Release Notes

QuantRocket 2.10.0 is now available. This release includes a new graphical tool for browsing databases, improved strategy debugging for Zipline and Moonshot, new sentiment data, a new learning bundle for free tier users, and numerous other enhancements. See how to update.

Highlights

Data Browser

The Data Browser is a new graphical tool for browsing the securities master database, price and fundamental data, and Pipeline output. Access the Data Browser from the JupyterLab Launcher. With the Data Browser, you can:

  • Look up a financial instrument's exchange, contract specifications, or Sid (security ID) without querying the API.
  • View price charts for any of the securities in any of your historical price databases (including custom databases).
  • View time series plots of fundamental metrics (EPS, P/B ratio, etc) from Sharadar for US stocks.
  • Open DataFrames of securities or CSV files of securities returned by other QuantRocket APIs and explore the securities graphically. For example, open a CSV file of orders from a Moonshot or Zipline trading strategy to see what stocks will be traded.
  • Open Pipeline output to view the securities that passed your Pipeline screen and to view time series plots of Pipeline columns.

See the usage guide for Data Browser videos.

Strategy Debugging for Zipline and Moonshot

Debug your Zipline strategy with the JupyterLab debugger. A new IPython magic command, %zipline_backtest, makes this possible. See the usage guide or the Zipline intro tutorial in the Code Library for a step-by-step video demonstration.

Interactive debugging is also available for Moonshot. A step-by-step video has been added to the Moonshot usage guide and the Moonshot intro tutorial in the Code Library.

Learning Bundle

The learning bundle, a new data offering for free tier users, provides daily prices for all US stocks and ETFs from 2007-2011. See the usage guide for details.

Sentiment Data

Three new sentiment datasets from data provider Brain are now available:

  • Brain Sentiment Indicator - financial news sentiment for 5,000+ US stocks
  • Brain Language Metrics on Company Filings - sentiment and language metrics from 10-K and 10-Q filings for 6,000+ US stocks
  • Brain Language Metrics on Earnings Call Transcripts - sentiment and language metrics from earnings call transcripts for 4,500+ US stocks

See the Data Library for more details.

Pipeline initial_universe

A new Pipeline argument, initial_universe, defines the assets to include in the initial universe on which the pipeline is computed. Like the existing screen argument, initial_universe can be used to filter the assets in a pipeline, but whereas screen runs after the pipeline is computed, initial_universe is applied before the pipeline is computed and can be used to decrease the size of the computational universe and thus speed up the pipeline. See the usage guide.

Zipline Order Types

New order types for the opening and closing auction: MarketOnCloseOrder, LimitOnCloseOrder, MarketOnOpenOrder, LimitOnOpenOrder. See the API Reference.

API Changes

  • This release includes updated versions of Python, pandas, numpy, and other libraries. Package updates always have the potential to cause breakages in your code if you interact with those libraries directly. Users should carefully test their algorithms after updating. The version changes of the major packages are shown below:

    • Python 3.9 -> Python 3.11
    • pandas 1.3 -> pandas 2.1
    • numpy 1.21 -> numpy 1.26
  • The trading_calendars package used by Zipline has been replaced with the better-maintained exchanges_calendars package. If you import and interact with this package directly, the main difference to be aware of is that in exchange_calendars, sessions are tz-naive, whereas in trading_calendars they were tz-aware. Minutes (as distinct from sessions) continue to be tz-aware. The guiding principle is that a minute (which is a datetime) has an associated timezone, while a session (which is a date only) does not. This principle is also reflected in the Zipline API, where asset.auto_close_date is now tz-naive (i.e. it contains a date only, so it has no associated timezone), while algo.get_datetime() continues to be tz-aware because it returns a minute, not just a date. In addition, some functions have been renamed. See the exchanges_calendars deprecation documentation. Users who don't interact with this package directly are unlikely to be affected by this change.

Code Library

  • a new tutorial walks you through the process of importing historical futures data into a custom database and combining it with recent data from Interactive Brokers

alphalens:2.10.0

  • new cumulative return line plots for each subgroup specified with groupby in an Alphalens tear sheet. Previously, Alphalens included bar plots showing the mean return by factor quantile within each subgroup, but not cumulative return plots. Cumulative return plots better allow you to see how the factor behaved within the subgroup over time. See the Alphalens examples in the Fundamental Factors tutorial in the Code Library.
  • add support for analyzing overnight and intraday returns in Alphalens. Previously, the periods parameter to alphalens.from_pipeline accepted only integers, specifying the number of days over which forward returns should be computed when analyzing forward performance. Now, periods also accepts the strings "co" or "oc" to indicate overnight (close-to-open) or intraday (open-to-close) returns, respectively. This allows you to analyze factor performance over periods shorter than 1 day.
  • The alphalens.from_pipeline function now returns a DataFrame of factor data to support additional analysis.
  • fix an error when calling alphalens.performance.create_pyfolio_input to convert Alphalens factor data to Pyfolio input. See related forum post.

quantrocket/dash:2.10.0

  • The quantrocket/dash image is a new container image that runs the Data Browser, a graphical tool for browsing the securities master database, price and fundamental data, and Pipeline output. The Data Browser is built with Plotly and Dash. Access the Data Browser from the JupyterLab Launcher.

quantrocket/fundamental:2.10.0

  • Three new alternative data integrations from data provider Brain. See the Data Library.
    • Brain Sentiment Indicator - financial news sentiment for 5,000+ US stocks
    • Brain Language Metrics on Company Filings - sentiment and language metrics from 10-K and 10-Q filings for 6,000+ US stocks
    • Brain Language Metrics on Earnings Call Transcripts - sentiment and language metrics from earnings call transcripts for 4,500+ US stocks

quantrocket/history:2.10.0

  • New API endpoint for listing all the sids in a history database: quantrocket history sids/quantrocket.history.list_sids. See the API Reference.
  • Fix an issue where querying an end-of-day history database with a pd.Timestamp instead of a date string caused the start date to be exclusive rather than inclusive. See related forum post.

quantrocket/jupyter:2.10.0

  • Debug your Zipline strategy with the JupyterLab debugger. A new IPython magic command, %zipline_backtest, makes this possible. See the usage guide or the Zipline intro tutorial in the Code Library.
  • New widgets on the JupyterLab Launcher allow you to open the Usage Guide or the API Reference in a JupyterLab tab.
  • A .bashrc template has been added to the Templates section of the JupyterLab Launcher. The main use of the .bashrc file is to create aliases, or shortcuts, to commonly used functions and commands. See the usage guide.
  • The IB Gateway GUI now opens in a JupyterLab tab instead of a new browser tab.

quantrocket/master:2.10.0

  • The API endpoint for listing IBKR exchanges, quantrocket master list-ibkr-exchanges/quantrocket.master.list_ibkr_exchanges, has been updated to conform to changes with the IBKR website. There are two changes as a result of this. First, the endpoint now returns 2-letter country codes instead of country names. See the usage guide for example output. Second, ETF is no longer a separate sec_type option, as ETFs will be included in the STK option.
  • The API endpoint for collecting IBKR listings, quantrocket master collect-ibkr/quantrocket.master.collect_ibkr_listings, has been updated to conform to changes with the IBKR website. Mostly, these changes affect the backend, but one user-facing change is that you can now optionally collect listings by 2-letter country code instead of by exchange code. This is a convenient way to collect listings for all exchanges in a country. See the usage guide for an example.

quantrocket/moonshot:2.10.0

  • The Benchmark field in a Moonshot backtest results CSV now contains benchmark returns instead of benchmark prices. This addresses an issue where running a segmented backtest against a Zipline bundle and specifying a benchmark security with one or more splits over the backtested date range would result in price jumps in the benchmark. See related forum post.

quantrocket/zipline:2.10.0

  • A new Pipeline argument, initial_universe, defines the assets to include in the initial universe on which the pipeline is computed. Like the existing screen argument, initial_universe can be used to filter the assets in a pipeline, but whereas screen runs after the pipeline is computed, initial_universe is applied before the pipeline is computed and can be used to decrease the size of the computational universe and thus speed up the pipeline. See the usage guide.
  • New order types for the opening and closing auction: MarketOnCloseOrder, LimitOnCloseOrder, MarketOnOpenOrder, LimitOnOpenOrder. See the API Reference.
  • The learning bundle, a new data offering for free tier users, provides daily prices for all US stocks and ETFs from 2007-2011. See the usage guide.
  • New convenience function zipline.research.use_bundle for setting a bundle in a research notebook or script without changing the default bundle. See the Usage Guide.
  • New pipeline factors for overnight (close-to-open) and intraday (open-to-close) returns: zipline.pipeline.factors.OvernightReturns (API Reference) and zipline.pipeline.factors.IntradayReturns (API Reference).
  • New pipeline factor for periodic computations: zipline.pipeline.periodic.PeriodicChange (API Reference).
  • New API endpoint for listing all the sids in a bundle: quantrocket zipline sids/quantrocket.zipline.list_sids. See the API Reference.
4 Likes

The new data browser feature is incredible! This is exactly the type of tools I feel like a lot of people want to review the results of a backtest, and live trading. Good stuff.

1 Like

Brian, the data browser is great! Is there a way to today (or maybe this is a feature request) to use the Data Browser to sort based upon time period rather than specific securities? For example, I'd like to understand what positions were being held during a specific day, week, month, etc. of a backtest. Any insights on this would be great. Thanks.

When you open a Zipline backtest CSV in the Data Browser, it will load every security you traded in the backtest. To focus on trades in a specific time period, you can run another backtest for just that time period.

Ahh, that makes complete sense. Thank you.