Margin Trading

Margin commands execute DeepBook margin trades through typed margin manager objects. A margin manager is pair-specific: a manager for DEEP_USDC is not valid for DEEP_SUI.

Margin Managers & Deposits

Discover margin pools and compatible managers:

Code
deepbook margin pools deepbook margin pools --registered deepbook margin managers

Deposit collateral or a fee asset:

Code
deepbook margin deposit DEEP_USDC --coin QUOTE --amount 100 --dry-run deepbook margin deposit DEEP_USDC --coin QUOTE --amount 100

Placing Orders

Place margin market and limit orders using the configured --leverage:

Code
# Market orders deepbook margin market DEEP_USDC --side buy --quantity 10 --leverage 2 --dry-run deepbook margin market DEEP_USDC --side buy --quantity 10 --leverage 2 # Limit orders deepbook margin limit DEEP_USDC --side sell --price 0.20 --quantity 10 --leverage 2 --dry-run deepbook margin limit DEEP_USDC --side sell --price 0.20 --quantity 10 --leverage 2

Position Management

Inspect and close positions:

Code
deepbook margin position DEEP_USDC deepbook margin close DEEP_USDC --full --dry-run deepbook margin close DEEP_USDC --full --withdraw

Margin Safety Defaults

  • Auto-selection: If --margin-manager is omitted, the CLI auto-selects a compatible manager or creates one in the transaction when supported.
  • Specific Manager: If --margin-manager is provided, it must match the signer and the pool pair.
  • Dry Runs: Use --dry-run before broadcasting.
  • Reduce Only: Use --reduce-only when you want close orders to reduce exposure only.
  • Fees: Use --no-pay-with-deep if you do not want fees paid with DEEP.