> ## Documentation Index
> Fetch the complete documentation index at: https://mathematicalcompany.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Overview

> Infrastructure that lets an LLM operate a trading fund end-to-end. Prediction markets, equities, options, crypto.

The autonomous execution layer sits between the LLM and Horizon's trading tools. It adds fund management, risk controls, persistent memory, and decision governance on top of the existing 180+ MCP tools. Works across all asset classes: prediction markets, equities, options, and crypto.

<Note>
  **Ultra Feature.** Requires an Ultra subscription. [Get started at api.mathematicalcompany.com](https://api.mathematicalcompany.com)
</Note>

## Why Not Just MCP + LLM?

An LLM with raw MCP access can submit orders, check positions, discover markets, and run backtests across prediction markets, stocks, and crypto. That covers individual actions. What it does not cover is running a fund.

| Capability                            | Raw MCP | Autonomous Layer                                |
| ------------------------------------- | ------- | ----------------------------------------------- |
| Submit individual orders              | Yes     | Strategies handle it                            |
| Track fund NAV over time              | No      | Continuous, persisted                           |
| Prevent runaway deploy loops          | No      | Rate limits, confidence gates                   |
| Remember what failed last month       | No      | SQLite memory, cross-session                    |
| Pause correlated strategies           | No      | Correlation alerts with configurable thresholds |
| Auto-tune spread width from fill data | No      | Adaptive execution loop                         |
| Human-in-the-loop for risky actions   | No      | Supervised mode, approve/reject                 |
| Tamper-evident audit trail            | No      | SHA-256 hash-chained decisions                  |
| Detect and block LLM overfitting      | No      | BiasGuard (5 bias types)                        |

The core difference: raw MCP only acts when the LLM is prompted. The autonomous layer runs a background oversight loop that computes NAV, checks drawdowns, monitors correlations, detects settlements, accrues fees, and tunes execution parameters while the LLM is idle.

The LLM proposes actions with reasoning and a confidence score. The Decision Framework evaluates each proposal against confidence thresholds, rate limits, and the current operating mode. It can execute, escalate to a human, or reject. The LLM cannot override a rejection.

## Isolated MCP Servers

Fund tools are isolated from trading tools. You can wire them as separate MCP servers so the LLM cannot accidentally call `submit_order` when it should be calling `deploy_strategy`.

<CodeGroup>
  ```json Trading Only theme={null}
  {
    "mcpServers": {
      "horizon": {
        "command": "python",
        "args": ["-m", "horizon.mcp"]
      }
    }
  }
  ```

  ```json Fund Only theme={null}
  {
    "mcpServers": {
      "horizon-fund": {
        "command": "python",
        "args": ["-m", "horizon.mcp_fund"],
        "env": {
          "HORIZON_FUND_MODE": "1",
          "HORIZON_FUND_CAPITAL": "100000"
        }
      }
    }
  }
  ```

  ```json Both theme={null}
  {
    "mcpServers": {
      "horizon": {
        "command": "python",
        "args": ["-m", "horizon.mcp"]
      },
      "horizon-fund": {
        "command": "python",
        "args": ["-m", "horizon.mcp_fund"],
        "env": {
          "HORIZON_FUND_MODE": "1",
          "HORIZON_FUND_CAPITAL": "100000"
        }
      }
    }
  }
  ```
</CodeGroup>

Even in the shared MCP server, fund tools are gated behind `HORIZON_FUND_MODE=1`. If it is not set, they return an error instead of executing.

### The Fund Uses Everything

The separate MCP server controls what the LLM can call directly. Under the hood, the fund orchestrates all of Horizon's capabilities:

* Each strategy gets its own Engine with the 8-point risk pipeline, order management, and exchange connectivity.
* Market universe refresh uses `discover_markets()` to find and score opportunities.
* Autopilot runs `backtest()` and `robustness_test()` before deploying any strategy.
* Every strategy gets a `RiskConfig` scaled to its capital allocation.
* Strategies use any of the 17 feed types for real-time data.
* Orders route through any of the 7 exchanges. Smart routing picks the best venue.

## Architecture

| Layer                  | Components                                                              | Purpose                                                                                                 |
| ---------------------- | ----------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| Fund Infrastructure    | NAVEngine, CapitalAllocator, FundAccounting, FundLedger                 | Track value, allocate capital, compute fees, double-entry accounting                                    |
| Strategy Lifecycle     | StrategyController, PromotionManager, RecoveryManager                   | Deploy, stop, pause, resume strategies; paper-to-live promotion; self-healing                           |
| Market Intelligence    | MarketUniverse, MarketScorer, SettlementMonitor                         | Discover, score, and track markets; detect resolutions                                                  |
| Decision Loop          | ResearchPipeline, Autopilot, StrategyMemory, BacktestRunner             | Scan, backtest, deploy, learn from outcomes; built-in backtester                                        |
| Risk Budgeting         | FundRiskMonitor, VaRBudgetManager, CorrelationMonitor, FundStressTester | Fund drawdown limits, VaR allocation, correlation alerts, stress scenarios                              |
| Execution Intelligence | ExecutionQualityTracker, AdaptiveExecutionTuner, SmartRouter            | Track fill quality, auto-tune parameters, route to best exchange                                        |
| Bias Prevention        | BiasGuard                                                               | Block backtest overfitting, recency bias, confirmation bias, performance chasing, small-sample learning |
| Agent Interface        | AutonomousAgent, DecisionFramework, Explainer, AlertManager             | LLM-facing API with guardrails, rich explanations, notifications                                        |
| Self-Tuning            | ThresholdTuner, AdaptiveThresholds                                      | Learn from decision outcomes, auto-adjust confidence gates                                              |
| Multi-Fund             | FundCluster                                                             | Run multiple funds, aggregate views, cross-fund rebalancing                                             |

### Operating Modes

* **Dry-run**: The LLM proposes actions. A human approves or rejects each one before execution.
* **Supervised**: Low-risk actions (paper deploys, research scans) execute automatically. High-risk actions (live deploys, kill switch, scale-up, strategy retirement) escalate for human approval.
* **Autonomous**: All actions execute within guardrails. Rate limits, confidence thresholds, and bias checks still apply.

### Bias Prevention

BiasGuard screens every deploy and scale-up decision for 5 types of LLM overfitting:

1. **Backtest overfitting**: Blocks when probability of overfitting (PBO) exceeds 50%, deflated Sharpe is below 1.0, or out-of-sample Sharpe drops below 0.5.
2. **Recency bias**: Decays memory confidence exponentially with a 90-day half-life. Old memories carry less weight automatically.
3. **Confirmation bias**: Blocks deploying more than 3 strategies of the same type within a 24-hour window.
4. **Performance chasing**: Blocks scale-up on strategies younger than 14 days or with 3-day returns above 10% (likely mean-reverting).
5. **Small-sample learning**: Caps confidence proportionally when observations are below the minimum threshold (30 trades for strategy conclusions, 5 for general patterns).

## What's Built

Every component listed above is implemented, tested, and wired into the FundManager oversight loop:

* 180+ MCP tools (trading + 32 fund management)
* 36 fund subsystems integrated into a single orchestrator
* 3 operating modes with decision governance
* Confidence thresholds, rate limits, hash-chained audit trail
* Self-tuning confidence thresholds that learn from decision outcomes
* Persistent memory in SQLite, queryable by category, with confidence decay
* 6 stress scenarios (10/20% drawdown, correlation spike, liquidity crisis, exchange outage, black swan)
* Background oversight loop (NAV, risk, correlation, VaR, settlement, fees, adaptive tuning)
* Fund MCP server isolated from raw trading tools
* BiasGuard wired into Autopilot, Agent, and Memory
* Quant flow: regime detection, 7-factor alpha model, hypothesis lifecycle, signal ensemble, portfolio optimizer, risk analytics, performance attribution, execution intelligence, alpha decay tracking
* [Fund operations](autonomous/fund-operations): alerts with webhook delivery, double-entry ledger, paper-to-live promotion, self-healing recovery
* [Explainability](autonomous/explainability): rich structured responses for MCP tools, adaptive thresholds, built-in backtester
* [Multi-fund orchestration](autonomous/multi-fund): run multiple funds as a cluster with aggregate views and cross-fund rebalancing

For a complete step-by-step walkthrough of setting up and running a fund, see the [Full Tutorial](autonomous/tutorial).
