This guide walks you through cloning the project, starting the MongoDB and Redis infrastructure containers, and executing a backtest against the January 2026 TRX/USDT 1-minute candle dataset. The entire flow — from a clean machine to a running backtest with a live web dashboard — takes under five minutes.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/theonetrade/backtest-kit-redis-mongo-docker/llms.txt
Use this file to discover all available pages before exploring further.
Every run mode (
--backtest, --paper, --live) requires the --entry flag to be present on the command line. Without --entry, the process exits immediately so the compiled bundle can be safely imported as a library without triggering side effects. The --ui flag enables the web dashboard on port 60050.Steps
Verify prerequisites
Confirm the following tools are available on your machine before continuing.
Docker must be running and your user must have permission to manage containers without
| Tool | Minimum version | Check command |
|---|---|---|
| Node.js | 18.x | node --version |
| npm | 9.x | npm --version |
| Docker | 24.x | docker --version |
| docker-compose | 2.x | docker compose version |
sudo.Clone the repository and install dependencies
Clone the project from GitHub and install all Node.js dependencies in one go.The install step pulls
backtest-kit, @backtest-kit/cli, mongoose, ioredis, di-factory, and functools-kit from the npm registry.Configure environment variables
Copy the provided example file and open it in your editor.The default values target services running on the Docker host network and work without modification if you start MongoDB and Redis using the bundled compose files in the next two steps.
CC_REDIS_HOST — Hostname or IP address of the Redis server. When running under Docker, host.docker.internal resolves to the host machine, allowing the container to reach a Redis instance started with the bundled docker/redis/docker-compose.yaml.CC_MONGO_CONNECTION_STRING — Full MongoDB connection URI including the database name (backtest-kit) and a write-timeout hint (wtimeoutMS=15000). Replace host.docker.internal with a remote hostname if you are targeting an existing MongoDB deployment.Start MongoDB
Launch the MongoDB community server container in detached mode.This starts
mongodb/mongodb-community-server:8.0.4-ubi8 on port 27017 and persists data to docker/mongodb/mongo_data on the host. The container is configured with restart: always so it survives host reboots.Verify the container is healthy:Start Redis
Launch the Redis container in detached mode.This starts
redis:7.4.1 on port 6379 with password authentication (mysecurepassword) and persists the RDB snapshot to docker/redis/redis_data on the host.Verify the container is healthy:Run your first backtest
Build the TypeScript source and start the backtest runner with the web dashboard enabled.The
The runner will:
npm run start script runs rollup -c to produce ./build/index.cjs, then hands off to @backtest-kit/cli. The flags break down as follows:| Flag | Effect |
|---|---|
--entry | Required. Activates the entry-point guard so main() actually executes |
--backtest | Selects backtest mode; triggers warmCandles and Backtest.background |
--ui | Enables the web dashboard on port 60050 |
./build/index.cjs | Path to the compiled strategy bundle passed to the CLI |
- Wait for MongoDB and Redis to confirm their connections via
waitForInit() - Wait for
backtest-kitinternal services to signal readiness viawaitForReady(true) - Warm the January 2026 TRX/USDT 1-minute candle dataset into MongoDB
- Execute
Backtest.background("TRXUSDT", { ... })and stream results to MongoDB in real time
Open the web dashboard
Once the runner logs The dashboard provides a live view of open signals, partial fills, risk events, equity curves, and raw logs — all sourced directly from MongoDB via the running adapter layer.
Backtest started, open your browser to the dashboard.Port
60050 is the default for the backtest-kit web UI. If that port is already in use, stop the conflicting process or map a different host port by setting the ports field in docker-compose.yaml.Paper Trading Mode
Paper mode runs the strategy against the live exchange feed without placing real orders. All signals, risk events, and state snapshots are persisted to MongoDB identically to live mode, making paper runs a reliable pre-deployment validation step.waitForReady(false) in paper mode (no historical warm-up) and starts Live.background immediately after the services initialise.
Live Trading Mode
Live mode connects to the configured exchange and places real orders. Ensure your API credentials are set in.env and that the strategy has passed a full paper-trading validation cycle before switching to this mode.