QuantRocket 2.6.0 is now available. This release includes an updated version of Zipline that works with modern packages and runs in QuantRocket's standard environment, plus other enhancements and bug fixes. All users are encouraged to update to the latest version. See how to update .
Highlights
- Zipline modernization. The Zipline package, which was pinned to old versions of pandas, numpy, and other libraries and is no longer maintained by Quantopian, has been streamlined and updated to work with modern package versions. As a result, Zipline is now installed in the standard QuantRocket environment. Benefits include:
- In JupyterLab, you no longer need to use Zipline in a separate "Zipline environment" kernel (which has been removed) but can use the standard Python 3 kernel;
- You can execute Zipline pipelines in satellite scripts;
- You can more easily install custom packages in the
zipline
container (previously, doing so tended to break Zipline due to Zipline's dependency on old package versions).
- Better futures calendar support in Zipline, including expanded calendar choices and support for calendars with trading breaks. See additional notes below under the
quantrocket/zipline
andtrading_calendars
sections. - Support for recording executions that happen outside of QuantRocket's knowledge. This can be used to keep the blotter aligned with your broker when one of your positions undergoes a tender offer, merger or acquisition, etc. See the usage guide.
- Update to JupyterLab 3.0, the most notable feature of which is a table of contents in the left area when you have a notebook open, allowing you to more easily navigate through long notebooks:
API Changes
- The updated versions of pandas, numpy, etc. that Zipline now uses have the potential to cause breakages in Zipline algorithms if you interact with those libraries directly. For example, in newer versions of pandas you cannot mix timezone-aware and timezone-naive datetimes, while in earlier versions of pandas you could. Users should carefully test their algorithms after updating. The version changes of the major packages are shown below:
- Python 3.6 -> Python 3.8
- pandas 0.22 -> pandas 1.2
- numpy 1.13 -> numpy 1.19
- Several previously deprecated Zipline functions have been removed, including
zipline.api.fetch_csv
(usequantrocket.get_prices
instead),zipline.api.set_do_not_order_list
(usezipline.api.set_asset_restrictions
instead), andzipline.api.symbol
(usezipline.api.sid
instead). - When requesting multiple fields for multiple assets using
data.history()
, Zipline previously returned the data as a pandasPanel
, support for which was removed starting in pandas 1.0. For this type of request, Zipline will now return a DataFrame in which the columns are a multiindex of (field, asset). No code changes should be required, however, as fields and assets can be accessed in the same way as before, by first accessing the desired field then the desired asset(s):
# used to return a Panel, now returns a multiindex DataFrame
prices = data.history(assets, ["close", "open"], 150, '1d')
aapl = algo.sid("FIBBG000B9XRY4")
aapl_closes = prices["close"][aapl]
- the
quantrocket_trading_calendars
package is now deprecated as all of its functionality has been merged into QuantRocket's fork of thetrading_calendars
package. Please update any imports ofquantrocket_trading_calendars
to importtrading_calendars
instead; no other code changes are required. Importingquantrocket_trading_calendars
will still work but will print a deprecation warning. - Zipline users with a minute bundle associated with the
CMES
/CME
/GLOBEX
trading calendar should drop and re-ingest the bundle. Reason: the trading hours for theCMES
/CME
/GLOBEX
calendar have been changed (corrected) from a 24-hour session to a 23-hour session (5pm - 4pm CT). To ensure proper querying of the minute bundle, this calendar change necessitates dropping and re-ingesting the bundle. Please also see the expanded set of choices for CME calendars as described below in thetrading_calendars
section, as there may be a more optimal calendar choice for your bundle than the standardCMES
/CME
/GLOBEX
calendar. - With this release, QGrid, the Excel-like widget for filtering and sorting DataFrames in notebooks, has been removed from JupyterLab. QGrid is not compatible with the latest version of JupyterLab, and unlike other Quantopian-created packages that QuantRocket now maintains, we deem QGrid to be too minor in importance to warrant ongoing maintenance. Given the technical proficiency of most QuantRocket users, we believe few if any users are currently using or relying on QGrid. If you were using QGrid, please use standard pandas techniques for filtering and sorting your DataFrames instead.
Documentation
- add a section to the Zipline docs clarifying when functions run and how orders are handled in daily vs minute backtests
- include the exchange hours in the trading calendars documentation to assist with selecting the best calendar
quantrocket-client:2.6.0
- fix a performance issue in
get_prices
when querying a database with text fields (which is possible starting in version 2.5.0 due to custom database support). See related forum post. - when querying a real-time aggregate database with
get_prices
and passing atimezone
parameter along withstart_date
and/orend_date
, the timezone will now be passed to the realtime service to aid in the interpretation ofstart_date
/end_date
. See related forum post.
quantrocket/blotter:2.6.0
- Add new endpoint for recording executions that happen outside of QuantRocket's knowledge. This can be used to keep the blotter aligned with your broker when one of your positions undergoes a tender offer, merger or acquisition, etc. See the usage guide.
quantrocket/houston:2.6.0
- Update to OpenResty version 1.19.3.1.
- Fix an issue where connecting to the IB Gateway GUI of a cloud deployment incorrectly counted against the concurrent install limit. See related forum post.
quantrocket/ibg:2.6.0
- update to IB Gateway version 978, the current stable version
quantrocket/jupyter:2.6.0
- Remove the separate "Zipline environment" kernel. Zipline is now installed in the standard Python 3 kernel.
- update to JupyterLab 3.0. This release includes a table of contents feature to facilitate navigating through long notebooks.
- update to quantrocket-client 2.6.0
- remove QGrid. See the fuller note above in API Changes.
quantrocket/moonshot:2.6.0
- add a new
ACCOUNT_BALANCE_FIELD
parameter to theMoonshot
class. This parameter allows you to customize which account balance field should be used to calculate order quantities in live trading. See the full description of the parameter in the API Reference. - fix a bug that prevented specifying integer account numbers when using the
--accounts
options withquantrocket moonshot trade
quantrocket/postgres:2.6.0
- update to TimescaleDB version 2.3.0. This is a maintenance upgrade with no significant new features.
quantrocket/realtime:2.6.0
- fix an issue where including a large number of sids in the query parameters could result in "Argument too long" errors. See related forum post.
- change the treatment of the
end_date
parameter inquantrocket.realtime.download_market_data_file
to be inclusive when only a date with no time is specified. Previously such a query was exclusive because the end date was automatically normalized to 00:00:00 (midnight). See related forum post. - improve reliability when automatically restarting Alpaca real-time data collection after a network disconnection
quantrocket/zipline:2.6.0
- modernize zipline to run on Python 3.8, Pandas 1.2, and other modern package versions. See the fuller note above.
- support for using calendars that incorporate trading breaks (applicable to some futures exchanges and some Asian exchanges). The minutes during the break will now be omitted from Zipline, meaning
handle_data
and other functions will not be called for those minutes. - respect
EODCancel
(end-of-day cancel policy) in daily mode. Previously, Zipline appliedEODCancel
in minute mode but ignored it in daily mode. In daily mode, Zipline now cancels any orders which do not fill in the next session after they are placed. See related forum post. - improve memory profile of backtests by reducing Zipline's cache sizes. See related forum post.
- when running a backtest or trading using a daily bundle, the
--data-frequency
/data_frequency
parameter will default to "daily" if omitted. Previously, it was necessary to specify the data frequency as daily explicitly. - fix a bug that prevented specifying integer account numbers when using the
--accounts
options withquantrocket zipline trade
- log a warning in live trading when a position has been delisted, instructing the user to manually record the execution (using the blotter's new API for recording executions). Previously, a
NotImplemented
error was raised when this situation arose. See related forum post.
trading_calendars:2.6.0
- incorporate all functionality that was previously provided by
quantrocket_trading_calendars
. (Thequantrocket_trading_calendars
package is now deprecated and will print a deprecation warning if imported.) - add new calendars for different CME-operated exchanges and products to better support futures, including trading breaks where appropriate. See the usage guide for the associated hours and breaks for each new or updated exchange:
-
CMES
/CME
/GLOBEX
(FX and interest rates) -
CME_EQUITY
(E-minis) -
CME_EQUITY_LIQUID
(E-mini liquid hours as defined by Interactive Brokers) -
NYMEX
(energy futures) -
CBOT
(agricultural futures)
-
- include the 11:30am - 12:30pm lunch break in the calendar for the Tokyo stock exchange (
XTKS
/TSEJ
)