Skip to main content

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.

The backtest-kit-redis-mongo-docker integration is configured entirely through environment variables. Application-level variables control how the Node.js process connects to Redis and MongoDB, while Docker container variables control runtime behaviour such as which mode to run, which strategy to load, and which optional features to enable. All variables can live in a single .env file that is shared by both the local Node.js process and the Docker container.
The .env file is loaded by both the local Node.js process (via dotenv) and the Docker container (via the env_file directive in docker-compose.yaml). A single file therefore configures the full stack consistently across local and containerised runs.

Quickstart: .env.example

Copy .env.example to .env and fill in the values for your environment before starting any service.
CC_REDIS_HOST=host.docker.internal
CC_MONGO_CONNECTION_STRING=mongodb://host.docker.internal:27017/backtest-kit?wtimeoutMS=15000
When running the backtest container through Docker, use host.docker.internal as the hostname so that the container can reach Redis and MongoDB services running on the host machine. Use 127.0.0.1 / localhost only when the Node.js process is running directly on the host.

Application Environment Variables

These variables are consumed by the Node.js process at startup via src/config/params.ts and src/config/redis.ts / src/config/mongo.ts. They control the connection details for Redis and MongoDB.

Redis Connection

CC_REDIS_HOST
string
default:"127.0.0.1"
Hostname or IP address of the Redis server. When running inside Docker, set this to host.docker.internal so the container can reach a Redis instance on the host machine.
CC_REDIS_HOST=host.docker.internal
CC_REDIS_PORT
number
default:"6379"
TCP port on which Redis is listening. The standard Redis port is 6379 and matches the port exposed by the bundled docker/redis/docker-compose.yaml.
CC_REDIS_PORT=6379
CC_REDIS_USER
string
default:"default"
Redis ACL username. The default Redis user is named default; change this only if your Redis instance uses a custom ACL configuration.
CC_REDIS_USER=default
CC_REDIS_PASSWORD
string
default:"mysecurepassword"
Password for the Redis user. Must match the --requirepass value set in docker/redis/docker-compose.yaml. Update both files together whenever you rotate the password.
CC_REDIS_PASSWORD=mysecurepassword

MongoDB Connection

CC_MONGO_CONNECTION_STRING
string
Full MongoDB connection URI including host, port, database name, and connection options. The wtimeoutMS=15000 query parameter sets a 15-second write-concern timeout to prevent indefinite hangs on slow writes. When running in Docker, replace localhost with host.docker.internal.
CC_MONGO_CONNECTION_STRING=mongodb://host.docker.internal:27017/backtest-kit?wtimeoutMS=15000

Docker Container Environment Variables

These variables are declared in the environment block of docker-compose.yaml and are forwarded from the host shell (or the .env file) into the running container. They are read by the backtest-kit CLI and the application entry points at runtime.

Execution Control

MODE
string
Selects the run mode passed to the CLI. Accepted values are backtest, live, and paper. When using npm run start:docker the script sets MODE=backtest automatically.
MODE=backtest
ENTRY
string
Set to 1 to allow the strategy entry points to execute. All three main entry points (backtest.ts, live.ts, paper.ts) immediately return if ENTRY is not set to 1. This acts as a safety guard against accidental execution.
ENTRY=1
STRATEGY_FILE
string
default:"./build/index.cjs"
Path to the compiled strategy bundle that the CLI will load. The default value matches the Rollup output path produced by npm run build.
STRATEGY_FILE=./build/index.cjs

Strategy Overrides

SYMBOL
string
Override the default trading symbol (e.g. TRXUSDT). When set, this value takes precedence over any symbol hardcoded in the strategy entry point.
SYMBOL=BTCUSDT
STRATEGY
string
Override the strategy name registered in the IoC container. Useful for running a different strategy without rebuilding the image.
STRATEGY=MyCustomStrategy
EXCHANGE
string
Override the exchange name (e.g. ccxt). Corresponds to the ExchangeName enum values used inside the strategy entry points.
EXCHANGE=ccxt
FRAME
string
Override the frame name that defines the historical time window for backtesting. Corresponds to FrameName enum values.
FRAME=Jan2026Frame

Optional Features

UI
string
Set to 1 to enable the web dashboard. When active, the dashboard is served on port 60050 and is accessible at http://localhost:60050. The health-check endpoint at /api/v1/health/health_check is also available when the UI is enabled.
UI=1
TELEGRAM
string
Set to 1 to enable Telegram trade notifications. Requires additional Telegram bot credentials to be configured in the strategy code.
TELEGRAM=1
VERBOSE
string
Set to 1 to enable verbose logging output from the CLI and strategy runtime. Useful for debugging indicator calculations and order flow.
VERBOSE=1
NO_CACHE
string
Set to 1 to disable the Redis O(1) ID cache. All ID lookups will fall back to MongoDB queries. Useful for testing persistence logic without a running Redis instance.
NO_CACHE=1
NO_FLUSH
string
Set to 1 to skip the Redis cache flush that normally occurs on startup. Preserves any cached IDs from a previous run, which can significantly speed up repeated backtests over the same date range.
NO_FLUSH=1

Full .env Reference

The following block shows every supported variable with representative values for a Docker-based backtest run.
# Redis connection
CC_REDIS_HOST=host.docker.internal
CC_REDIS_PORT=6379
CC_REDIS_USER=default
CC_REDIS_PASSWORD=mysecurepassword

# MongoDB connection
CC_MONGO_CONNECTION_STRING=mongodb://host.docker.internal:27017/backtest-kit?wtimeoutMS=15000

# Run control
MODE=backtest
ENTRY=1
STRATEGY_FILE=./build/index.cjs

# Strategy overrides (optional)
SYMBOL=TRXUSDT
STRATEGY=Jan2026Strategy
EXCHANGE=ccxt
FRAME=Jan2026Frame

# Optional features
UI=1
TELEGRAM=0
VERBOSE=0
NO_CACHE=0
NO_FLUSH=0
Never commit a .env file containing real passwords or API keys to version control. The repository includes .env.example as a safe template — copy it to .env and keep .env in .gitignore.

Build docs developers (and LLMs) love