The backtest-kit Redis+MongoDB Docker project reads environment variables from two distinct groups. The first group configures the infrastructure connections — where to find MongoDB and Redis — and is consumed byDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/backtest-kit/backtest-kit-redis-mongo-docker/llms.txt
Use this file to discover all available pages before exploring further.
src/config/params.ts at startup. The second group controls the backtest-kit runtime — which mode to run, which strategy file to load, and which optional features to enable — and is forwarded to @backtest-kit/cli inside the container. Both groups can be set in a .env file at the project root, which is loaded automatically by Docker Compose via env_file: .env.
.env.example
The repository ships with a minimal .env.example that configures both connections to target the Docker host (for use with the infrastructure containers started from docker/):
.env and adjust the values for your environment before starting the stack.
Infrastructure variables
These variables are read bysrc/config/params.ts and used to construct the Redis (ioredis) and MongoDB (mongoose) client connections. All have fallback defaults that point to localhost, which is suitable for running the Node process directly on the host outside of Docker.
Hostname or IP address of the Redis server. When running the backtest-kit application container, set this to
host.docker.internal so the container can reach Redis on the Docker host. For remote infrastructure, use the server’s hostname or IP.TCP port that the Redis server is listening on. The bundled
docker/redis/docker-compose.yaml exposes Redis on the standard port 6379.Redis ACL username used for authentication. The default Redis ACL user is named
default. Change this only if your Redis instance has a custom ACL configuration.Password for Redis authentication, passed to the
ioredis client as the password option. This must match the --requirepass value configured in docker/redis/docker-compose.yaml. Override this with a strong unique password for production deployments.Full MongoDB connection URI passed directly to
mongoose.connect(). Includes the database name and a wtimeoutMS=15000 write concern timeout. When targeting the bundled MongoDB container from inside the application container, use host.docker.internal as the hostname. Change the database name (e.g. backtest-kit) to match your desired MongoDB database.Container runtime variables
These variables are consumed by@backtest-kit/cli when the application container starts. They mirror the CLI flags accepted by the local npm run start command and are forwarded from the host environment (or .env file) into the container via the environment block in docker-compose.yaml.
Selects the execution mode. Accepted values:
backtest, paper, live. Maps to the --backtest, --paper, and --live CLI flags respectively. Must be combined with ENTRY=1 to actually start execution.Path to the compiled strategy bundle inside the container. Because the project directory is mounted as
/workspace, a relative path like ./build/index.cjs resolves to /workspace/build/index.cjs. Run npm run build (or let npm run start:docker do it) before starting the container so this file exists.Set to
1 to allow the mode entry points to proceed. This mirrors the --entry CLI flag. Without ENTRY=1, the process starts but immediately exits from every mode’s guard check (if (!values.entry) return), making it a safe default for containers that should not auto-run on start.Override the trading symbol defined in the strategy (e.g.
TRXUSDT, BTCUSDT). When set, the CLI passes this value to the strategy context instead of the hardcoded default.Override the strategy name registered in the strategy bundle. Useful when a single compiled bundle contains multiple strategies and you want to select one at runtime.
Override the exchange name used by the strategy (e.g.
ccxt). Corresponds to the exchangeName field in the strategy context.Override the frame name used by the strategy. Corresponds to the
frameName field, which controls the OHLCV candle interval and time-range definition.Set to
1 to enable the web UI on port 60050. The UI provides a real-time dashboard for monitoring signals, positions, and strategy metrics. The container healthcheck targets this port, so UI=1 is required for the healthcheck to pass.Set to
1 to enable Telegram notifications for trade signals and alerts. Requires Telegram bot credentials to be configured in your strategy or environment.Set to
1 to enable verbose logging. Outputs detailed internal state transitions and adapter read/write operations to stdout.Set to
1 to disable the Redis cache layer. All adapter reads will fall through directly to MongoDB. Useful for debugging cache consistency issues but significantly increases MongoDB query load during backtests.Set to
1 to disable the data flush on process exit. By default, backtest-kit flushes in-memory state to the persistence layer when the process receives SIGINT. Disabling this speeds up container shutdowns at the cost of potentially losing the last few writes.Production .env example
A complete .env file for a production deployment with remote infrastructure:
.env: