Installation¶
Prerequisites¶
Python 3.11+
uv(recommended) orpip
Note
Since 0.3.7, nautilus-trader has been removed. A Rust toolchain or
build-essential is no longer required on any platform.
Install from PyPI¶
pip install nexustrader
Optional: ZeroMQ signal support¶
If you use custom signals via ZeroMQSignalConfig, install the extra:
pip install nexustrader[signal]
Optional: Bybit TradFi (MT5) support¶
To trade traditional financial markets (Forex, Gold, Indices, Stocks) via the Bybit TradFi brokerage (MetaTrader 5 backend):
pip install "nexustrader[tradfi]"
# or
uv add "nexustrader[tradfi]"
Note
The tradfi extra installs MetaTrader5 only on Windows. Base
installs on Linux/macOS do not install MetaTrader5. The MetaTrader5
terminal must be installed and logged in before starting NexusTrader.
See Bybit TradFi (MT5) for full setup instructions.
Install from source¶
Using uv (recommended):
git clone https://github.com/Quantweb3-com/NexusTrader
cd NexusTrader
uv sync
Using pip:
git clone https://github.com/Quantweb3-com/NexusTrader
cd NexusTrader
pip install -e .
Install Redis¶
In the newest version, redis is not required. You can specify the storage_backend in the Config to use other storage backends.
from nexustrader.config import Config
from nexustrader.constants import StorageType
config = Config(
storage_backend=StorageType.SQLITE,
)
Note
It is recommended to use StorageType.SQLITE for production environment, since StorageType.REDIS will be deprecated in the future version.
First, create a .env file in the root directory of the project and add the following environment variables:
NEXUS_REDIS_HOST=127.0.0.1
NEXUS_REDIS_PORT=6379
NEXUS_REDIS_DB=0
NEXUS_REDIS_PASSWORD=your_password
Create the docker-compose.yml file to the root directory of the project
version: '3.8'
services:
redis:
image: redis:alpine
container_name: redis
restart: always
ports:
- '${NEXUS_REDIS_PORT}:6379'
volumes:
- redis_data:/data
command: redis-server --appendonly yes --requirepass ${NEXUS_REDIS_PASSWORD}
environment:
- REDIS_PASSWORD=${NEXUS_REDIS_PASSWORD}
Run the following command to start the Redis container:
docker-compose up -d redis
Note
NexusTrader is tested on Linux, macOS, and Windows. On Windows, uvloop is automatically skipped and the standard asyncio event loop is used.