Skip to content

bullpen hyperliquid close

Last updated: July 13, 2026

Close a position fully or partially (requires hyperliquid_trading feature)

Usage

bullpen hyperliquid close [OPTIONS] <COIN>

Live Help

Close a position fully or partially (requires hyperliquid_trading feature)

Usage: bullpen hyperliquid close [OPTIONS] <COIN>

Arguments:
  <COIN>
          Coin/market (e.g. "ETH", "BTC")

Options:
      --dex <DEX>
          HIP-3 perpetual DEX id (for example, `xyz` for TradeXYZ). If COIN is prefixed as `dex:symbol`, the prefix infers this value

      --no-multi-wallet-warning
          Suppress the table-mode warning shown when multiple EVM wallet accounts exist

      --output <OUTPUT>
          Output format for command results

          [possible values: table, json]

      --env <ENV>
          Target environment to connect to (overrides config.toml)

          [env: BULLPEN_ENV=]
          [possible values: staging, production]

      --size <SIZE>
          Legacy size flag. Defaults to USD notional for close; pair with --size-unit base to interpret as base-token size. Omit for a full close

      --config <CONFIG>
          Path to a custom config.toml file (overrides $BULLPEN_CONFIG and the default location).

          Explicit --config and BULLPEN_CONFIG paths fail closed: if the file is missing, the CLI exits validation instead of silently loading defaults. Credentials still resolve via BULLPEN_HOME, so set BULLPEN_HOME too when isolating a session.

      --size-unit <SIZE_UNIT>
          Explicit unit for legacy --size. Valid only with --size

          Possible values:
          - usd:  Interpret --size as USD notional
          - base: Interpret --size as base-token size

      --notional <NOTIONAL>
          USD notional to close (NOT base-token units). Omit for a full close

      --base-size <BASE_SIZE>
          Base-token size to close. Omit for a full close

      --limit <LIMIT>
          Submit a reduce-only limit close instead of a market-style close

      --read-only
          Enable read-only mode: blocks all mutating commands

      --tif <TIF>
          Time-in-force for limit close orders. `alo` is post-only. Requires --limit

          Possible values:
          - gtc: Good-till-cancelled: rests on the book until explicitly cancelled
          - ioc: Immediate-or-cancel: fills what it can immediately and cancels the rest
          - alo: Add-liquidity-only: post-only, rejects if it would cross the spread

      --non-interactive
          Suppress interactive prompts; does NOT imply --yes for money-moving commands

          [env: BULLPEN_NON_INTERACTIVE=]

      --slippage <SLIPPAGE>
          Override the configured market-style close slippage tolerance, in percent (0 < pct <= 50)

      --builder-address <BUILDER_ADDRESS>
          Debug-only builder attribution override. Requires --builder-fee-bps and BULLPEN_HYPERLIQUID_ALLOW_BUILDER_OVERRIDE=1

      --builder-fee-bps <BUILDER_FEE_BPS>
          Debug-only builder fee cap override in basis points. Requires --builder-address and BULLPEN_HYPERLIQUID_ALLOW_BUILDER_OVERRIDE=1

      --subaccount <SUBACCOUNT>
          Target a Hyperliquid subaccount execution context. Without --subaccount or --vault, the command targets the active EVM master account. Scoped submits still sign with the active EVM master wallet. Mutually exclusive with --vault

      --vault <VAULT>
          Target a Hyperliquid vault execution context. Without --subaccount or --vault, the command targets the active EVM master account. Scoped submits still sign with the active EVM master wallet. Mutually exclusive with --subaccount

  -y, --yes
          Skip confirmation prompt

      --preview
          Show fill price, slippage, and fee estimates without submitting

  -h, --help
          Print help (see a summary with '-h')

EXAMPLES:
  # Review positions before closing
  bullpen hyperliquid status

  # Preview a partial BTC close without signing or submitting
  bullpen hyperliquid close BTC --notional 100 --preview

  # Export the close preview as JSON
  bullpen hyperliquid close BTC --notional 100 --preview --output json

  # Preview a TradeXYZ HIP-3 close; the xyz: prefix infers --dex xyz
  bullpen hyperliquid close xyz:SPCX --preview

SIZING:
  Prefer --notional for partial USD-notional closes or --base-size for
  base-token partial closes. Legacy --size remains supported as a USD-notional
  alias unless paired with --size-unit base. Omit size flags for a full close.

ACCOUNT SCOPE:
  Without --subaccount or --vault, this targets the active EVM master account.
  With --subaccount or --vault, Hyperliquid uses that execution context but
  Bullpen still signs with the active EVM master wallet. Normal Hyperliquid
  trades do not create, approve, or consume Hyperliquid API/agent wallet slots.

Example Commands

bullpen hyperliquid status
bullpen hyperliquid close BTC --notional 100 --preview
bullpen hyperliquid close BTC --notional 100 --preview --output json
bullpen hyperliquid close xyz:SPCX --preview

JSON Output

Contract: JSON Output Contract.

Successful output is a single JSON document. The shape below is representative for this command family; commands may add fields without breaking the shared contract.

Schema version: 1 when a command emits schema_version; otherwise treat the current command shape as contract version 1.

Top-level Keys

key type nullable notes
schema_version integer yes Mutation preview/report schema version when emitted
kind string yes hyperliquid_mutation_preview for preview JSON
action string no Hyperliquid action represented by the preview or live report
account string no Active Hyperliquid master account that signs live submits
scope string yes Human-readable account, subaccount, or vault execution context
scope_kind string yes Stable scope classification such as primary, subaccount, or vault when emitted
coin string yes Market symbol when the command targets a single market
perp_dex string yes HIP-3 DEX id when the command is DEX-scoped
instrument_id string yes Stable DEX-qualified instrument id when available
would_submit boolean yes False in preview output
signature_requested boolean yes False in preview output
exchange_request_submitted boolean yes False in preview output
summary string yes Human-readable preview/result summary
intent object yes Structured action intent echoed for previews and some live reports
limit_px string/decimal yes Effective live order limit price when emitted; stop-market entries use a slippage-padded trigger price
trigger_px string/decimal yes Trigger price for stop-entry or trigger-style commands
trigger_kind string yes Trigger direction such as entry-long or entry-short for stop-entry
submitted_count integer yes Live report count for submitted exchange actions; null/absent in previews
status_count integer yes Live report count for exchange statuses returned

Example

Example JSON output
bullpen hyperliquid close BTC --notional 100 --preview --output json
{
  "schema_version": 1,
  "kind": "hyperliquid_mutation_preview",
  "action": "close",
  "account": "0x1111111111111111111111111111111111111111",
  "scope": "primary 0x1111111111111111111111111111111111111111",
  "scope_kind": "primary",
  "coin": "BTC",
  "would_submit": false,
  "signature_requested": false,
  "exchange_request_submitted": false,
  "summary": "Preview only - no signature requested and no Hyperliquid exchange request submitted.",
  "intent": {
    "action": "close",
    "account": "0x1111111111111111111111111111111111111111",
    "coin": "BTC",
    "reduce_only": false,
    "builder_fee_bps": 0.0
  },
  "submitted_count": null,
  "status_count": null
}

Stability

Patch releases may add nullable or optional fields. Minor releases may add required fields or increment schema_version. Major releases may remove or rename fields.