This guide walks you through every step needed to go from a fresh clone to a running backtest: launching the MinIO and Redis infrastructure containers, configuring credentials inDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/theonetrade/backtest-kit-minio-s3-docker/llms.txt
Use this file to discover all available pages before exploring further.
.env, building the compiled strategy bundle, and running the runner in backtest, live, or paper mode. The entire flow — infrastructure up through first execution — takes under 5 minutes.
Clone the repository and verify prerequisites
Before you begin, make sure the following are installed on your machine:The project uses Rollup to bundle your strategy into a single CommonJS file at
- Node.js 18 or later — the CLI and build toolchain require the native
parseArgsAPI introduced in Node 18. - Docker and Docker Compose — used to run the MinIO and Redis infrastructure containers.
./build/index.cjs. The @backtest-kit/cli package is the runner that the npm scripts delegate to.Start MinIO
MinIO provides the S3-compatible object store that all 16 persist adapters write to. Start it with the dedicated Compose file under This launches the following service:MinIO exposes:
docker/minio/::9000— the S3 API endpoint consumed by the adapters.:9001— the browser-based MinIO Console for inspecting buckets and objects.
The
MINIO_DEFAULT_BUCKETS=backtest-kit environment variable pre-creates the backtest-kit bucket on first boot. All 16 persist adapters share this single bucket using folder prefixes (e.g. candle-items/, log-items/), so no manual bucket creation is required. You can browse and inspect all stored objects at http://localhost:9001 using the credentials minioadmin / minioadmin.Start Redis
Redis maintains the time-ordered minute-bucket index for the three entities that require newest-first listings: Log, Notification, and Storage. Start it with the dedicated Compose file under This launches the following service:Redis is started with password authentication (
docker/redis/:mysecurepassword). The Redis data is persisted to ./redis_data on the host, so the minute-bucket index survives container restarts. If the index is lost (e.g. after redis-cli FLUSHALL), the adapters fall back automatically to S3 prefix listings and re-warm the index in the same pass.Configure environment variables
Copy the example file and edit the values to match your local setup:The
.env.example file contains:| Variable | Default | Description |
|---|---|---|
CC_MINIO_ENDPOINT | host.docker.internal | Hostname or IP of the MinIO S3 API. Use host.docker.internal inside Docker; use 127.0.0.1 for host-node runs. |
CC_MINIO_PORT | 9000 | S3 API port exposed by the MinIO container. |
CC_MINIO_ACCESSKEY | minioadmin | MinIO root user (matches MINIO_ROOT_USER in the MinIO Compose file). |
CC_MINIO_SECRETKEY | minioadmin | MinIO root password (matches MINIO_ROOT_PASSWORD). |
CC_REDIS_HOST | host.docker.internal | Hostname of the Redis instance. |
CC_REDIS_PORT | 6379 | Redis port. |
CC_REDIS_USER | default | Redis ACL username (use default for password-only auth). |
CC_REDIS_PASSWORD | mysecurepassword | Redis password (matches --requirepass in the Redis Compose file). |
Build the strategy bundle
Rollup compiles your TypeScript strategy into a single CommonJS bundle at The build step is also run automatically by the
./build/index.cjs:start and start:docker npm scripts, so you only need to run it manually if you want to separate the compile step from execution (e.g. in CI).Run your first backtest
With MinIO and Redis running and the bundle built, start the backtest runner:The
--entry flag gates execution in src/main/backtest.ts — without it the runner starts but no strategy is launched. --backtest selects backtest mode. --ui enables the web UI on port 60050.What happens on startup:- The Redis service initialises and waits for the connection (
ioc.redisService.waitForInit()). waitForReady(true)registers all 16 persist adapters and gates on first-touch infrastructure readiness.warmCandles(...)fetches historical OHLCV data from the exchange and stores it in thecandle-items/prefix in MinIO.Backtest.background(...)launches the strategy loop against the cached candles.
The web UI is available at http://localhost:60050 once the runner is ready. You can monitor positions, signals, logs, and notifications in real time without any additional setup.
Running in all three modes
- Backtest
- Live
- Paper
Replays historical candle data against your strategy. The backtest mode entry point (
warmCandles is called first to fetch and cache OHLCV data in MinIO, then Backtest.background drives the simulation.src/main/backtest.ts) waits for Redis, warms candles for the configured date range, then runs the strategy against the cached data.Additional CLI flags
Thesrc/helpers/getArgs.ts wrapper parses four boolean flags locally (--entry, --backtest, --live, --paper) using Node’s built-in parseArgs with strict: false, which means any additional flags are forwarded transparently to the underlying @backtest-kit/cli runner. The following flags are consumed by that runner:
| Flag | Description |
|---|---|
--ui | Enable the web UI on :60050. Pass the path to your bundle as the value (e.g. ./build/index.cjs). |
--telegram | Enable Telegram notifications (configure bot token in your strategy). |
--verbose | Emit verbose debug logging from the runner. |
--no-cache | Disable the runner’s in-process key cache. |
--no-flush | Skip flushing internal state on shutdown. |
Full Docker deploy
For a fully containerised deployment — strategy bundle, runner, andbacktest-kit runtime all inside a single container — use the root docker-compose.yaml. It pulls the tripolskypetr/backtest-kit image, mounts the project directory as /workspace, and reads runtime configuration from environment variables and .env.
Main docker-compose.yaml
extra_hosts: host.docker.internal:host-gateway mapping ensures the container can reach MinIO on :9000 and Redis on :6379 running on the host via the host.docker.internal hostname defined in .env.
Container environment variables
| Variable | Purpose |
|---|---|
MODE | backtest | live | paper — selects the runner entrypoint. |
STRATEGY_FILE | Path to the compiled strategy bundle inside /workspace (default: ./build/index.cjs). |
ENTRY | Set to 1 to actually run the strategy (mirrors the --entry CLI flag). |
SYMBOL | Override the trading symbol in the strategy context. |
STRATEGY | Override the strategy name. |
EXCHANGE | Override the exchange name. |
FRAME | Override the frame name. |
UI | Set to 1 to enable the web UI on :60050. |
TELEGRAM | Enable Telegram notifications. |
VERBOSE | Enable verbose logging. |
NO_CACHE | Disable the in-process key cache. |
NO_FLUSH | Skip flushing the Redis index on shutdown. |
Launch commands
npm run start:docker script is equivalent to:
MODE=backtest, ENTRY=1, and UI=1 pre-set.
After the container starts, the MinIO Console is available at http://localhost:9001 (credentials:
minioadmin / minioadmin) for inspecting bucket contents and object metadata. The backtest-kit web UI — showing live positions, signals, logs, and notifications — is available at http://localhost:60050 once the runner reports healthy (the healthcheck pings /api/v1/health/health_check every 30 seconds).