> ## Documentation Index
> Fetch the complete documentation index at: https://docs.decibel.trade/llms.txt
> Use this file to discover all available pages before exploring further.

# Command Reference

> Complete reference for all Decibel CLI commands

## Account commands

Manage locally stored trading accounts.

### `account add`

Interactively add a new trading account.

```bash theme={null}
decibel-cli account add
```

Prompts for subaccount address, account type (`api-wallet` or `read-only`), private key, alias, and default status. Private keys are encrypted at rest in `~/.decibel/data.db`.

### `account ls`

List all stored accounts.

```bash theme={null}
decibel-cli account ls [--json]
```

### `account set-default`

Set the default account used when no `--account` flag is provided.

```bash theme={null}
decibel-cli account set-default [alias]
```

If `alias` is omitted, an interactive picker is shown.

### `account remove`

Remove a stored account.

```bash theme={null}
decibel-cli account remove [alias] [-y]
```

| Option | Description       |
| ------ | ----------------- |
| `-y`   | Skip confirmation |

### `account info`

Show account balances and equity.

```bash theme={null}
decibel-cli account info [--json] [--account <alias>] [--network <network>]
```

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

***

## Market commands

Query market data and prices.

### `markets ls`

List all available markets.

```bash theme={null}
decibel-cli markets ls [--json] [--network <network>]
```

Displays: market name, max leverage, tick size, min size, and trading mode.

### `markets price`

Get the current price for a market.

```bash theme={null}
decibel-cli markets price <symbol> [--json] [--network <network>] [-w]
```

| Argument | Description                     |
| -------- | ------------------------------- |
| `symbol` | Market symbol (e.g., `BTC/USD`) |

| Option | Description                            |
| ------ | -------------------------------------- |
| `-w`   | Watch price in real-time via WebSocket |

Displays: mark price, oracle price, funding rate, and open interest.

### `markets book`

View the order book for a market.

```bash theme={null}
decibel-cli markets book <symbol> [--json] [--network <network>] [-w] [--depth <n>]
```

| Option        | Default | Description                    |
| ------------- | ------- | ------------------------------ |
| `-w`          |         | Watch orderbook in real-time   |
| `--depth <n>` | `10`    | Number of price levels to show |

Displays: color-coded bid/ask levels with size and depth bars.

***

## Trade commands

Place orders, manage positions, and view trading history.

### Place orders

#### `trade order limit`

Place a limit order.

```bash theme={null}
decibel-cli trade order limit <side> <size> <symbol> <price> [options]
```

| Argument | Description                       |
| -------- | --------------------------------- |
| `side`   | `buy`, `sell`, `long`, or `short` |
| `size`   | Order size (e.g., `0.01`)         |
| `symbol` | Market symbol (e.g., `BTC/USD`)   |
| `price`  | Limit price                       |

| Option             | Default | Description                              |
| ------------------ | ------- | ---------------------------------------- |
| `--tif <tif>`      | `gtc`   | Time in force: `gtc`, `post-only`, `ioc` |
| `--reduce-only`    | `false` | Reduce-only order                        |
| `--client-id <id>` |         | Client order ID for tracking             |

```bash theme={null}
# Buy 0.01 BTC at $50,000 limit
decibel-cli trade order limit buy 0.01 BTC/USD 50000

# Post-only sell order
decibel-cli trade order limit sell 0.5 ETH/USD 4000 --tif post-only
```

#### `trade order market`

Place a market order.

```bash theme={null}
decibel-cli trade order market <side> <size> <symbol> [options]
```

| Argument | Description                       |
| -------- | --------------------------------- |
| `side`   | `buy`, `sell`, `long`, or `short` |
| `size`   | Order size                        |
| `symbol` | Market symbol                     |

| Option             | Default | Description                  |
| ------------------ | ------- | ---------------------------- |
| `--slippage <pct>` | `1`     | Max slippage percentage      |
| `--reduce-only`    | `false` | Reduce-only order            |
| `--client-id <id>` |         | Client order ID for tracking |

```bash theme={null}
decibel-cli trade order market buy 0.01 BTC/USD
decibel-cli trade order market sell 1 ETH/USD --slippage 0.5
```

#### `trade order stop-limit`

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

```bash theme={null}
decibel-cli trade order stop-limit <side> <size> <symbol> <price> <stopPrice> [options]
```

| Argument    | Description                       |
| ----------- | --------------------------------- |
| `side`      | `buy`, `sell`, `long`, or `short` |
| `size`      | Order size                        |
| `symbol`    | Market symbol                     |
| `price`     | Limit price (execution price)     |
| `stopPrice` | Trigger price                     |

| Option             | Default | Description                              |
| ------------------ | ------- | ---------------------------------------- |
| `--tif <tif>`      | `gtc`   | Time in force: `gtc`, `post-only`, `ioc` |
| `--reduce-only`    | `false` | Reduce-only order                        |
| `--client-id <id>` |         | Client order ID for tracking             |

```bash theme={null}
decibel-cli trade order stop-limit sell 0.01 BTC/USD 49000 49500
```

#### `trade order stop-market`

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

```bash theme={null}
decibel-cli trade order stop-market <side> <size> <symbol> <stopPrice> [options]
```

| Argument    | Description                       |
| ----------- | --------------------------------- |
| `side`      | `buy`, `sell`, `long`, or `short` |
| `size`      | Order size                        |
| `symbol`    | Market symbol                     |
| `stopPrice` | Trigger price                     |

| Option             | Default | Description                         |
| ------------------ | ------- | ----------------------------------- |
| `--slippage <pct>` | `1`     | Slippage percentage from stop price |
| `--reduce-only`    | `false` | Reduce-only order                   |
| `--client-id <id>` |         | Client order ID for tracking        |

```bash theme={null}
decibel-cli trade order stop-market sell 0.01 BTC/USD 49000
```

#### `trade order twap`

Place a TWAP (Time-Weighted Average Price) order. Splits the order into smaller sub-orders over a duration.

```bash theme={null}
decibel-cli trade order twap <side> <size> <symbol> --duration <seconds> --frequency <seconds> [options]
```

| Argument | Description                       |
| -------- | --------------------------------- |
| `side`   | `buy`, `sell`, `long`, or `short` |
| `size`   | Total order size                  |
| `symbol` | Market symbol                     |

| Option                  | Default | Description                            |
| ----------------------- | ------- | -------------------------------------- |
| `--duration <seconds>`  |         | Total execution duration in seconds    |
| `--frequency <seconds>` |         | Interval between sub-orders in seconds |
| `--reduce-only`         | `false` | Reduce-only order                      |

```bash theme={null}
# Buy 1 BTC over 10 minutes, placing sub-orders every 30 seconds
decibel-cli trade order twap buy 1 BTC/USD --duration 600 --frequency 30
```

### Cancel orders

#### `trade cancel`

Cancel a specific open order.

```bash theme={null}
decibel-cli trade cancel <orderId> --market <symbol> [options]
```

| Argument  | Description            |
| --------- | ---------------------- |
| `orderId` | The order ID to cancel |

| Option              | Description   |
| ------------------- | ------------- |
| `--market <symbol>` | Market symbol |

#### `trade cancel-all`

Cancel all open orders.

```bash theme={null}
decibel-cli trade cancel-all [--market <symbol>] [options]
```

| Option              | Description                       |
| ------------------- | --------------------------------- |
| `--market <symbol>` | Cancel only orders in this market |
| `-y, --yes`         | Skip confirmation prompt          |

#### `trade cancel-twap`

Cancel an active TWAP order.

```bash theme={null}
decibel-cli trade cancel-twap <orderId> --market <symbol> [options]
```

### Close positions

#### `trade close`

Close an open position at market price.

```bash theme={null}
decibel-cli trade close <symbol> [options]
```

| Argument | Description                     |
| -------- | ------------------------------- |
| `symbol` | Market symbol (e.g., `BTC/USD`) |

| Option             | Default       | Description                              |
| ------------------ | ------------- | ---------------------------------------- |
| `--slippage <pct>` | `1`           | Max slippage percentage                  |
| `--size <size>`    | Full position | Partial close size (omit for full close) |

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

#### `trade tp-sl set`

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

```bash theme={null}
decibel-cli trade tp-sl set <symbol> [options]
```

| Argument | Description   |
| -------- | ------------- |
| `symbol` | Market symbol |

| Option                 | Description                               |
| ---------------------- | ----------------------------------------- |
| `--tp-trigger <price>` | Take-profit trigger price                 |
| `--sl-trigger <price>` | Stop-loss trigger price                   |
| `--tp-limit <price>`   | Take-profit limit price                   |
| `--sl-limit <price>`   | Stop-loss limit price                     |
| `--tp-size <size>`     | Take-profit size (omit for full position) |
| `--sl-size <size>`     | Stop-loss size (omit for full position)   |

```bash theme={null}
decibel-cli trade tp-sl set BTC/USD --tp-trigger 55000 --sl-trigger 45000
```

#### `trade tp-sl ls`

List active TP/SL orders for a position.

```bash theme={null}
decibel-cli trade tp-sl ls <symbol> [--json]
```

#### `trade tp-sl cancel`

Cancel a TP/SL order.

```bash theme={null}
decibel-cli trade tp-sl cancel <orderId> --market <symbol>
```

### Configuration

#### `trade set-leverage`

Set leverage for a market.

```bash theme={null}
decibel-cli trade set-leverage <symbol> <leverage>
```

| Argument   | Description                      |
| ---------- | -------------------------------- |
| `symbol`   | Market symbol                    |
| `leverage` | Leverage multiplier (e.g., `10`) |

| Option       | Default | Description         |
| ------------ | ------- | ------------------- |
| `--cross`    | `true`  | Use cross margin    |
| `--isolated` |         | Use isolated margin |

```bash theme={null}
decibel-cli trade set-leverage BTC/USD 10
```

#### `trade set-margin`

Set the margin type for a market.

```bash theme={null}
decibel-cli trade set-margin <symbol> <type>
```

| Argument | Description           |
| -------- | --------------------- |
| `symbol` | Market symbol         |
| `type`   | `cross` or `isolated` |

```bash theme={null}
decibel-cli trade set-margin BTC/USD cross
```

### View trading data

#### `trade positions`

List open positions.

```bash theme={null}
decibel-cli trade positions [--json] [-w]
```

| Option | Description                                |
| ------ | ------------------------------------------ |
| `-w`   | Watch positions in real-time via WebSocket |

#### `trade orders`

List open orders.

```bash theme={null}
decibel-cli trade orders [--json] [-w]
```

| Option | Description                             |
| ------ | --------------------------------------- |
| `-w`   | Watch orders in real-time via WebSocket |

#### `trade active-twaps`

List active TWAP orders.

```bash theme={null}
decibel-cli trade active-twaps [--json]
```

#### `trade history`

View trade fill history.

```bash theme={null}
decibel-cli trade history [--json] [--limit <n>]
```

#### `trade order-history`

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

```bash theme={null}
decibel-cli trade order-history [--json] [--limit <n>]
```

#### `trade twap-history`

View TWAP order history.

```bash theme={null}
decibel-cli trade twap-history [--json] [--limit <n>]
```

#### `trade funding-history`

View funding rate payment history.

```bash theme={null}
decibel-cli trade funding-history [--json] [--limit <n>]
```

<Note>
  The CLI also includes a built-in MCP server for AI agent integration. See the [MCP Server Tool Reference](/agents/mcp/reference) for the full list of MCP tools.
</Note>
