Skip to main content
Version: nightly

Getting Started

To get started with NautilusTrader you will need the following:

  • A Python environment with the nautilus_trader package installed.
  • A way to launch Python scripts for backtesting and/or live trading (either from the command line, or Jupyter notebook etc).

Installation

The Installation guide will help to ensure that NautilusTrader is properly installed on your machine.

Quickstart

The Quickstart provides a step-by-step walk through for setting up your first backtest.

Examples in repository

The examples presented in the online documentation cover only a portion of all available examples. For a complete collection, we recommend downloading the GitHub repository.

The following table lists example locations ordered by recommended learning progression:

DirectoryContains
/examplesFully runnable self-contained examples.
/docs/tutorialsVarious examples in form of Jupyter notebooks.
/docs/conceptsContains numerous small code snippets that provide an overview of available features, but examples are mostly not runnable.
/nautilus_trader/examplesExample implementations of basic strategies + indicators (in pure python) + algorithms.
/tests/unit_testsUnit-tests can be useful when looking for specific implementation details not covered in the examples.

Backtesting API levels

NautilusTrader provides two different API levels for backtesting:

API LevelDescriptionCharacteristics
High-Level APIUses BacktestNode and TradingNode• Recommended for production use
• Provides easier transition to live trading
• Requires using the data catalog (structured storage of market data in Parquet format)
Low-Level APIUses BacktestEngine• Primarily intended for testing and development of the library, but it is very useful for general backtesting
• Does not support live trading transition
• Allows direct access to components, so it may be easier to understand for beginners
• More transparent about internal operations but may lead to developing habits incompatible with live trading

Backtesting involves running simulated trading systems on historical data.

To get started backtesting with NautilusTrader you need to first understand the two different API levels which are provided, and which one may be more suitable for your intended use case.

info

For more information on which API level to choose, refer to the Backtesting guide.

Backtest (low-level API)

This tutorial runs through how to load raw data (external to Nautilus) using data loaders and wranglers, and then use this data with a BacktestEngine to run a single backtest.

Backtest (high-level API)

This tutorial runs through how to load raw data (external to Nautilus) into the data catalog, and then use this data with a BacktestNode to run a single backtest.

Running in docker

Alternatively, a self-contained dockerized Jupyter notebook server is available for download, which does not require any setup or installation. This is the fastest way to get up and running to try out NautilusTrader. Bear in mind that any data will be deleted when the container is deleted.

  • To get started, install docker:
  • From a terminal, download the latest image
    • docker pull ghcr.io/nautechsystems/jupyterlab:nightly --platform linux/amd64
  • Run the docker container, exposing the jupyter port:
    • docker run -p 8888:8888 ghcr.io/nautechsystems/jupyterlab:nightly
  • Open your web browser to localhost:{port}
info

NautilusTrader currently exceeds the rate limit for Jupyter notebook logging (stdout output), this is why log_level in the examples is set to ERROR. If you lower this level to see more logging then the notebook will hang during cell execution. A fix is currently being investigated which involves either raising the configured rate limits for Jupyter, or throttling the log flushing from Nautilus.