Skip to main content

Crate bot_cli

Crate bot_cli 

Source
Expand description

§Hyperliquid Trading Bot

Command-line runner for Supurr Hyperliquid trading bots.

This package installs the bot binary and exposes configuration schema types for tooling. The trading runtime is provided by bot-engine; this crate wires config, exchange setup, simulation mode, strategy creation, and process shutdown into one executable.

§Install

cargo install hyperliquid-trading-bot

Run:

bot --help

§What It Runs

ModeQuotesFillsUse case
liveHyperliquid live pricesReal exchange ordersProduction trading
paperHyperliquid live pricesLocal simulated fillsRisk-free live-market testing
backtest via --pricesHistorical JSON pricesLocal simulated fillsStrategy replay
--dry-runnonenoneConfig validation
bot --config config.json --dry-run
bot --config config.json --mode paper
bot --config config.json
bot --config config.json --prices prices.json

§Minimal Perp Grid Config

{
  "environment": "testnet",
  "private_key": "0x...",
  "address": "0x...",
  "strategy_type": "grid",
  "markets": [
    {
      "exchange": "hyperliquid",
      "type": "perp",
      "base": "BTC",
      "quote": "USDC",
      "index": 0
    }
  ],
  "grid": {
    "mode": "neutral",
    "start_price": "88000",
    "end_price": "92000",
    "levels": 5,
    "order_size": "0.001",
    "max_investment_quote": "1000"
  }
}

§Strategy Types

strategy_typeConfig sectionCrate
gridgridstrategy-grid
mm or market_makermmstrategy-market-maker
dcadcastrategy-dca
arbitrage or arbarbitragestrategy-arbitrage
orchestratororchestratorbot-orchestrator

§Market Types

Market typeRequired fieldsNotes
perpexchange, type, base, indexNative Hyperliquid perpetuals
spotexchange, type, base, quote, indexSpot-style balances and fills
hip3exchange, type, base, dex, indexHIP-3 sub-DEX markets
outcomeexchange, type, name, outcome_id, sidePrediction markets from outcomeMeta

For HIP-4/outcome markets, query Hyperliquid outcomeMeta; do not infer availability from meta, metaAndAssetCtxs, or perpDexs.

§Credentials

Configs may include private_key and address. If either is omitted, the runner attempts to resolve credentials from the local Supurr credential store.

Private keys should be API-wallet keys, not primary wallet keys. Use --dry-run before live mode.

§Generated Schema

The package also installs a schema binary:

schema
schema --copy

schema prints the JSON schema for the CLI config. schema --copy writes it into the local repository schema locations when those paths exist.

§Runtime Pipeline

config.json
  -> bot CLI parses and validates config
  -> exchange adapter is created
  -> strategy is built from strategy_type
  -> bot-engine runner polls quotes/fills
  -> strategy emits commands
  -> exchange adapter places/cancels orders
  -> optional trade/account sync reports state upstream

§Crate Map

CrateRole
hyperliquid-trading-botInstallable CLI package; provides bot and schema binaries
bot-engineRuntime loop, order manager, inventory, simulation, syncers, strategy builder
bot-coreShared domain types, commands, events, exchange and strategy traits
exchange-hyperliquidHyperliquid HTTP adapter and signing
strategy cratesGrid, DCA, market maker, arbitrage, RSI, tick trader

§Panic Conditions

The CLI is intended to return errors for invalid config, missing credentials, exchange setup failure, and runtime failures.

Known direct exits:

  • bot --help prints help and exits with status 0.
  • malformed or incomplete command-line options are ignored by the current parser unless they make later config loading fail.

§Safety Notes

Live mode places real orders. Validate with --dry-run, then --mode paper, before using live mode.

Package contents are limited to Cargo metadata, this README, and Rust source files. Local .env files, deployment scripts, generated configs, and shell scripts are not included in the crates.io package.

Re-exports§

pub use config::BotConfig;

Modules§

config
Bot CLI configuration types - V2 format.