QuantRocket 2.1.0 is now available. This release contains a number of enhancements and usability improvements for Zipline strategy development, as well as bug fixes. All version 2 users are encouraged to update to the latest version. See how to update.
Highlights
- This release introduces a new Zipline Research API which greatly improves usability by allowing you to perform much of your Zipline strategy development within the interactive environment of a research notebook. It includes support for running pipelines and accessing the
data
objects used in Zipline strategies. Along with this change, a Zipline kernel has been added to JupyterLab. See the usage guide. - A progress meter has been added to Zipline backtests that provides progress and performance statistics during long-running backtests. See the usage guide.
- The new Zipline Intro tutorial in the Code Library walks you through the improved Zipline workflow.
- The runtime when ingesting daily updates of the US Stock 1-minute dataset has been signficantly improved. See the fuller note in the API Changes section.
API Changes
- The runtime for collecting daily updates of the US Stock 1-minute bundle has significantly improved. Previously, collecting an update took several hours but should now take only 30 minutes per day if updated daily (longer if collecting multiple days' updates). To take advantage of this speed improvement, you must drop and re-ingest the entire bundle. We regret this inconvenience, but previously ingested bundles did not store enough metadata to take advantage of the newly redesigned ingestion strategy. (Background: Previously, data was ingested by syncing one security at a time from the cloud to your local deployment. On updates, only the diff needed to be synced but determining the diff still took time. Now, if the Zipline service determines it will be faster, it will utilize an alternate strategy of loading individual daily update files, that is, ingesting data day by day instead of sid by sid. This is signficantly faster when you only need to ingest a day or a few day's worth of updates.)
- In Zipline strategies, commissions and slippage are now disabled by default. See the usage guide for reasoning and examples. The examples are based on the previous default behavior and can be used by users who wish to preserve the previous default behavior. (Note for futures traders: the dictionary of exchange fees by root symbol in the linked example only includes a subset of root symbols for simplicity. The full list of exchange fees by root symbol that was previously used for default futures commissions is available in GitHub.)
- In Zipline strategies, storing asset objects to
context
in theinitialize()
function is no longer supported and will throw an error. Instead, if you need to store asset objects tocontext
, please do so inbefore_trading_start
(or another function called afterinitialize
). Storing asset objects tocontext
ininitialize()
causes the asset objects to become stale in live trading because the asset objects are always loaded from the stored context instead of being re-instantiated each day. Daily re-instantiation of asset objects is necessary to ensure that the asset's metadata (particularly as concerns the asset's end date) stays up-to-date. Otherwise, assets will not be tradeable in live trading because Zipline will (incorrectly) think they are stale. We are choosing to immediately enforce this change instead of printing a deprecation warning due to the potential adverse effect on live trading.
The following is no longer allowed:
def initialize(context):
context.aapl = algo.sid("FIBBG000B9XRY4")
...
Replace it with this:
def before_trading_start(context, data):
context.aapl = algo.sid("FIBBG000B9XRY4")
...
Documentation
- Added Zipline Intro tutorial to Code Library.
- Added API reference sections for Alphalens, Pyfolio, and quantrocket-trading-calendars, and improved API reference for Zipline.
Complete 2.1.0 release notes
quantrocket/account:2.1.0
- fix a bug where checking your portfolio before collecting securities master listings for your broker caused an error
quantrocket/blotter:2.1.0
- improve reliability of Alpaca execution monitoring by always requesting an overlapping buffer of executions in case execution records arrive out of order. See related forum post.
quantrocket/history:2.1.0
- fix an issue caused by a change in the IBKR API behavior which resulted in missing dates when collecting 1-day bars from IBKR. See related forum post.
- query results will now respect the use of a datetime string (
YYYY-MM-DD HH:MM:SS
) for thestart_date
orend_date
parameter when querying an intraday history database. Previously, only the date part was extracted and used in the query, even if a datetime string was passed.
quantrocket/ibg:2.1.972.0
- improve error handling during rollback when setting IBKR credentials fails. See related forum post.
quantrocket/jupyter:2.1.0
- add Zipline Research API, with support for running pipelines and accessing
data
objects in interactive research. See the usage guide. - add a "Zipline environment" kernel to support using the Research API for Zipline. See the usage guide.
- add example templates to JupyterLab Launcher for Zipline strategies, Moonshot and Zipline allocation files, countdown crontabs, rollover rules configuration files, and IB Gateway permission files. Previously Launcher templates were only available for Moonshot and MoonshotML strategies.
quantrocket/postgres:2.1.0
- update to TimescaleDB 1.7.2
quantrocket/realtime:2.1.0
- fix an unhandled exception that occurred when you try to drop ticks from a real-time database that has no data
quantrocket/zipline:2.1.0
- add progress meter to Zipline backtests. See the usage guide.
- add endpoint to check bundle config. See API reference.
- use multithreading during initial ingestion of US Stock 1-minute data bundle, reducing runtime from 15-18 hours previously to 12-15 hours currently.
- improve runtime when ingesting daily updates of the US Stock 1-minute dataset. See the fuller note in the API Changes section above.
- ingest data one security at a time when ingesting from a daily history database. Previously the entire database was ingested in one go which failed on large databases. See related forum post.
- default to applying no commissions or slippage on backtests. See the usage guide for reasoning and examples. The examples are based on the previous default behavior and can be used by users who wish to preserve the previous default behavior.
- fix an issue where the presence of illiquid securities with no price data caused an error when querying the US Stock 1-minute data bundle without specifying sids or universes. See related forum post.
- fix an issue where ingestion failed if a security had a NULL symbol. See related forum post.
- improve error message when you query a Zipline bundle using a date range that is not present in the trading calendar
- fix an issue where ingesting a history database failed if you hadn't previously collected listings from Interactive Brokers
- provide a helpful error message if user tries to ingest two distinct futures chains (for example that trade on different exchanges) that use the same root symbol