The strategy file (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.
content/jan_2026.strategy/jan_2026.strategy.ts) registers exactly two Cron.register calls to handle the fundamental difference between live and backtest execution. In live mode a recurring 15-minute timer polls the Telegram channel for new signals and immediately triggers the risk-filtering job. In backtest mode a one-shot initialiser pre-loads the full frame’s historical messages before backtest-kit begins replaying candle data. Both handlers share the same core service instances and simply skip themselves when the mode does not match.
Live Mode Crontab
interval: "15m" field instructs backtest-kit to invoke this handler once every 15 minutes during live execution. When backtest is true (i.e. history replay is active) the handler returns immediately, so the cron entry is harmless during backtests.
When the handler fires in live mode it calls crawlLiveFrame(when), which executes the following steps:
Mode guard
CrawlerMainService.crawlLiveFrame calls getMode() internally. If the runtime unexpectedly reports "backtest", the method returns without doing anything.Compute today's moment-stamp
getMomentStamp(when) converts the current Date to an integer like 20260115, identifying the calendar day to crawl.Crawl today's messages
crawlerService.crawlDay(stamp) fetches all Telegram messages published on that day and upserts them into the parser-items collection.Backtest Prepare Crontab
interval field means backtest-kit calls this handler once, at strategy startup, before the candle replay begins. In live mode (backtest is false) the handler returns immediately.
When executed in backtest mode, crawlBacktestFrame(when) performs the following:
Resolve the active frame
Reads
frameName from getContext() and looks up the matching entry in listFrameSchema() to obtain the frame’s startDate and endDate.Crawl the full date range
Converts both boundary dates to moment-stamps and calls
crawlerService.crawlRange(fromStamp, toStamp), which fetches every calendar day in the frame in parallel, upserting all parsed messages into parser-items.The Signal Job
signalJobSubject (from packages/core/src/config/emitters.ts) is a Subject<void> from functools-kit:
SignalJobService subscribes to it via enable() and invokes run() on each emission.
The run() method is wrapped with queued() so that concurrent emissions do not cause parallel executions — if a crawl fires the subject while a previous job is still processing, the second run is queued and executes after the first completes.
Backtest mode
- Loads all parser-items whose
publishedAtfalls within the frame’s date range. - Skips any row that already has a corresponding
screen-itemsentry. - Runs each remaining row through
SignalLogicService.execute(), which calls the RiskOutline, and writes the result toscreen-items. - Marks each parser-item as
visited: true.
Live mode
- Loads all parser-items that have not yet been visited (
visited: false). - Applies the same deduplication check against
screen-items. - Runs the RiskOutline and writes the result, then marks the row visited.
ExecutionContextService.runInContext() with symbol, when (aligned to 1-minute intervals via alignToInterval), and backtest set appropriately, so that backtest-kit’s candle APIs return historically accurate data for the exact moment the signal was published.
Cron Handler Parameters
EveryCron.register handler receives three arguments:
| Parameter | Type | Description |
|---|---|---|
symbol | string | The current symbol being processed by the strategy runner. Identifies which asset’s candle stream is active. |
when | Date | The current timestamp. In live mode this is the real wall-clock time. In backtest mode this is the simulated time at the current replay position. |
backtest | boolean | true when backtest-kit is replaying historical data, false in live execution. Use this flag to guard mode-specific logic at the handler level. |