> ## Documentation Index
> Fetch the complete documentation index at: https://kraken-sandbox.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# kraken-cli

> Single-binary CLI for Spot and Derivatives trading — scripting, automation, paper trading, and AI agent workflows

kraken-cli is a single compiled binary for trading and account management across the Kraken exchange. No runtime dependencies. One install covers Spot, Derivatives, xStocks, Forex, Earn, and Subaccounts.

<CardGroup cols={2}>
  <Card title="GitHub" icon="github" href="https://github.com/krakenfx/kraken-cli">
    Source, releases, and changelog
  </Card>

  <Card title="MCP server" icon="robot" href="/home/mcp">
    Expose all 151 commands as tools for AI agents via the built-in MCP server
  </Card>
</CardGroup>

## Install

```bash theme={null}
curl --proto '=https' --tlsv1.2 -LsSf \
  https://github.com/krakenfx/kraken-cli/releases/latest/download/kraken-cli-installer.sh | sh
```

Supported on macOS (Apple Silicon and Intel), Linux (x86\_64 and ARM64), and Windows via WSL. Release binaries are Minisign-verified.

Verify the install:

```bash theme={null}
kraken status && kraken ticker BTCUSD
```

## What it covers

151 commands across 13 groups. Six asset classes in one binary:

| Asset class                    | Examples                       | Notes                           |
| :----------------------------- | :----------------------------- | :------------------------------ |
| Crypto spot                    | BTC, ETH, SOL (1,400+ pairs)   | Default engine                  |
| xStocks (tokenized equities)   | AAPL, TSLA, SPY (79 assets)    | `--asset-class tokenized_asset` |
| Forex                          | EUR/USD, GBP/USD (11 pairs)    | `--asset-class forex`           |
| Perpetual futures              | 317 contracts                  | Futures engine                  |
| Inverse and fixed-date futures | BTC, ETH, SOL                  | Futures engine                  |
| Earn / staking                 | Flexible and bonded strategies | `kraken earn`                   |

### Command groups

| Group         | Commands | Auth required |
| :------------ | :------: | :-----------: |
| market        |    10    |       No      |
| account       |    18    |      Yes      |
| trade         |     9    |      Yes      |
| funding       |    10    |      Yes      |
| earn          |     6    |      Yes      |
| subaccount    |     2    |      Yes      |
| futures       |    39    |     Mixed     |
| paper         |    10    |       No      |
| futures-paper |    17    |       No      |
| websocket     |    15    |     Mixed     |
| futures-ws    |     9    |     Mixed     |
| auth          |     4    |       No      |
| utility       |     2    |       No      |

## Paper trading

The CLI's built-in paper trading engine runs against live prices with no authentication required. It is the recommended way to test strategies and integrations.

```bash theme={null}
# Spot paper trading
kraken paper balance
kraken paper order buy BTCUSD 0.001 --type limit --price 50000
kraken paper positions

# Futures paper trading
kraken futures paper balance
kraken futures paper order buy PF_XBTUSD 1 --type limit --price 50000
```

Paper and live trading share the same command interface — switching to live is a matter of removing the `paper` subcommand and providing credentials.

## Scripting and automation

All 151 commands support `-o json` output and consistent exit codes (0 = success, non-zero = failure), making them composable in shell scripts and CI pipelines:

```bash theme={null}
# Cancel all open orders on BTC/USD
kraken spot orders cancel-all --pair BTC/USD

# Stream the live order book to a file
kraken spot ws book --symbol BTC/USD >> book.jsonl

# Fetch balance as JSON, filter with jq
kraken account balance -o json | jq '.XXBT'
```

Stdout always produces valid JSON on success or an error envelope on failure. Stderr carries diagnostics only. Never parse stderr for data.

## Account management

```bash theme={null}
kraken balance
kraken open-orders -o json
kraken account trades
```

## Dead man's switch

Cancel all open orders if your process stops sending heartbeats:

```bash theme={null}
kraken spot cancel-after --timeout 60
```

## Authentication

Credentials are resolved in this order:

1. Command-line flags (`--api-key`, `--api-secret`)
2. Environment variables (`KRAKEN_API_KEY`, `KRAKEN_API_SECRET`)
3. Config file (`~/.config/kraken/config.toml`)

Run the setup wizard to configure interactively:

```bash theme={null}
kraken setup
```

Generate API keys at [Settings → API](https://www.kraken.com/u/security/api) for Spot, or in the Futures interface for Derivatives. Grant only the permissions your workflow needs.

## Interactive shell

For exploratory sessions:

```bash theme={null}
kraken shell
```

## AI agent integration

The CLI is designed for machine consumption: structured JSON output, stable error categories, and predictable exit codes. See the [MCP server](/home/mcp) page to expose all commands as tools for LLM agents.

Agent resources shipped with the CLI:

| Resource                    | Purpose                                |
| :-------------------------- | :------------------------------------- |
| `AGENTS.md`                 | Full agent integration guide           |
| `CONTEXT.md`                | Runtime context for tool-using agents  |
| `agents/tool-catalog.json`  | 151 commands with parameter schemas    |
| `agents/error-catalog.json` | 9 error categories with retry guidance |
| `skills/`                   | 50 goal-oriented workflow packages     |
| `CLAUDE.md`                 | Claude-specific guidance               |
