backtest-ollama-crontab is a TypeScript monorepo demonstrating how to use a locally-running Ollama LLM as an outline-based risk filter for cryptocurrency trading signals parsed from public Telegram channels. A 15-minute crontab drives live ingestion; the same codebase runs a full historical backtest so you can measure whether the LLM gate actually improves P&L. In a January 2026 backtest on real Telegram signal data, enabling the LLM filter improved total PnL from +52.22% to +68.90%, raised win rate from 68% to 82%, and lifted the Sharpe ratio from 0.309 to 0.512 — by vetoing just five trades.Documentation 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.
Quickstart
Build the workspace, authenticate Telegram, and run your first backtest in four steps.
Architecture
Understand the five-layer pipeline from Telegram crawl to LLM veto to strategy position.
Risk Outline
Deep-dive into the Ollama outline prompt, the two empirical veto rules, and zod-validated output.
Backtest Results
Full trade log and statistics for January 2026 — with and without the LLM gate.
How It Works
Telegram crawler ingests signals
CrawlerService pulls raw messages from a public Telegram channel via Telegram’s MTProto API and upserts them into the parser-items MongoDB collection.Parser extracts structured fields
CryptoYodaScreenService applies regex patterns to extract symbol, direction, entry, targets, and stoploss from each message.Ollama LLM applies risk rules
For every parsed signal, the
RiskOutline sends 1m/15m candle data plus pre-computed metrics to a local gpt-oss model. The LLM returns a riskAction: "skip" | "follow" verdict validated by zod.Key Features
Outline-Based LLM Filter
Two empirical veto rules (sleeping-coin SHORT, knife-catching LONG) are embedded directly in the Ollama system prompt — no recompilation needed to tune thresholds.
15-Minute Crontab
Cron.register from backtest-kit schedules a live Telegram poll every 15 minutes and a one-shot backtest data fetch at startup.Zod-Validated LLM Output
LLM responses are parsed against a zod schema and validated with five custom rules before they can influence trading decisions.
Full Backtest Harness
Replay any date range against the full pipeline using
backtest-kit, with optional candle caching for fast iteration.MongoDB + Redis Backend
Parsed signals go into
parser-items; LLM-screened results go into screen-items. Redis provides queuing for the signal job pipeline.DI Container via globalThis
All services are accessible through
globalThis.core, typed via TypeScript path aliases and rolled-up types.d.ts declarations.Quick Reference
| What you want | Where to look |
|---|---|
| First-time setup | Quickstart |
| Environment variables | Environment Setup |
| Docker infrastructure | Infrastructure |
| Telegram QR auth | Telegram Auth |
| Running a backtest | Running Backtest |
| Live mode | Running Live |
| Writing your own strategy | Writing Strategies |
| LLM prompt details | Risk Outline |
| Service API reference | Services |
| January 2026 results | Backtest Report |