Ultra Feature. Requires an Ultra subscription. Get started at api.mathematicalcompany.com
The Idea
Instead of writing strategies by hand, you launch agents and let them do the work. Each agent:- Scans its assigned universe for mispriced markets
- Forms hypotheses (“Market X is mispriced because Y”)
- Constructs a pipeline from composable building blocks
- Backtests with robustness checks (BiasGuard blocks overfitting)
- Deploys in paper, auto-promotes to shadow, then live
- Trades on live exchanges (submit, cancel, amend)
- Monitors P&L, drawdown, alpha decay, execution quality
- Retires dead strategies, frees capital, loops back to step 1
FundCluster sits above all agents, aggregating NAV, enforcing cross-agent risk limits, and rebalancing capital.
Architecture
FundCluster
Central coordinator. Aggregates NAV across all agents, monitors cross-fund risk, rebalances capital, and routes alerts.
Per-Agent FundManager
Each agent is a full FundManager with all 36 subsystems: research, alpha model, hypothesis lifecycle, backtest, bias guard, promotion, execution, decay tracking, adaptive thresholds, recovery.
Agent Domains
Crypto
Polymarket + Coinbase feeds. BTC, ETH, SOL prediction markets.
Politics
Polymarket + Kalshi. Election and policy event markets.
Sports
Kalshi. Game outcomes, championships, season props.
Macro/Rates
Kalshi + IBKR ForecastEx. Fed rates, CPI, treasury yields.
Cross-Exchange
Polymarket + Kalshi. Same-market arbitrage across venues.
Tail Risk
Polymarket. Low-probability, high-payoff event bets.
High Frequency
Polymarket. Short-lived mispricings, fast rebalance cycle (15s).
Step 1: Define Pipeline Building Blocks
Instead of hardcoding strategies, define composable building blocks that agents can assemble into pipelines. Each block is a standard pipeline function.Step 2: Create an Agent Factory
Each agent is aFundManager configured for a specific domain. The factory creates agents with all autonomous features enabled.
Step 3: Launch the Swarm
Create specialized agents for different market domains and wire them into a central cluster.What Each Agent Does Autonomously
Aftercluster.start_all(), each agent runs this loop on every rebalance cycle:
| Tick | What Happens | Module |
|---|---|---|
| Every 60s | Compute NAV, check kill switch | NAVEngine, FundRiskMonitor |
| Every 60s | Update regime (calm/volatile/crisis) | RegimeDetector (3-state HMM) |
| Every 60s | Monitor VPIN toxicity per market | ExecutionIntelligence |
| Every 60s | Detect settlements, book P&L | SettlementMonitor |
| Every 60s | Accrue fees, update correlations | FundAccounting, CorrelationMonitor |
| Every 60s | Record fill quality, adapt execution | ExecutionQualityTracker |
| Every 60s | Consume research triggers | ResearchIntelligence |
| Every 5 ticks | Compute portfolio Greeks | RiskAnalytics |
| Every 5 ticks | Rebalance capital across strategies | CapitalAllocator |
| Every 5 ticks | Optimize portfolio (Kelly + Ledoit-Wolf) | PortfolioOptimizer |
| Every 60 ticks | Check alpha decay, emit alerts | AlphaDecayTracker |
| Every 60 ticks | Update VaR budgets | VaRBudgetManager |
| Every 60 ticks | Snapshot attribution (alpha/beta) | PerformanceAttribution |
| Every 120 ticks | Tune confidence thresholds from outcomes | ThresholdTuner |
Research to Deploy Cycle
Each agent’sResearchIntelligence watches for 6 trigger types:
- Regime change: HMM detects shift from calm to volatile
- Cross-market divergence: two correlated markets diverge >5%
- Volume spike: 2x+ median volume
- New market: fresh market appears on exchange
- Edge refresh: edge increases on existing market
- Settlement cascade: resolution frees capital for new positions
Deployment Gates (all must pass)
| Gate | Threshold | Purpose |
|---|---|---|
| Sharpe ratio | >= 1.0 | Minimum risk-adjusted return |
| Trades | >= 30 | Statistical significance |
| P-value | < 0.05 | Not due to luck (Benjamini-Hochberg corrected) |
| Walk-forward | > 60% OOS windows positive | Not overfit |
| PBO | < 50% | Probability of backtest overfitting |
| BiasGuard | All 5 checks pass | No recency/confirmation/chasing bias |
Step 4: LLM Control via MCP
Expose each agent as an MCP server so an LLM can check status, intervene, and rebalance.One MCP Server Per Agent
What the LLM Can Do
The LLM gets 32 fund tools per agent. Example interactions:| LLM Command | Tools Called | Effect |
|---|---|---|
| ”What’s the swarm doing?” | fund_status on each agent | Aggregate health check |
| ”Why is crypto_hunter losing money?” | fund_explain_strategy, fund_decay_report | Root cause analysis |
| ”Shift 10% from sports to politics” | allocate_capital on both | Cross-agent rebalance |
| ”Kill all tail risk positions” | stop_strategy on tail_risk agent | Emergency shutdown |
| ”Show me all hypotheses across agents” | fund_hypotheses on each | Research overview |
| ”What regime are we in?” | fund_regime on each | Market condition check |
| ”Stress test the whole swarm” | stress_test_fund on each | Portfolio resilience |
Step 5: Scaling the Swarm
Add More Agents Dynamically
Remove Underperforming Agents
Per-Agent Explainability
Query any agent for explanations:Operating Modes
Control how much autonomy each agent gets:| Mode | Paper Deploy | Live Deploy | Kill Switch | Scale Up |
|---|---|---|---|---|
| Dry-run | Human approves | Human approves | Human approves | Human approves |
| Supervised | Auto | Human approves | Human approves | Human approves |
| Autonomous | Auto | Auto (after gates) | Auto | Auto (after gates) |
- Rate limits (max 3 deploys/hour, max 10 capital changes/day)
- Confidence thresholds (0.5 for paper, 0.7 for live, 0.8 for scale-up)
- BiasGuard (5 overfitting checks)
- Promotion gates (14 days paper, 7 days shadow)
- Fund drawdown kill switch
- SHA-256 hash-chained audit trail on every decision
Summary
Runningpython quant_swarm.py gives you:
- 7 agents each running the full research-to-retirement loop
- Central cluster with aggregate NAV, risk, and rebalancing
- Cross-agent correlation monitoring: the cluster flags correlated bets across agents
- Persistent memory: each agent remembers outcomes across restarts (SQLite)
- Recovery: if a strategy crashes, RecoveryManager restarts it with a circuit breaker
- Adaptive execution: each agent tunes spreads, sizes, and timing from fill quality data
- Alpha decay tracking: agents retire strategies when edge erodes
- Audit trail: every decision logged with reasoning, confidence, and outcome
- MCP interface: an LLM can observe and steer the swarm via 32 tools per agent