Skip to main content
Use markets and trade for perpetuals, and spot for spot trading and market data. The two products use separate market lookups; list markets for the selected product and network before placing an order.

Account commands

Manage locally stored trading accounts.

account add

Interactively add a new trading account.
Prompts for subaccount address, account type (api-wallet or read-only), private key, alias, and default status. Keys are stored in ~/.decibel/data.db; they are only encrypted when a password is supplied, which this interactive flow does not currently prompt for.

account ls

List all stored accounts.

account set-default

Set the default account used when no --account flag is provided.
If alias is omitted, an interactive picker is shown.

account remove

Remove a stored account.

account info

Show account balances and equity.
Displays: subaccount address, account value, unrealized PnL, withdrawable balance, total margin, and maintenance margin.

Market commands

Query perpetual market data and prices. For spot, use spot markets ls, spot price, and spot book.

markets ls

List all available perpetual markets.
Displays: market name, max leverage, tick size, min size, and trading mode. tickSize is in price units; minSize and lotSize are in base-asset units, matching order inputs. JSON output also includes rawTickSize, rawMinSize, and rawLotSize as on-chain integers, plus sizeDecimals and priceDecimals. Do not pass the raw values as order sizes or prices.

markets price

Get the current price for a market.
Displays: mark price, oracle price, funding rate, and open interest.

markets book

View the order book for a market.
Displays: color-coded bid/ask levels with size and depth bars.

Trade commands

Place perpetual orders, manage positions, and view perpetual trading history.

Place orders

trade order limit

Place a limit order.

trade order market

Place a market order.

trade order stop-limit

Place a stop limit order. Triggers at the stop price and executes at the limit price.

trade order stop-market

Place a stop market order. Triggers at the stop price and executes immediately.

trade order twap

Place a TWAP (Time-Weighted Average Price) order. Splits the order into smaller sub-orders over a duration.
Values outside these bounds are rejected before the order is submitted.

Cancel orders

trade cancel

Cancel a specific open order.

trade cancel-all

Cancel all open orders.

trade cancel-twap

Cancel an active TWAP order.

Close positions

trade close

Close an open position at market price.

TP/SL (Take-Profit / Stop-Loss)

trade tp-sl set

Set take-profit and/or stop-loss for a position.

trade tp-sl ls

List active TP/SL orders for a position.

trade tp-sl cancel

Cancel a TP/SL order.

Configuration

trade set-leverage

Set leverage for a market.

trade set-margin

Set the margin type for a market.

View trading data

trade positions

List open positions.

trade orders

List open orders.

trade active-twaps

List active TWAP orders.

trade history

View trade fill history.

trade order-history

View order history (all states: filled, cancelled, etc.).

trade twap-history

View TWAP order history.

trade funding-history

View funding rate payment history.

Spot commands

Trade spot assets and query spot-only market and account data. Symbols are case-insensitive and must exist in spot markets ls on the selected network. Spot orders accept only buy and sell. Sizes are positive quantities of the base asset, and prices are positive amounts of the quote asset per base unit. For example, buy 10 APT/USDC 5.2 buys 10 APT at a limit of 5.20 USDC per APT. Use the market’s normalized minSize, lotSize, and tickSize to check order inputs. Spot commands do not support long/short, leverage, margin settings, position closing, reduce-only, stop orders, TP/SL, TWAP, or client order IDs.

Common spot options

Spot uses the same authentication and account configuration as perpetuals. Market data needs only a Node API key; account queries also need a subaccount address, and placement/cancellation require a signing account.

Place spot orders

spot order limit

Place a spot limit order.
Prices are aligned to the market tick down for buys and up for sells, so rounding never crosses your requested limit. A price that rounds to zero is rejected before submission.

spot order market

Submit an immediate-or-cancel (IOC) limit order at a slippage-adjusted price. Spot has no separate on-chain market order type.
The reference price comes from the midpoint of a two-sided order book, falling back to the asset-context midpoint and then the last trade. A one-sided book is not used as a reference. If no positive reference price is available, the command fails; use a limit order with an explicit price instead. The buy cap is referencePrice * (1 + slippage / 100); the sell floor is referencePrice * (1 - slippage / 100). The submitted price is then rounded down for buys or up for sells to the market tick. This preserves the slippage bound but can prevent a fill, particularly with zero slippage or a coarse tick. A zero submitted price is rejected. JSON output includes referencePrice and the actual tick-aligned limitPrice. A buy reserves size * limitPrice of the quote asset, not size * referencePrice. An IOC order fills immediately, partially fills and cancels the remainder, or cancels without filling; it never rests in spot orders.

Queued placement

Both placement commands can return pendingCbs: true when funding needs a rate-limited collateral withdrawal. The transaction succeeded, but the order is queued, not placed. The CLI prints QUEUED rather than reporting placement success. Neither a successful transaction nor a returned order ID proves the order filled.
Track the returned orderId with spot order-history for its final state and spot history for fills. GTC/post-only orders can also appear in spot orders once they rest. IOC orders never appear there, so an empty open-orders list does not establish their outcome.

Cancel spot orders

spot cancel

Cancel a spot order by ID and market, including an order still queued behind a collateral withdrawal.

spot cancel-all

Cancel open spot orders, optionally scoped to one market. Perpetual orders are not affected.
Cancellation pages through open orders and repeats from the start to reach orders beyond a single pagination window. JSON results report cancelled, failed, and total counts of distinct attempted orders; inspect all three instead of assuming every cancellation succeeded.
  • Incomplete: The sweep could not finish or confirm the remaining orders. The error includes the number already cancelled; re-run to continue.
  • Unreachable: With --market, other markets’ orders can fill the API pagination window and hide remaining matching orders. The error reports partial progress. Re-running the same filtered command cannot reach the hidden orders; cancel them individually by ID. Removing the filter cancels orders on every spot market, so only do that intentionally.
spot cancel-all only sweeps the open-orders feed. Orders queued behind collateral withdrawals (pendingCbs) are absent and can execute later. Cancel queued orders individually with spot cancel <orderId> --market <symbol>; a successful sweep does not mean the account has no remaining live orders or holdings.

View spot account data

spot orders

List resting spot orders, following pagination.
Snapshot JSON has the shape { orders, truncated }. When truncated is true, the listing is limited by the API pagination window and must not be treated as the complete set. The CLI displays a warning. Queued orders and IOC orders are not included.

spot balances

View spot holdings, USD value, entry notional (recorded cost basis), unrealized PnL, and assets reserved by open orders.
JSON includes positions, inFlightOrders, totalUsd, unrealizedPnlUsd, and lifetime metrics for volume, maker/taker fees, and realized PnL when available. Entry notional is a total cost basis, not a per-unit average cost. Lifetime metrics can remain available even with no current holdings.

spot history

View spot trade fills, including market, action, size, price, and fee.
--limit defaults to 20 and accepts integers from 1 to 100.

spot order-history

View spot order history across all order states, including filled and cancelled orders. Use this alongside spot history to track queued and IOC orders.
--limit defaults to 20 and accepts integers from 1 to 200.

Spot market data

spot markets ls

List spot markets and their order constraints.
Displays market name, tick size, minimum size, lot size, and trading mode. tickSize is in quote-asset units; minSize and lotSize are in base-asset units, matching order inputs. JSON also includes rawTickSize, rawMinSize, and rawLotSize as on-chain integers, plus baseDecimals and quoteDecimals. Do not use raw values as order inputs. Spot markets have no leverage.

spot price

Get a spot market’s last/mid price and 24-hour statistics.
Returns last price, midpoint, previous-day price, percentage change, high/low, and base/quote volume. midPrice is null unless both book sides have resting liquidity; lastPrice, high24h, and low24h are null without a trade in the last 24 hours. Percentage change is null without a usable baseline. The CLI displays unavailable prices as n/a, not zero. Spot price data has no funding rate, open interest, mark price, or oracle price. This command is a snapshot and has no watch option.

spot book

Fetch a spot orderbook snapshot via WebSocket.
--depth defaults to 10 and accepts integers from 1 to 20. Returns bids, asks, best bid/ask, spread, and spread percentage. Spread is unavailable when either side is empty. This command has no watch option.
The CLI also includes a built-in MCP server for AI agent integration. See the MCP Server Tool Reference for the full list of MCP tools.