Skip to main content
The Horizon CLI gives you full access to the trading engine, market discovery, wallet analytics, and fund management from your terminal. Every command supports --json for pipeable output.

Installation

pip install horizon-sdk
After installation, the horizon command is available on your PATH:
horizon --help
Or run without installing using uvx or bunx:
uvx horizon-sdk top-markets --json | jq '.[0]'
bunx horizon-sdk top-markets --json | jq '.[0]'

Quick Start

# Search for markets
horizon discover "bitcoin"

# See the hottest markets
horizon top-markets --limit 5

# Size a position with Kelly
horizon kelly --prob 0.65 --price 0.50 --bankroll 1000

# Check a wallet's P&L
horizon wallet value 0x1234...abcd

# Run a strategy
horizon run my_strategy.py --mode paper --dashboard

Configuration

The CLI reads configuration from environment variables:
export HORIZON_API_KEY="your-key"
export HORIZON_EXCHANGE="paper"          # paper, polymarket, kalshi
export HORIZON_DB="./horizon.db"         # persistence database path

# For Polymarket live trading
export POLYMARKET_API_KEY="..."
export POLYMARKET_API_SECRET="..."
export POLYMARKET_API_PASSPHRASE="..."
export POLYMARKET_PRIVATE_KEY="..."

# For Kalshi live trading
export KALSHI_API_KEY="..."

Global Options

FlagDescription
--jsonOutput as JSON (pipeable to jq, scripts)
--versionShow version
--helpShow help
# Human-readable output
horizon discover "election"

# JSON output for scripting
horizon discover "election" --json | jq '.[].slug'

Commands

Discovery

horizon discover [QUERY] [OPTIONS]
OptionDefaultDescription
--exchangepolymarketExchange to search
--limit10Number of results
--typeallall, binary, or multi
--category-Category filter (crypto, politics)
horizon discover "election" --limit 5
horizon discover "bitcoin" --exchange kalshi
horizon discover --type binary --category crypto --json
horizon events [QUERY] [OPTIONS]
OptionDefaultDescription
--limit10Number of events
horizon events "super bowl" --limit 5
horizon top-markets [OPTIONS]
OptionDefaultDescription
--exchangepolymarketExchange
--limit10Number of markets
--category-Category filter
horizon top-markets --limit 20
horizon top-markets --exchange kalshi --json
horizon market SLUG [OPTIONS]
OptionDefaultDescription
--exchangepolymarketExchange
horizon market "will-trump-win-2024"
horizon market "KXBTC-25MAR14" --exchange kalshi --json

Trading

horizon submit [OPTIONS]
OptionRequiredDefaultDescription
--market-idYes-Market identifier
--sideYes-buy or sell
--priceYes-Limit price (0-1)
--sizeYes-Order size
--market-sideNoyesyes or no
horizon submit --market-id will-btc-hit-100k --side buy --price 0.55 --size 10
horizon submit --market-id will-btc-hit-100k --side sell --market-side no --price 0.45 --size 5
horizon cancel ORDER_ID
horizon cancel-all
horizon positions
horizon orders --market-id will-btc-hit-100k
horizon fills --limit 50
horizon kill-switch on --reason "volatility spike"
horizon kill-switch off
horizon status
horizon status --json
Shows PnL, open orders, active positions, kill switch state, and uptime.

Analytics

horizon kelly [OPTIONS]
OptionRequiredDefaultDescription
--probYes-True probability (0-1)
--priceYes-Market price (0-1)
--bankrollNo1000Capital in USD
--fractionNo0.25Kelly fraction
--max-sizeNo100Max position
horizon kelly --prob 0.65 --price 0.50 --bankroll 5000
horizon kelly --prob 0.8 --price 0.60 --fraction 0.5 --json
horizon parity MARKET_ID [--feed FEED_NAME]
Checks if YES + NO prices sum to ~1.0.
horizon parity "will-btc-hit-100k"
horizon simulate [OPTIONS]
OptionDefaultDescription
--scenarios10000Number of paths
--seed-Random seed
horizon simulate --scenarios 50000 --json

Wallet Analytics

All wallet commands are under the wallet subgroup:
horizon wallet COMMAND [ARGS]
horizon wallet trades ADDRESS [--limit N] [--condition-id ID]
horizon wallet trades 0x1234...abcd --limit 20
horizon wallet trades 0x1234...abcd --json | jq '[.[] | .usdc_size] | add'
horizon wallet positions ADDRESS
horizon wallet value ADDRESS
horizon wallet profile ADDRESS
horizon wallet score ADDRESS [--limit N]
horizon wallet top-holders CONDITION_ID [--limit N]
horizon wallet flow CONDITION_ID [--window HOURS] [--min-size USD]
horizon wallet market-trades CONDITION_ID [--limit N]

Feed Management

All feed commands are under the feed subgroup:
horizon feed COMMAND [ARGS]
horizon feed list
horizon feed list --json
horizon feed snapshot FEED_NAME
horizon feed health [--threshold SECONDS]
horizon feed metrics FEED_NAME
horizon feed start NAME TYPE [OPTIONS]
OptionDescription
--symbolSymbol for Binance feeds
--urlURL for REST feeds
--configJSON config string
--intervalPoll interval (seconds)
horizon feed start btc-price binance_ws --symbol btcusdt
horizon feed start nba-scores espn --config '{"sport":"basketball","league":"nba"}'

Fund Management

All fund commands are under the fund subgroup:
horizon fund COMMAND [ARGS]
horizon fund status
horizon fund report --json
horizon fund deploy --name my-mm --markets will-btc-hit-100k --mode paper
horizon fund stop my-mm
horizon fund pause my-mm
horizon fund resume my-mm
horizon fund list
horizon fund scale my-mm --capital 10000
horizon fund nav --limit 30
horizon fund risk
horizon fund pnl
horizon fund stress-test
horizon fund explain
horizon fund regime
horizon fund alerts --limit 10

Account

horizon setup user@example.com --name "My Bot"
horizon login user@example.com
horizon key-status

Database Queries

For offline analysis of persisted strategy data, use the db subgroup:
horizon db COMMAND [OPTIONS]
horizon db fills [--path DB] [--limit N] [--market ID]
horizon db fills --path ./my_strategy.db --limit 20
horizon db fills --market will-btc-hit-100k
horizon db positions [--path DB]
horizon db orders [--path DB] [--limit N] [--open-only/--all]

Scripting with —json

Every command supports --json for structured output. Pipe to jq for powerful scripting:
# Get the slug of the top market
horizon top-markets --limit 1 --json | jq -r '.[0].slug'

# Sum a wallet's total PnL
horizon wallet positions 0x1234...abcd --json | jq '[.[].pnl] | add'

# Find markets with edge > 5%
horizon discover "crypto" --json | jq '[.[] | select(.yes_price < 0.45)]'

# Kelly size across multiple scenarios
for prob in 0.55 0.60 0.65 0.70; do
  echo "prob=$prob: $(horizon kelly --prob $prob --price 0.50 --json | jq .optimal_size)"
done

Architecture

The CLI shares the same tool layer as the MCP servers. All three interfaces delegate to horizon.tools, which wraps the Rust engine via PyO3:
horizon.tools (shared business logic)
    |
    +---> horizon.cli        (Click CLI, for humans)
    +---> horizon.mcp_server (MCP server, for AI agents)
    +---> horizon.mcp_fund   (MCP fund server, for AI agents)
This means the CLI has feature parity with the MCP interface. Same functions, same data, different transport.