Getting from a fresh clone to a completed backtest takes four terminal commands. The steps below follow the exact sequence in the README: build the workspace packages, authenticate your Telegram account via QR code, copy the resulting session file into the strategy folder, then launch the backtest engine against the January 2026 signal set. Before you begin, make sure MongoDB and Redis are reachable at their default ports and that you have a validDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/theonetrade/backtest-ollama-crontab/llms.txt
Use this file to discover all available pages before exploring further.
CC_OLLAMA_TOKEN for the Ollama cloud service (https://ollama.com) with the gpt-oss:120b model available on your account.
The Ollama client in
packages/core/src/config/ollama.ts connects to https://ollama.com (the Ollama cloud service) using a bearer token. Set CC_OLLAMA_TOKEN to your Ollama API key in packages/core/.env before running any step. Make sure the gpt-oss:120b model is available on your Ollama account.Steps
Build the workspace packages
Run the build script from the repo root. The script (After the build completes you should see
scripts/linux/build.sh) iterates every directory inside packages/, runs npm install and npm run build in each one. Rollup bundles each package to a self-contained build/index.cjs and rolls up a consolidated types.d.ts alongside it.- Linux / macOS
- Windows
packages/core/build/index.cjs, packages/core/types.d.ts, packages/main/build/index.cjs, and packages/main/types.d.ts.Authenticate the Telegram MTProto session
The crawler uses GramJS (the A QR code is printed directly in your terminal. Open the Telegram mobile app, navigate to Settings → Devices → Link Desktop Device, and scan the code. If your account has two-factor authentication enabled, the CLI will prompt you for your 2FA password.On success the client prints
telegram npm package) over the MTProto protocol to read messages from a public channel. You need to authenticate once and persist the session string to a file.Connected! and writes the session string to:Copy the session into the strategy folder
The strategy file reads If you plan to run multiple strategy experiments in separate subdirectories of
session.txt at runtime from its own directory so it can subscribe to the configured channel without triggering a new authentication flow. Copy the file you just created:content/, copy the session file into each one.Run the January 2026 backtest
Return to the repo root and launch the The
@backtest-kit/cli runner, passing the strategy entry point and telling it to run in backtest mode. The --cache flag pre-fetches all required candles from the exchange before the replay begins — recommended for a first run so the replay doesn’t stall waiting for network calls.--ui flag opens the backtest-kit web dashboard in your browser so you can watch trades fill in real time. When the replay finishes you will see the full P&L summary including the Ollama-gated statistics: +68.90% total PnL, 82% winrate, Sharpe +0.512.CLI Flags Reference
All flags are parsed bypackages/main/src/helpers/getArgs.ts using Node’s built-in parseArgs. Every flag is a boolean; unknown flags are silently ignored (strict: false).
| Flag | Type | Description |
|---|---|---|
--backtest | boolean | Run in backtest mode. Requires --entry. Uses Backtest.background from backtest-kit. |
--live | boolean | Run in live trading mode. Requires --entry. Uses Live.background from backtest-kit. |
--paper | boolean | Run in paper trading mode. Requires --entry. Executes strategy logic without placing real orders. |
--session | boolean | Auth session only — runs packages/main/src/main/session.ts to generate session.txt. No strategy is loaded. |
--entry | boolean | Required for all modes except --session. Signals that a strategy entry point has been passed as a positional argument (e.g. --entry ./content/...). |
--cache | boolean | Pre-cache candles for all symbols in CC_SYMBOL_LIST before the backtest begins. Fetches 1m candles from frameSchema.startDate to frameSchema.endDate. |
Environment Variables
All configuration lives in a.env file at the repo root (loaded via dotenv-cli before any npm script). The defaults below are embedded directly in packages/main/src/config/params.ts and work out of the box for local development.
| Variable | Default | Purpose |
|---|---|---|
CC_MONGO_CONNECTION_STRING | mongodb://localhost:27017/backtest-pro?wtimeoutMS=15000 | MongoDB connection string for parser-items and screen-items collections |
CC_TELEGRAM_API_ID | 31861455 | Telegram MTProto API ID |
CC_TELEGRAM_API_HASH | ca60446c67ce250ee4e789c730163449 | Telegram MTProto API hash |
CC_SYMBOL_LIST | BTCUSDT,POLUSDT,ZECUSDT,HYPEUSDT,DOGEUSDT,SOLUSDT,PENGUUSDT,TRXUSDT,HBARUSDT,NEARUSDT,FARTCOINUSDT,ETHUSDT,PUMPUSDT | Comma-separated symbols for candle caching and strategy iteration |
CC_OLLAMA_TOKEN | “ (empty) | Bearer token sent as the Authorization header to the Ollama cloud service at https://ollama.com |
What Happens Under the Hood
When you run the backtest command, three things happen in sequence:1. waitForReady — services initialise
1. waitForReady — services initialise
backtest.ts calls waitForReady(true) from backtest-kit. This blocks until the CLI has loaded the strategy file, resolved the exchange schema and frame schema, and confirmed that all registered services are ready. The true argument indicates that this is a backtest (not live) run, which affects how getMode() and getContext() behave throughout the strategy.2. Optional candle cache — CC_SYMBOL_LIST × 1m
2. Optional candle cache — CC_SYMBOL_LIST × 1m
If
--cache is set, backtest.ts iterates CC_SYMBOL_LIST and calls cacheCandles for each symbol using the exchange name, frame start/end dates, and interval: "1m". This populates the local candle store so the replay never has to make live HTTP calls during simulation.3. Backtest.background — parallel symbol replay
3. Backtest.background — parallel symbol replay
For every symbol in
CC_SYMBOL_LIST, Backtest.background(symbol, { exchangeName, strategyName, frameName }) is called. Each invocation runs independently, replaying candles and emitting trades as the strategy’s cron handler fires on each 15-minute tick.