Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/backtest-kit/backtest-kit-minio-s3-docker/llms.txt

Use this file to discover all available pages before exploring further.

By the end of this guide you will have MinIO and Redis running in Docker, a compiled strategy bundle ready, and a backtest executing against live OHLCV data — all persisted to your local S3-compatible object store. The host-node path (Node.js on your machine, containers for infrastructure) is the fastest way to iterate; a fully containerised deployment option is covered at the end.
1

Prerequisites

Make sure the following tools are installed before you begin:
ToolMinimum versionCheck command
Node.js18+node --version
DockerAny recentdocker --version
Docker ComposeV2 (compose sub-command) or standalonedocker compose version
node --version
# v18.0.0 or higher

docker --version
# Docker version 24.x.x or higher

docker compose version
# Docker Compose version v2.x.x
The project uses rollup to compile TypeScript and @backtest-kit/cli to launch the runner. Both are installed as local npm dependencies — no global installs are required beyond Node.js itself.
2

Clone the repository and install dependencies

git clone https://github.com/tripolskypetr/backtest-kit.git
cd backtest-kit/backtest-kit-minio-s3-docker
npm install
After npm install completes, the project tree includes:
  • src/ — TypeScript source for adapters, services, and strategy entry points
  • docker/ — standalone docker-compose files for MinIO and Redis
  • docker-compose.yaml — root compose file for the fully containerised runner
  • .env.example — environment template (copy to .env before running)
3

Configure the environment

Copy the example file and open it in your editor:
cp .env.example .env
The full contents of .env.example are:
# Infrastructure endpoints as seen from the backtest-kit container
# (docker-compose.yaml maps host.docker.internal to the host gateway).
# For a host-node run replace host.docker.internal with 127.0.0.1.

# MinIO (S3) — source of truth, see docker/minio/docker-compose.yaml
CC_MINIO_ENDPOINT=host.docker.internal
CC_MINIO_PORT=9000
CC_MINIO_ACCESSKEY=minioadmin
CC_MINIO_SECRETKEY=minioadmin

# Redis — time-ordered index, see docker/redis/docker-compose.yaml
CC_REDIS_HOST=host.docker.internal
CC_REDIS_PORT=6379
CC_REDIS_USER=default
CC_REDIS_PASSWORD=mysecurepassword
Variable reference:
VariableDescription
CC_MINIO_ENDPOINTHostname or IP of the MinIO server. Use host.docker.internal when running the strategy inside a container, or 127.0.0.1 for a host-node run.
CC_MINIO_PORTMinIO S3 API port. Default is 9000.
CC_MINIO_ACCESSKEYMinIO access key. Matches MINIO_ROOT_USER in the compose file (minioadmin by default).
CC_MINIO_SECRETKEYMinIO secret key. Matches MINIO_ROOT_PASSWORD in the compose file (minioadmin by default).
CC_REDIS_HOSTHostname or IP of the Redis server. Same host.docker.internal / 127.0.0.1 rule applies.
CC_REDIS_PORTRedis port. Default is 6379.
CC_REDIS_USERRedis ACL username. The default Redis setup uses default.
CC_REDIS_PASSWORDRedis requirepass value. Set to mysecurepassword in the provided compose file.
For a host-node run (Node.js on your machine, containers for infrastructure), change CC_MINIO_ENDPOINT and CC_REDIS_HOST from host.docker.internal to 127.0.0.1. The host.docker.internal hostname is only reachable from inside a Docker container; 127.0.0.1 resolves to the loopback interface on the host.
4

Start MinIO and Redis

Launch both infrastructure containers with their dedicated compose files:
docker-compose -f docker/minio/docker-compose.yaml up -d
docker-compose -f docker/redis/docker-compose.yaml up -d
What each command starts:
  • MinIO — image tripolskypetr/minio:2022, S3 API on :9000, management console on :9001, data persisted to docker/minio/minio_data/. The backtest-kit bucket is created automatically via MINIO_DEFAULT_BUCKETS.
  • Redis — image redis:7.4.1, port :6379, password mysecurepassword, data persisted to docker/redis/redis_data/.
Verify both containers are healthy:
docker ps
You should see minio and redis listed with status Up.MinIO console is available at http://localhost:9001. Log in with:
  • Username: minioadmin
  • Password: minioadmin
From the console you can browse the backtest-kit bucket, inspect stored objects, configure lifecycle rules, and monitor usage.
5

Build the strategy bundle and run a backtest

The npm run start script compiles the TypeScript source with Rollup and then hands off to @backtest-kit/cli:
npm run start -- --entry --backtest --ui ./build/index.cjs
Flag reference:
FlagPurpose
--entryGates execution — without this flag the runner imports the bundle but does not call main(). Required whenever you want the strategy to actually run.
--backtestSelects backtest mode. The src/main/backtest.ts entrypoint checks for this flag, warms historical candles, and launches Backtest.background().
--uiEnables the built-in web UI, served on port :60050. Omit this flag for headless / CI runs.
./build/index.cjsPath to the compiled strategy bundle produced by npm run build.
On first run the adapter’s waitForInit() gates execution until Redis is ready, then warmCandles() fetches OHLCV data from the exchange and writes it into MinIO before the strategy loop begins.
6

Open the web UI

Once the runner is live, open the backtest-kit web UI in your browser:
http://localhost:60050
The UI shows the strategy’s signal timeline, open and closed positions, log entries, and performance metrics — all sourced in real time from the MinIO + Redis persistence layer you just configured.

Running in Different Modes

The same infrastructure supports all three backtest-kit execution modes. Switch modes by changing the flag passed after --entry:
Replays historical candles stored in MinIO against your strategy. warmCandles() fetches any missing OHLCV data from the configured exchange before the replay begins.
npm run start -- --entry --backtest --ui ./build/index.cjs
The src/main/backtest.ts entrypoint:
  1. Waits for Redis to be ready (ioc.redisService.waitForInit())
  2. Calls waitForReady(true) — initialises adapters with initial = true
  3. Warms the candle cache for the configured symbol and date range
  4. Launches Backtest.background() with the configured exchange, frame, and strategy names

Full Docker Deployment

The quick-start above runs Node.js on your host machine with only the infrastructure containers. For a fully containerised deployment — where the strategy runner itself is also a container — use the root docker-compose.yaml:
npm run start:docker
# Runs: npm run build && cross-env MODE=backtest ENTRY=1 UI=1 STRATEGY_FILE=./build/index.cjs docker-compose up -d
To stop:
npm run stop:docker
# Equivalent to: docker-compose down
Full Docker deployment details, environment variable overrides (MODE, SYMBOL, STRATEGY, EXCHANGE, FRAME, TELEGRAM, VERBOSE, NO_CACHE, NO_FLUSH), and the container healthcheck configuration are covered in the Full Docker Deployment guide.
When the strategy runner is inside a container, it cannot reach MinIO or Redis via 127.0.0.1 — that resolves to the container’s own loopback, not the host. The root docker-compose.yaml adds extra_hosts: host.docker.internal:host-gateway so you can use host.docker.internal as the endpoint hostname in your .env, which routes through to the host machine where MinIO and Redis are listening.

Build docs developers (and LLMs) love