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.
RiskOutlineContract is the TypeScript type inferred from the Zod schema RiskOutlineFormat. Every Ollama response goes through this schema before being persisted to screen-items. The contract enforces both structural correctness (via Zod’s enum and string constraints) and semantic correctness (via five post-parse validators), ensuring that only well-formed LLM outputs reach the database.
Zod Schema
The fullRiskOutlineFormat definition from packages/core/src/contract/RiskOutline.ts:
Fields
Trading decision returned by the LLM.
follow instructs the system to open a position in the signal’s direction (as specified by direction in the draft signal). skip instructs the system to discard this signal entirely. This is the only field that affects pipeline behavior — all other fields are audit data.LLM’s confidence that the candle data shows signs of market manipulation. This is an audit-only field and does not affect the
action decision directly.Data quality assessment for the LLM’s input.
reliable means ≥60 one-minute candles were available and metrics are unambiguous. not_reliable means the candle data was contradictory, sparse, or absent. This is an audit-only field — it does not gate the pipeline.A 2–3 sentence human-readable verdict intended for the trader. Must name the applied rule with specific numeric values. Minimum 30 characters. Example output:
"Action skip. SHORT на спящем активе (avgRangePct 0.045% < 0.07%) — stop-hunt мишень. Sure_level high, confidence reliable."
A single flat string (not a JSON object, not an array) containing newline-separated steps that show the LLM’s full decision process. Minimum 80 characters. Expected format:
Validators
After Zod parses the raw LLM JSON, five additional validation rules are applied. If any rule fails theisValid flag is false and error contains the failure message — the row is not written to screen-items.
| # | Field | Rule |
|---|---|---|
| 1 | action | Must be one of ["skip", "follow"] |
| 2 | sure_level | Must be one of ["low", "low_medium", "medium", "medium_high", "high"] |
| 3 | confidence | Must be one of ["reliable", "not_reliable"] |
| 4 | description | Must be a string with ≥ 30 characters |
| 5 | reasoning | Must be a string with ≥ 80 characters |
All five validators correspond directly to Zod’s own constraints. They serve as an explicit guard layer that surfaces clear error messages when the LLM produces truncated or malformed output that still parses as valid JSON.
Enums
Three TypeScript enums are used alongsideRiskOutlineContract to identify the outline, its advisors, and its completion strategies:
Usage
SignalLogicService invokes the outline via json() from agent-swarm-kit. The call passes the symbol, direction, target prices, and stop-loss from the IParserRow as positional arguments:
data object is then mapped field-by-field onto IScreenDto and persisted to screen-items: