Every signal inDocumentation 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.
backtest-ollama-crontab passes through exactly two MongoDB collections on its journey from a raw Telegram message to an actionable trade. The first collection, parser-items, holds the structured extraction of the original message. The second, screen-items, holds a complete copy of that data enriched with the five LLM-generated risk fields. Each collection has a distinct set of indexes tuned for the access patterns that follow it in the pipeline. Understanding what lives where — and which service owns each write — makes it easy to debug, replay, or extend any stage.
Stage 1 — parser-items
parser-items is written by ParserDbService.create(), called from CrawlerService.crawlRange() after CryptoYodaScreenService has parsed the raw Telegram message. Each document represents one fully-parsed signal message.
IParserDto interface
Field reference
| Field | Type | Set by | Description |
|---|---|---|---|
channel | string | CrawlerService | Channel name constant ("crypto_yoda_channel") |
source | string | CrawlerService | Mirror of channel |
messageId | number | CrawlerService | Telegram message ID |
publishedAt | Date | CrawlerService | UTC publish timestamp from Telegram |
note | string | CrawlerService | Full raw message text |
symbol | string | CryptoYodaScreenService | Ticker suffixed with USDT |
direction | "long" | "short" | CryptoYodaScreenService | Normalised from ШОРТ/ЛОНГ |
entry.from | number | CryptoYodaScreenService | Lower bound of entry zone |
entry.to | number | CryptoYodaScreenService | Upper bound of entry zone |
targets | number[] | CryptoYodaScreenService | Ordered take-profit prices |
stoploss | number | CryptoYodaScreenService | Hard stop-loss price |
content | unknown | CrawlerService | Full parsed payload (Mixed) |
visited | boolean | ParserDbService.markVisited() | false until LLM job completes |
MongoDB indexes on parser-items
channel, source, messageId, publishedAt, symbol, and visited also carry single-field indexes to support the range queries in ParserDbService.findAllByVisited(false) and findAllByPublishedAt(startDate, endDate).
Stage 2 — screen-items
screen-items is written by ScreenDbService.create(), called from SignalJobService after SignalLogicService.execute() returns a complete IScreenDto. Each document maps 1:1 to a parser-items row via the parserItemId foreign key and adds the five LLM risk fields.
IScreenDto interface
Field reference
| Field | Type | Stage | Description |
|---|---|---|---|
parserItemId | string | Stage 2 | Foreign key → parser-items._id |
channel | string | Stage 1 (copied) | Telegram channel identifier |
source | string | Stage 1 (copied) | Mirror of channel |
publishedAt | Date | Stage 1 (copied) | Original message UTC timestamp |
symbol | string | Stage 1 (copied) | Trading pair e.g. "SOLUSDT" |
direction | "long" | "short" | Stage 1 (copied) | Trade direction |
entryFrom | number | Stage 2 (flattened) | Lower bound of entry zone |
entryTo | number | Stage 2 (flattened) | Upper bound of entry zone |
targets | number[] | Stage 1 (copied) | Take-profit levels |
stoploss | number | Stage 1 (copied) | Hard stop-loss price |
riskAction | "skip" | "follow" | Stage 2 (LLM) | Primary veto decision |
riskSureLevel | 5-value enum | Stage 2 (LLM) | Accumulation confidence (audit) |
riskConfidence | "reliable" | "not_reliable" | Stage 2 (LLM) | Data reliability (audit) |
riskDescription | string | Stage 2 (LLM) | 2-3 sentence verdict ≥ 30 chars |
riskReasoning | string | Stage 2 (LLM) | Step-by-step audit ≥ 80 chars |
note | string | Stage 1 (copied) | Raw Telegram message text |
content | unknown | Stage 1 (copied) | Full parsed payload (Mixed) |
MongoDB indexes on screen-items
channel, source, publishedAt, symbol, riskSureLevel, riskConfidence, and riskAction carry single-field indexes to support filtered queries and post-analysis dashboards.
The getLast4HourSignal query
The strategy’sgetSignal callback calls SignalMainService.getLast4HourSignal(symbol, when) on every price tick. This method queries screen-items for the most recent document for symbol where publishedAt is within 4 hours before when, returning the full IScreenRow or null if nothing is found.
The
(symbol, publishedAt: -1) compound index on screen-items makes getLast4HourSignal efficient regardless of collection size — MongoDB sorts in reverse publishedAt order and scans only the subset matching the symbol before applying the 4-hour date filter.End-to-end field lineage
parser-items
Written by:
ParserDbService.create() via CrawlerServiceRead by: ParserDbService.findAllByVisited(false) in SignalJobServiceKey invariant: (channel, messageId) unique — idempotent upsert on re-crawlLifecycle flag: visited flipped to true by ParserDbService.markVisited() after LLM job completesscreen-items
Written by:
ScreenDbService.create() in SignalJobServiceRead by: SignalMainService.getLast4HourSignal() in strategy getSignalKey invariant: parserItemId unique — each parser row produces at most one screen rowDecision field: riskAction — strategy returns null immediately if "skip"