Skip to main content
The Strategy Lifecycle Controller lets an LLM deploy, monitor, scale, and retire strategies without human intervention — the core requirement for autonomous operation.

Strategy State Machine

Pending

Strategy created, thread not yet started.

Running

Actively trading in a background thread.

Paused

Thread alive but not quoting. Orders canceled.

Stopping

Graceful shutdown in progress.

Stopped

Thread finished, engine idle.

Failed

Thread crashed with an error.

Retired

Permanently stopped. Can be removed.
Transitions: Pending → Running → Paused → Running. Running → Stopping → Stopped → Retired. Running/Stopping → Failed.

Quick Start

from horizon.fund import FundManager, FundConfig, StrategyConfig

fund = FundManager(FundConfig(total_capital=100_000))

# Add strategies before starting
fund.add_strategy(StrategyConfig(
    name="political_mm",
    pipeline=[signal, quote],
    markets=["will-x-win"],
    mode="paper",
))

fund.start()

# Or deploy after start
fund.add_strategy(StrategyConfig(
    name="crypto_arb",
    pipeline=[detect, execute],
    markets=["btc-100k"],
))

Strategy Management

# Check status of a specific strategy
status = fund.controller.status("political_mm")
print(f"State: {status.state.value}")
print(f"P&L: ${status.pnl:,.2f}")
print(f"Open orders: {status.open_orders}")
print(f"Uptime: {status.uptime_secs:.0f}s")

# List all strategies
for s in fund.controller.all_statuses():
    print(f"  {s.name}: {s.state.value} pnl={s.pnl:.2f}")

# Pause (cancels orders, keeps engine alive)
fund.pause_strategy("political_mm")

# Resume
fund.resume_strategy("political_mm")

# Scale capital allocation
fund.scale_strategy("political_mm", new_capital=25_000)

# Retire permanently
fund.remove_strategy("political_mm")

Accessing Engines

Each strategy gets its own Engine instance running in a daemon thread.
# Get all engines
engines = fund.controller.engines
# {"political_mm": <Engine>, "crypto_arb": <Engine>}

# Direct engine access for debugging
engine = engines["political_mm"]
print(engine.status())
print(engine.positions())

Strategy Scaling

TriggerAction
Positive Sharpe after N days in stagingPromote to live with initial capital
Sustained profitabilityRamp up capital on schedule
Drawdown exceeds thresholdAuto-pause by risk monitor
No edge detected for N daysRetire strategy
LLM conviction changeAdjust capital proportionally

A/B Testing

Run two versions of a strategy simultaneously, each with a fraction of the allocated capital, and compare performance:
# A/B test: deploy two variants
fund.add_strategy(StrategyConfig(
    name="mm_wide_spread",
    pipeline=[signal, quote_wide],
    markets=["will-x-win"],
))
fund.add_strategy(StrategyConfig(
    name="mm_tight_spread",
    pipeline=[signal, quote_tight],
    markets=["will-x-win"],
))

# Compare after running
attr = fund.pnl_attribution()
wide_pnl = attr["mm_wide_spread"]["total"]
tight_pnl = attr["mm_tight_spread"]["total"]

Strategy Templates

Pre-built templates that the LLM can parameterize and deploy:
TemplatePipelineKey Parameters
Directionalsignal -> kelly_sizer -> submitsignal_source, kelly_fraction, max_position
Market Makerfair_value -> spread -> quotespread_width, size, inventory_limit
Arbitragedetect -> size -> executemin_edge, max_position, exchanges
Copy Tradingwallet_signal -> filter -> mirrortarget_wallets, min_confidence, delay
Event-Drivencatalyst -> position -> managecatalyst_type, sizing_method, exit_rule

Configuration

StrategyConfig(
    name="my_strategy",           # Unique name
    pipeline=[fn1, fn2, fn3],     # Pipeline functions
    markets=["market-slug"],      # Market IDs to trade
    exchange=Polymarket(...),     # Exchange (None for paper)
    feeds={"poly": PolymarketBook(...)},  # Data feeds
    risk=Risk().max_position(100),  # Risk config
    params={"custom_param": 42},  # Custom parameters
    mode="paper",                 # "paper" or "live"
    max_drawdown_pct=20.0,        # Strategy drawdown limit
)

MCP Tools

ToolDescription
deploy_strategyLaunch a strategy from template + parameters
stop_strategyGracefully stop a running strategy
list_strategiesAll strategies with health and P&L
promote_strategyMove from staging to live
scale_strategyAdjust capital allocation