Getting backtest-ollama-crontab running locally takes four steps: build the npm workspace packages, authenticate a Telegram MTProto session, copy the session file into the strategy folder, and fire the backtest command. The entire pipeline — Telegram crawl, LLM risk filter, position engine — runs on your machine with no external cloud services required, as long as Ollama, MongoDB, and Redis are already up.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/backtest-kit/backtest-ollama-crontab/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
Before running any commands, confirm the following are available on your machine:- Node.js 18+ and npm with workspaces support (npm 7+)
- MongoDB running on
localhost:27017(default connection string:mongodb://localhost:27017/backtest-pro?wtimeoutMS=15000) - Redis running on
localhost:6379 - Ollama installed and the
gpt-oss:120bmodel pulled (ollama pull gpt-oss:120b), reachable athttp://localhost:11434 - A Telegram account on a phone that can scan QR codes within the Telegram app
Setup Steps
Build the workspace packages
From the repository root, run the build script for your platform. The script iterates every package under Each package emits two artifacts into its
packages/, runs npm install and npm run build inside each one:build/ directory:build/index.cjs— CommonJS bundle consumed at runtime by the CLItypes.d.ts— rolled-up TypeScript declarations that the roottsconfig.jsonpath aliases expose asglobalThis.core
packages/core or packages/main.Authenticate the Telegram MTProto session
The Telegram crawler uses GramJS (MTProto) rather than the Bot API, so it needs a full user-account session. Change into A QR code is printed directly in the terminal. Open the Telegram app on your phone, navigate to Settings → Devices → Link Desktop Device, and scan the code. Once authentication succeeds, a
packages/main and run the auth helper:session.txt file is written into the packages/main/ directory.The session file encodes an encrypted MTProto session string. It does not contain your password or 2FA secrets. Keep it out of version control —
session.txt is already listed in .gitignore.Copy the session into the strategy folder
The January 2026 strategy reads If you create additional strategies under
session.txt from its own directory at runtime so it can subscribe to the configured Telegram channel without re-authenticating. Copy the file you just created:content/, each one needs its own copy of session.txt in its folder.Run the January 2026 backtest
Return to the repository root and start the backtest:What happens under the hood:
@backtest-kit/cliloads the strategy file at the path given by--entry.- The
backtest-prepare-datacron handler fires once (nointervalset) and callscore.crawlerMainService.crawlBacktestFrame(when), which uses GramJSiterMessagesto pull the January 2026 message history from the configured channel into MongoDB. ChannelScreenService(Parse layer) runs regex extraction on each raw message, savingdirection,entry,targets, andstoplossto theparser-itemscollection.SignalJobServicepicks up each unvisited row and callsrisk.outline.ts, which sends the signal plus pre-computed candle metrics to Ollama. The model returns a zod-validatedriskAction: "skip" | "follow"verdict stored inscreen-items.- For each symbol/timestamp pair in the frame,
getSignalchecks whetherriskAction === "follow"and whether the current close price falls inside the signal’sentryFrom–entryTorange. Qualifying signals open positions withpriceTakeProfit = targets[2]andpriceStopLoss = signal.stoploss. - The
--uiflag opens the backtest-kit web UI so you can inspect the equity curve and individual trade details in real time.
Running in Live Mode
Once you are satisfied with the backtest results, switch to live mode to have the pipeline poll the Telegram channel on a recurring schedule:live-fetch-data cron handler runs every 15 minutes (interval: "15m"), calling core.crawlerMainService.crawlLiveFrame(when) to fetch the latest channel messages. Each new signal that has not been visited is passed through the LLM risk outline, and getSignal is queried by the backtest-kit engine on its normal tick cycle. The backtest-prepare-data handler is still registered but immediately returns when backtest === false, so there is no interference between the two cron jobs.
Live mode does not execute real orders — it relies on whichever exchange schema you have registered (the default uses ccxt with Binance in spot mode with
enableRateLimit: true). Wire up an actual exchange connector and order-management layer before treating live-mode signals as executable trades.Environment Variables
All configuration is read from a.env file in the repository root (loaded via dotenv-cli before each npm script). The table below lists every variable with its default value:
| Variable | Default | Purpose |
|---|---|---|
CC_MONGO_CONNECTION_STRING | mongodb://localhost:27017/backtest-pro?wtimeoutMS=15000 | MongoDB connection string |
CC_TELEGRAM_API_ID | 31861455 | Telegram MTProto API ID (replace with your own) |
CC_TELEGRAM_API_HASH | ca60446c67ce250ee4e789c730163449 | Telegram MTProto API hash (replace with your own) |
CC_SYMBOL_LIST | BTCUSDT,POLUSDT,ZECUSDT,HYPEUSDT,... | Comma-separated list of symbols the crawler processes per run |
CC_OLLAMA_URL | http://localhost:11434 | Ollama HTTP endpoint |