NautilusTrader is an open-source, high-performance, production-grade algorithmic trading platform, providing quantitative traders with the ability to backtest portfolios of automated trading strategies on historical data with an event-driven engine, and also deploy those same strategies live.
The platform aims to be universal, with any REST/FIX/WebSocket API able to be integrated via modular adapters. Thus the platform can handle high-frequency trading operations for any asset classes including FX, Equities, Futures, Options, CFDs and Crypto - across multiple venues simultaneously.
The project heavily utilizes Cython, which provides static type safety and performance through C extension modules. The libraries can be accessed from both pure Python and Cython.
Cython is a compiled programming language that aims to be a superset of the Python programming language, designed to give C-like performance with code that is written mostly in Python with optional additional C-inspired syntax.
The documentation for the latest version of the package is available at readthedocs.
- Fast: C-level speed and type safety provided through Cython. Asynchronous networking utilizing uvloop.
- Reliable: Redis backed performant state persistence for live implementations.
- Flexible: Any FIX, REST or WebSocket API can be integrated into the platform.
- Backtesting: Multiple instruments and strategies simultaneously with historical quote tick, trade tick and bar data.
- Multi-venue: Multiple venue capabilities allows market making and statistical arbitrage strategies.
- AI Agent Training: Backtest engine fast enough to be used to train AI trading agents (RL/ES).
- Reliability
- Testability
- Performance
- Modularity
- Maintainability
- Scalability
The latest version is tested against Python 3.7 - 3.9 on Linux and MacOS. Users are encouraged to use the latest stable version of Python.
We recommend you setup a virtual environment to isolate the dependencies.
To install the latest package from PyPI, run:
pip install -U nautilus_trader
Alternatively, to install from source using pip, run:
pip install .
The following data types can be requested, and also subscribed to as streams.
Instrument
OrderBook
(L1, L2 and L3 if available. Streaming or interval snapshots)QuoteTick
TradeTick
Bar
The following PriceType
options can be used for bar aggregations;
BID
ASK
MID
LAST
The following BarAggregation
options are possible;
SECOND
MINUTE
HOUR
DAY
TICK
VOLUME
VALUE
(a.k.a Dollar bars)TICK_IMBALANCE
(TBA)TICK_RUNS
(TBA)VOLUME_IMBALANCE
(TBA)VOLUME_RUNS
(TBA)VALUE_IMBALANCE
(TBA)VALUE_RUNS
(TBA)
The price types and bar aggregations can be combined with step sizes > 1 in any
way through BarSpecification
objects. This enables maximum flexibility and now
allows alternative bars to be produced for live trading.
Bars can be either internally or externally aggregated (alternative bar types are only available by internal aggregation). External aggregation is normally for standard bar periods as available from the provider through the adapter integration.
Custom data types can also be requested through a users custom handler, and fed
back to the strategies on_data
method.
The following order types are available (when possible on an exchange);
Market
Limit
StopMarket
More will be added in due course including StopLimit
, MarketIfTouched
,
LimitIfTouched
and icebergs. Users are invited to open discussion issues to
request specific order types or features.
An integration adapter for CCXT Pro is currently under active development.
The adapter requires the ccxtpro
package, which in turn requires a license.
See https://ccxt.pro for more information.
Currently there are beta versions of integrations for Binance and BitMEX available
for early testing. These include advanced order options such as post_only
, hidden
reduce_only
, and all the TimeInForce
options. These integrations will be incrementally
added to.
The other exchanges will be available through CCXTs unified API with a more limited feature set. The intent here is to specify other data clients for arbitrage or market making strategies. Execution clients will be possible if a user only requires simple vanilla MARKET and LIMIT orders for trading on those exchanges.
We recommend the PyCharm Professional edition IDE as it interprets Cython syntax.
You could also use Visual Studio Code with a Cython plugin.
Poetry is the preferred tool for handling all package and dev dependencies.
To install all dependencies and compile the C extensions, run:
poetry install
Following any changes to .pyx
and .pxd
files, you can recompile by running:
python build.py
Refer to the Developer Guide for further information.
Involvement from the trading community is a goal for this project. All help is welcome! Developers can open issues on GitHub to discuss proposed enhancements/changes, or to make bug reports.
Please make all pull requests to the develop
branch.
Refer to the CONTRIBUTING.md for further information.
NautilusTrader is licensed under the LGPL v3.0 as found in the LICENSE file.
Contributors are also required to sign a standard Contributor License Agreement (CLA), which is administered automatically through CLAassistant.
Copyright (C) 2015-2021 Nautech Systems Pty Ltd. All rights reserved.