OpenClaw Plugin

OpenBroker ships as an OpenClaw plugin. When installed, it registers structured agent tools and a background position watcher — the agent gets typed tool calls instead of raw Bash, and automatic alerts when positions move.

Install

Terminal
# From npm
openclaw plugins install openbroker
 
# Or link a local checkout (development)
openclaw plugins install -l ./open-broker-mvp

After installation, run openbroker setup to configure your wallet — the same onboarding flow as the standalone CLI.

Plugin Tools

The plugin registers 27 agent tools that call the Hyperliquid API directly through the core client. All trading tools support a dry parameter to preview before executing.

CategoryToolDescription
Infoob_accountAccount balance, equity, margin, open orders
Infoob_positionsOpen positions with PnL, leverage, liquidation
Infoob_fillsTrade fill history with fees and realized PnL
Infoob_ordersOrder history (filled, canceled, open, etc.)
Infoob_order_statusCheck status of a specific order by ID
Infoob_feesFee schedule, tier, maker/taker rates, volume
Infoob_fundingFunding rates sorted by annualized rate
Infoob_funding_historyHistorical funding rates for an asset
Infoob_candlesOHLCV candle data for an asset
Infoob_tradesRecent trades (tape) for an asset
Infoob_marketsMarket data (price, volume, open interest)
Infoob_searchSearch assets across perps, HIP-3, spot
Infoob_spotSpot markets and token balances
Infoob_rate_limitAPI rate limit usage and capacity
Infoob_funding_scanCross-dex funding scanner with pair detection
Tradingob_buyMarket buy with slippage protection
Tradingob_sellMarket sell with slippage protection
Tradingob_limitLimit order (GTC, IOC, or ALO)
Tradingob_triggerTrigger order (take profit / stop loss)
Tradingob_tpslSet TP/SL on existing position
Tradingob_cancelCancel orders (by coin, ID, or all)
Advancedob_twapNative TWAP order (exchange-managed)
Advancedob_twap_cancelCancel a running TWAP order
Advancedob_twap_statusView TWAP order history and status
Advancedob_bracketEntry + TP + SL in one command
Advancedob_chaseChase price with ALO orders
Monitorob_watcher_statusBackground watcher state and positions
Autoob_auto_runStart a trading automation script
Autoob_auto_stopStop a running automation by ID
Autoob_auto_listList available and running automations

Background Position Watcher

The plugin runs a background service that polls your Hyperliquid account and sends webhook notifications to your OpenClaw agent when something changes:

  • Position opened — new position detected
  • Position closed — position no longer present
  • Size changed — position increased or decreased
  • PnL threshold — unrealized PnL changed by more than the configured % (default: 5%)
  • Margin warning — margin usage exceeds threshold (default: 80%)

Use ob_watcher_status to check the watcher state, tracked positions, and how many events have been detected.

Plugin Configuration

Configure the plugin in your OpenClaw settings under plugins.entries.openbroker.config. All fields are optional — the plugin falls back to ~/.openbroker/.env and environment variables.

openclaw.yaml — plugin config
plugins:
  entries:
    openbroker:
      enabled: true
      config:
        privateKey: "0x..."           # Falls back to HYPERLIQUID_PRIVATE_KEY
        accountAddress: "0x..."       # For API wallets
        network: "mainnet"            # mainnet or testnet
        hooksToken: "your-secret"     # Must match hooks.token below
        watcher:
          enabled: true
          pollIntervalMs: 30000       # Poll every 30s
          pnlChangeThresholdPct: 5    # Alert on 5%+ PnL change
          marginUsageWarningPct: 80   # Warn at 80% margin usage
          notifyOnPositionChange: true
          notifyOnFunding: true
FlagDescriptionDefault
privateKeyHyperliquid wallet private key (0x-prefixed). Falls back to HYPERLIQUID_PRIVATE_KEY env var or ~/.openbroker/.env
accountAddressMaster account address (for API wallets). Falls back to HYPERLIQUID_ACCOUNT_ADDRESS
networkmainnet or testnetmainnet
hooksTokenBearer token for gateway hooks endpoint. Must match hooks.token in gateway config
watcher.enabledEnable or disable the background position watchertrue
watcher.pollIntervalMsHow often to poll the Hyperliquid API (ms)30000
watcher.pnlChangeThresholdPctMinimum PnL change (% of position value) to trigger an alert5
watcher.marginUsageWarningPctMargin usage % above which to send a warning80

Webhook Setup

For the position watcher to notify your agent, webhooks must be enabled in your OpenClaw gateway config:

openclaw.yaml — hooks
hooks:
  enabled: true
  token: "your-secret"   # Must match hooksToken in plugin config above

The watcher sends alerts to POST /hooks/agent with wakeMode: "now", which triggers an immediate agent turn. The agent receives a natural-language message like:

[OpenBroker Alert] Significant PnL movement on ETH: $500.00 → -$200.00 (14.0% of position value)
 
Details:
  coin: HYPE
  previousPnl: 500
  currentPnl: -200
  changePct: 14.0
  positionValue: 5000
 
Notify the user of this trading alert via their preferred channel.

The agent receives a structured alert with an explicit instruction to notify the user via their preferred channel (e.g., Slack, email, in-app notification). It can then decide to take action — adjust TP/SL, close the position, or simply forward the alert.

Plugin CLI Commands

The plugin also registers CLI commands accessible via the OpenClaw CLI:

Terminal
openclaw ob status    # Show watcher state and current positions
openclaw ob watch     # Run watcher in foreground (for debugging)