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 managersDeposit 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 100Placing 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 2Position 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 --withdrawMargin Safety Defaults
- Auto-selection: If
--margin-manageris omitted, the CLI auto-selects a compatible manager or creates one in the transaction when supported. - Specific Manager: If
--margin-manageris provided, it must match the signer and the pool pair. - Dry Runs: Use
--dry-runbefore broadcasting. - Reduce Only: Use
--reduce-onlywhen you want close orders to reduce exposure only. - Fees: Use
--no-pay-with-deepif you do not want fees paid with DEEP.