Skip to main content

The LLM Boundary

QuantContext enforces a strict boundary between what LLMs do and what code does:

Why Determinism Matters for Trading

LLMs hallucinate numbers. QuantContext ensures every number returned to an agent is:
  1. Computed from actual market data:not generated, estimated, or hallucinated
  2. Deterministic:same inputs produce identical outputs, always
  3. Auditable:the computation path is pure Python with no randomness

How the Tools Work

Pipeline stages map to skill functions from SKILL_REGISTRY. Each skill receives a pandas DataFrame and returns a filtered/ranked DataFrame. Stages execute sequentially.
Rebalance-loop engine. On each rebalance date: re-run pipeline, compute target weights, execute trades. Between rebalances: daily P&L tracking and risk controls.
Manual OLS via numpy. No statsmodels dependency. Decomposes excess returns into four systematic factors.

Data Sources and Caching

First call: Downloads market data (~10s for S&P 500). Subsequent calls use the cache. Performance: Screening under 1s, backtesting 3–8s. Total disk usage: ~50MB for full S&P 500 coverage.

Transport

QuantContext uses the MCP stdio transport. The server reads JSON-RPC messages from stdin and writes responses to stdout.
For development and testing, you can call the tools directly in Python: