KRAKEN-CLI(1)

NAME

kraken-cliThe first AI-native CLI for trading crypto, stocks, forex, and derivatives.

SYNOPSIS

$apt install minisign

INFO

167 stars
28 forks
0 views

DESCRIPTION

The first AI-native CLI for trading crypto, stocks, forex, and derivatives.

README

Kraken CLI

version license platform

The first AI-native CLI for trading crypto, stocks, forex, and derivatives.

Full Kraken API access. Built-in MCP server. Live and paper trading. Single binary.

Works with Cursor, Claude, Codex, Copilot, Gemini, Goose, and OpenClaw.

Try these with your AI agent:

"Install kraken-cli (https://github.com/krakenfx/kraken-cli) and build me a morning market brief."

"Watch ETH, SOL, and BTC for 30 seconds. What are the pros and cons of buying each right now?"

"Look up AAPLx, TSLAx, and SPYx on xStocks. Summarize how each is performing today."

"You are a Wall Street veteran with 20 years of experience. You have 1 minute. Paper trade BTC and show me your P&L."


[!CAUTION] Experimental software. Interacts with the live Kraken exchange and can execute real financial transactions. Read DISCLAIMER.md before using with real funds or AI agents.

Contents

Installation

Single binary, no runtime dependencies.

One-liner

curl --proto '=https' --tlsv1.2 -LsSf https://github.com/krakenfx/kraken-cli/releases/latest/download/kraken-cli-installer.sh | sh

Detects your OS and architecture, downloads the right binary, and installs it. macOS (Apple Silicon and Intel) and Linux (x86_64 and ARM64) are supported. Windows: use WSL.

Verify it works:

kraken status && kraken ticker BTCUSD

Pre-built binaries are also available on the GitHub Releases page.

Build from source

Requires Rust.

cargo install --git https://github.com/krakenfx/kraken-cli

Or clone and build:

git clone https://github.com/krakenfx/kraken-cli.git
cd kraken-cli
cargo install --path .

What You Can Trade

One binary covers six asset classes. All trading commands work across asset classes using the same interface; pass --asset-class where needed.

Asset classInstrumentsMarginFlagExample
Crypto spot1,400+ pairs (BTC, ETH, SOL, and hundreds more)Up to 10x on major pairs(default)kraken order buy BTCUSD 0.001 --type limit --price 50000
Tokenized U.S. stocks & ETFs (xStocks)79 assets: AAPL, NVDA, TSLA, GOOGL, AMZN, MSFT, SPY, QQQ, and moreUp to 3x on top 10--asset-class tokenized_assetkraken order buy AAPLx/USD 0.1 --type limit --price 200 --asset-class tokenized_asset
Forex11 fiat pairs: EUR/USD, GBP/USD, USD/JPY, AUD/USD, and more--asset-class forexkraken ticker EURUSD --asset-class forex
Perpetual futures317 contracts: crypto, 5 forex perps, 11 equity/index perps (AAPL, NVDA, TSLA, SPY, QQQ, S&P 500)Up to 50x(futures engine)kraken futures order buy PF_XBTUSD 1 --type limit --price 50000
Inverse & fixed-date futures20 contracts: BTC, ETH, SOL, LTC, XRP, ADA, DOGE, LINKVaries(futures engine)kraken futures order buy FI_XBTUSD_260327 1 --type limit --price 50000
Earn / stakingFlexible and bonded strategies across multiple assetskraken earn strategies --asset ETH

xStocks are not available in the USA. Availability for all products varies by jurisdiction.

For AI Agents

If you're an AI agent or building one, start here:

ResourceDescription
CONTEXT.mdRuntime context for tool-using agents
AGENTS.mdFull integration guide: auth, invocation, errors, rate limits
agents/tool-catalog.json134 commands with parameter schemas, types, and safety flags
agents/error-catalog.json9 error categories with retry guidance
skills/50 goal-oriented SKILL.md workflow packages
CLAUDE.mdClaude-specific integration guidance

Core invocation pattern:

kraken <command> [args...] -o json 2>/dev/null
  • stdout is always valid JSON on success, or a JSON error envelope on failure.
  • Exit code 0 means success. Non-zero means failure.
  • stderr carries diagnostics only (enabled with -v). Never parse stderr for data.
Why Agent-First?

Most CLIs are built for humans at a terminal. This one is built for LLM-based agents, MCP tool servers, and automated pipelines that need to call Kraken reliably without custom API clients.

  • Structured output by default. Every command supports -o json. No screen-scraping, no regex on table borders.
  • Consistent error envelopes. Errors are JSON objects with a stable error field (auth, rate_limit, validation, api, network). Agents route on error without parsing human sentences.
  • Predictable exit codes. Success is 0, failure is non-zero. Combined with JSON errors on stdout, agents detect and classify failures programmatically.
  • Paper trading for safe iteration. Test strategies against live prices with kraken paper commands. No API keys, no real money, same interface.
  • Full API surface. 134 commands covering Spot, Futures, xStocks, Forex, Funding, Earn, Subaccounts, and WebSocket streaming.
  • Built-in MCP server. Native Model Context Protocol support over stdio. No subprocess wrappers needed.
  • Rate-limit aware. No client-side throttling. When the Kraken API rejects a request due to rate limits, the CLI returns an enriched error with suggestion, retryable, and docs_url fields so agents can read the documentation and adapt their strategy.

Humans benefit from the same design: --output table renders clean tables, kraken shell provides a REPL, and kraken setup walks through configuration.

Verifying Binaries

Release binaries are signed with minisign. Every artifact on the Releases page has a corresponding .minisig signature file.

Public key:

RWQJue8SwPzZBZO8Up5ppAUqm0wM/gK5yjnam+Dbf7KbY0utkiO+7XCd

Verify a downloaded binary:

minisign -Vm kraken-cli-aarch64-apple-darwin.tar.gz -P RWQJue8SwPzZBZO8Up5ppAUqm0wM/gK5yjnam+Dbf7KbY0utkiO+7XCd

Install minisign: brew install minisign (macOS) or apt install minisign (Linux).

Quick Start

Public market data requires no credentials:

kraken ticker BTCUSD -o json
kraken orderbook BTCUSD --count 10 -o json
kraken trades BTCUSD --count 20 -o json
kraken ohlc BTCUSD --interval 60 -o json

With authentication:

export KRAKEN_API_KEY="your-key"
export KRAKEN_API_SECRET="your-secret"

kraken balance -o json kraken open-orders -o json kraken order buy BTCUSD 0.001 --type limit --price 50000 -o json

For humans (table output, interactive setup):

kraken setup
kraken ticker BTCUSD
kraken balance
kraken shell

API Keys & Configuration

Authenticated commands (trading, balances, order management) require a Kraken API key pair. Public market data and paper trading work without credentials.

Getting API keys

Spot (covers trading, balances, funding, earn, subaccounts): Settings > API on kraken.com. Full guide: How to create a spot API key.

Futures (only for kraken futures commands): Settings > Create Key on the Futures interface. Full guide: How to create a Futures API key.

Grant the minimum permissions your workflow needs. For read-only monitoring, "Query Funds" and "Query Open Orders & Trades" are sufficient.

Environment variables (recommended for agents)

export KRAKEN_API_KEY="your-key"
export KRAKEN_API_SECRET="your-secret"
export KRAKEN_FUTURES_API_KEY="your-futures-key"       # optional
export KRAKEN_FUTURES_API_SECRET="your-futures-secret"  # optional

Config file (for humans)

Store credentials in ~/.config/kraken/config.toml:

[auth]
api_key = "your-api-key"
api_secret = "your-api-secret"

[settings] default_pair = "BTCUSD" output = "table"

Or use the interactive wizard: kraken setup.

Credential resolution

Highest precedence first:

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

Security

  • Config file is created with 0600 permissions (owner read/write only)
  • Secrets are never logged, printed, or included in error messages
  • Use --api-secret-stdin or --api-secret-file instead of --api-secret to avoid secrets in process listings
  • For automation, prefer environment variables over command-line flags
Advanced: API endpoint overrides
VariableDefaultDescription
KRAKEN_SPOT_URLhttps://api.kraken.comSpot REST API base URL
KRAKEN_FUTURES_URLhttps://futures.kraken.com/derivatives/api/v3Futures REST API base URL
KRAKEN_WS_PUBLIC_URLwss://ws.kraken.com/v2Public WebSocket endpoint
KRAKEN_WS_AUTH_URLwss://ws-auth.kraken.com/v2Authenticated Spot WebSocket endpoint
KRAKEN_WS_L3_URLwss://ws-l3.kraken.com/v2Level 3 order book WebSocket endpoint
KRAKEN_FUTURES_WS_URLwss://futures.kraken.com/ws/v1Futures WebSocket endpoint

Resolution: CLI flag > environment variable > default. Only https:// and wss:// schemes are accepted.

MCP Server

kraken-cli includes a built-in Model Context Protocol server over stdio. No subprocess wrappers needed.

MCP tool calls run through the same command path as CLI commands and inherit the same error handling and rate-limit behavior.

[!WARNING] MCP is local-first and designed for your own machine. Any agent connected to this MCP server uses the same configured Kraken account and API key permissions. Do not expose, tunnel, or share this server outside systems you control. Always use https:// and wss:// endpoints. Treat this integration as alpha and use least-privilege API keys.

kraken mcp                           # read-only (market, account, paper)
kraken mcp -s all                    # all services, dangerous calls require acknowledged=true
kraken mcp -s all --allow-dangerous  # all services, no per-call confirmation
kraken mcp -s market,trade,paper     # specific services

Configure your MCP client (Claude Desktop, ChatGPT, Codex, Gemini CLI, Cursor, VS Code, Windsurf, etc.):

{
  "mcpServers": {
    "kraken": {
      "command": "kraken",
      "args": ["mcp", "-s", "all"]
    }
  }
}

Gemini CLI users can install directly: gemini extensions install https://github.com/krakenfx/kraken-cli

Service groups

ServiceAuthRisk
marketNoNone
accountYesRead-only
tradeYesOrders (dangerous)
fundingYesWithdrawals (dangerous)
earnYesStaking (dangerous)
subaccountYesTransfers (dangerous)
futuresMixedOrders (dangerous)
paperNoNone (simulation)
authNoRead-only

Default: market,account,paper. Streaming groups (websocket, futures-ws) are excluded in MCP v1.

Dangerous tools carry the destructive_hint annotation and include [DANGEROUS: requires human confirmation] in the description. In guarded mode (default), dangerous calls must include acknowledged=true. In autonomous mode (--allow-dangerous), this requirement is disabled.

Output & Errors

JSON (-o json)

The primary output format. Every command returns valid JSON on stdout.

kraken ticker BTCUSD -o json
# {"BTCUSD":{"a":["67234.10","1","1.000"],"b":["67234.00","1","1.000"],...}}

WebSocket commands emit NDJSON (one JSON object per line) for streaming.

Table (-o table)

Human-readable tables. Default when -o is not specified.

┌──────────┬──────────┬──────────┬──────────┬────────────┐
│ Pair     │ Ask      │ Bid      │ Last     │ Volume ... │
├──────────┼──────────┼──────────┼──────────┼────────────┤
│ BTCUSD   │ 67234.10 │ 67234.00 │ 67234.10 │ 1234.56    │
└──────────┴──────────┴──────────┴──────────┴────────────┘

Error envelopes

On failure, stdout contains a JSON envelope with a stable error category:

{"error": "auth", "message": "Authentication failed: EAPI:Invalid key"}

Route on error, not on message. The message field is human-readable and not stable.

CategoryRetryableAction
authNoCheck API key and secret
rate_limitYesError includes suggestion with tier-specific limits, docs_url pointing to Kraken documentation, and retryable flag. Read suggestion and adapt strategy.
networkYesExponential backoff, max 5 retries
validationNoFix input parameters
apiNoInspect request and parameters
configNoCheck config file or env vars
websocketYesReconnect with paced backoff and safety budget (up to 12 reconnect attempts per stream lifecycle)
ioNoCheck file paths and permissions
parseNoLog raw response, possible API maintenance

Full error catalog with envelopes and backoff strategies: agents/error-catalog.json.

Verbose (-v)

Request/response diagnostics go to stderr, keeping stdout clean:

kraken balance -o json -v 2>/dev/null | jq .

Commands

134 commands across 12 groups. For machine-readable parameter schemas, load agents/tool-catalog.json.

GroupCommandsAuthDescription
market10NoTicker, orderbook, OHLC, trades, spreads, asset info
account18YesBalances, orders, trades, ledgers, positions, exports
trade9YesOrder placement, amendment, cancellation (spot, xStocks, forex)
funding10YesDeposits, withdrawals, wallet transfers
earn6YesStaking strategies and allocations
subaccount2YesCreate subaccounts, transfer between accounts
futures39MixedFutures market data and trading
futures-ws9MixedFutures WebSocket streaming
websocket15MixedSpot WebSocket v2 streaming and request/response
paper10NoPaper trading simulation with live prices
auth4NoCredential management
utility2NoInteractive setup and REPL shell

32 commands are marked dangerous (orders, withdrawals, transfers, cancel-all, staking). The authoritative list is the dangerous field in agents/tool-catalog.json.

Full command reference

Market Data (Public)

CommandDescription
kraken statusSystem status
kraken server-timeServer time
kraken assets [--asset BTC,ETH] [--asset-class CLASS]Asset info
kraken pairs [--pair BTCUSD] [--asset-class CLASS]Tradable pairs
kraken ticker <PAIR...> [--asset-class tokenized_asset|forex]Ticker data
kraken ohlc <PAIR> [--interval 60] [--asset-class tokenized_asset|forex]OHLC candles
kraken orderbook <PAIR> [--count 25] [--asset-class tokenized_asset]L2 order book
kraken orderbook-grouped <PAIR> [--depth 10] [--grouping 1]Grouped order book
kraken trades <PAIR> [--count 1000] [--asset-class tokenized_asset]Recent trades
kraken spreads <PAIR> [--since TS] [--asset-class tokenized_asset]Recent spreads

Account Data (Private)

CommandDescription
kraken orderbook-l3 <PAIR> [--depth 100]L3 order book
kraken balance [--rebase-multiplier rebased|base]All balances
kraken extended-balanceExtended balances (balance, credit, held)
kraken credit-lines [--rebase-multiplier rebased|base]Credit line details (VIP)
kraken trade-balance [--asset USD] [--rebase-multiplier rebased|base]Margin/equity summary
kraken open-orders [--trades] [--cl-ord-id ID] [--rebase-multiplier rebased|base]Open orders
kraken closed-orders [--start TS] [--end TS] [--offset N] [--userref REF] [--cl-ord-id ID] [--closetime open|close|both] [--consolidate-taker] [--without-count] [--rebase-multiplier rebased|base]Closed orders
kraken query-orders <TXID...> [--trades] [--userref REF] [--consolidate-taker] [--rebase-multiplier rebased|base]Query specific orders
kraken trades-history [--type TYPE] [--trades] [--offset N] [--consolidate-taker] [--without-count] [--ledgers] [--rebase-multiplier rebased|base]Trade history
kraken query-trades <TXID...> [--trades] [--rebase-multiplier rebased|base]Query specific trades
kraken positions [--txid ID] [--show-pnl] [--consolidation market] [--rebase-multiplier rebased|base]Open positions
kraken ledgers [--asset BTC --type trade] [--asset-class CLASS] [--start TS] [--end TS] [--offset N] [--without-count] [--rebase-multiplier rebased|base]Ledger entries
kraken query-ledgers <ID...> [--trades] [--rebase-multiplier rebased|base]Query specific ledger entries
kraken volume [--pair BTCUSD] [--rebase-multiplier rebased|base]Trade volume & fees
kraken export-report --report trades --description "desc" [--format CSV|TSV] [--fields F] [--starttm TS] [--endtm TS]Request export
kraken export-status --report tradesExport status
kraken export-retrieve <ID>Download export
kraken export-delete <ID>Delete export

Trading

CommandDescription
kraken order buy <PAIR> <VOL> [--type limit --price P] [--asset-class tokenized_asset] [--validate] ...Buy order
kraken order sell <PAIR> <VOL> [--type limit --price P] [--asset-class tokenized_asset] [--validate] ...Sell order
kraken order batch <JSON_FILE> [--pair P] [--asset-class tokenized_asset] [--deadline DL] [--validate]Batch orders (2-15)
kraken order amend --txid <TXID> [--order-qty Q --limit-price P ...]Amend order in-place
kraken order amend --cl-ord-id <ID> [--limit-price P ...]Amend by client order ID
kraken order edit <TXID> [--price P]Edit order (cancel+replace)
kraken order cancel <TXID...>Cancel by txid(s)
kraken order cancel --cl-ord-id <ID>Cancel by client order ID
kraken order cancel-batch <TXID...> [--cl-ord-ids ID...]Cancel batch (max 50 total)
kraken order cancel-all [--yes]Cancel all
kraken order cancel-after <SECS>Dead man's switch

Funding

CommandDescription
kraken deposit methods <ASSET> [--asset-class currency|tokenized_asset] [--rebase-multiplier rebased|base]Deposit methods
kraken deposit addresses <ASSET> <METHOD> [--new] [--asset-class CLASS] [--amount AMT]Deposit addresses
kraken deposit status [--asset A] [--asset-class CLASS] [--method M] [--start TS] [--end TS] [--cursor C] [--limit N] [--rebase-multiplier rebased|base]Deposit status
kraken withdraw <ASSET> <KEY> <AMOUNT> [--asset-class CLASS] [--address ADDR] [--max-fee F] [--rebase-multiplier rebased|base]Withdraw funds
kraken withdrawal methods [--asset A] [--asset-class CLASS] [--network N] [--rebase-multiplier rebased|base]Withdrawal methods
kraken withdrawal addresses [--asset A] [--asset-class CLASS] [--method M] [--key K] [--verified true|false]Withdrawal addresses
kraken withdrawal info <ASSET> <KEY> <AMOUNT>Withdrawal fee info
kraken withdrawal status [--asset A] [--asset-class CLASS] [--method M] [--start TS] [--end TS] [--cursor C] [--limit N] [--rebase-multiplier rebased|base]Withdrawal status
kraken withdrawal cancel <ASSET> <REFID>Cancel pending withdrawal
kraken wallet-transfer <ASSET> <AMT> --from IIBAN --to IIBANWallet transfer

Earn

CommandDescription
kraken earn strategies [--asset ETH] [--lock-type flex bonded...] [--ascending] [--cursor C] [--limit N]List strategies
kraken earn allocate <ID> <AMT>Allocate funds
kraken earn deallocate <ID> <AMT>Deallocate funds
kraken earn allocate-status <ID>Allocation status
kraken earn deallocate-status <ID>Deallocation status
kraken earn allocations [--ascending] [--converted-asset USD] [--hide-zero-allocations]Current allocations

Subaccounts

CommandDescription
kraken subaccount create <USERNAME> <EMAIL>Create sub account
kraken subaccount transfer <ASSET> <AMOUNT> --from IIBAN --to IIBAN [--asset-class CLASS]Transfer between accounts

Futures: Public Market Data

CommandDescription
kraken futures instrumentsAll contracts
kraken futures tickersAll tickers
kraken futures ticker <SYMBOL>Single ticker
kraken futures orderbook <SYMBOL>Order book
kraken futures history <SYMBOL> [--since TS] [--before TS]Trade history
kraken futures feeschedulesFee schedules
kraken futures instrument-status [--symbol SYM]Instrument status

Futures: Trading (Private)

CommandDescription
kraken futures order buy <SYM> <SIZE> [--type limit] [--price P] [--stop-price SP] [--trigger-signal mark|index|last] [--client-order-id ID] [--reduce-only] [--trailing-stop-max-deviation V] [--trailing-stop-deviation-unit percent|quote_currency]Buy futures
kraken futures order sell <SYM> <SIZE> [--type limit] [--price P] [--stop-price SP] ...Sell futures
kraken futures edit-order --order-id ID [--size S] [--price P] [--stop-price SP]Edit existing order
kraken futures cancel --order-id IDCancel by order ID
kraken futures cancel --cli-ord-id IDCancel by client order ID
kraken futures cancel-all [--symbol SYM] [--yes]Cancel all orders
kraken futures cancel-after <SECS>Dead man's switch
kraken futures batch-order '<JSON>' or kraken futures batch-order @file.jsonBatch order placement

Futures: Account Data (Private)

CommandDescription
kraken futures accountsWallet/account info
kraken futures open-ordersOpen orders
kraken futures positionsOpen positions
kraken futures fills [--since TS]Recent fills
kraken futures leverage [--symbol SYM]Leverage preferences
kraken futures set-leverage <SYMBOL> <MAX_LEVERAGE>Set leverage
kraken futures notificationsAccount notifications
kraken futures transfersTransfer history
kraken futures transfer <AMOUNT> <CURRENCY>Transfer between wallets
kraken futures history-executions [--since TS] [--before TS] [--sort asc|desc]Execution history
kraken futures history-orders [--since TS] [--before TS] [--sort asc|desc]Order history
kraken futures history-triggers [--since TS] [--before TS] [--sort asc|desc]Trigger history
kraken futures history-account-log-csv [--since TS] [--before TS]Account log (CSV)
kraken futures trading-instruments [--contract-type ...]Trading instruments (auth)
kraken futures historical-funding-rates <SYMBOL>Historical funding rates
kraken futures order-status <ORDER_ID>...Query order status (auth)
kraken futures pnl-preferencesGet PnL preferences (auth)
kraken futures set-pnl-preference <SYMBOL> <PREFERENCE>Set PnL preference (auth)
kraken futures unwind-queueGet unwind queue (auth)
kraken futures assignment-programsAssignment programs (auth)
kraken futures fee-schedule-volumesFee schedule volumes (auth)
kraken futures subaccountsList subaccounts (auth)
kraken futures subaccount-status <UID>Subaccount trading status (auth)
kraken futures set-subaccount-status <UID> <ENABLED>Set subaccount trading status (auth)
kraken futures wallet-transfer <FROM> <TO> <UNIT> <AMOUNT>Transfer between wallets (auth)

Futures WebSocket Streaming

CommandDescription
kraken futures ws ticker <MARKET...>Stream futures tickers (public)
kraken futures ws trades <MARKET...>Stream futures trades (public)
kraken futures ws book <MARKET...>Stream futures order book (public)
kraken futures ws fillsStream fills (private, challenge auth)
kraken futures ws open-ordersStream open orders (private)
kraken futures ws open-positionsStream open positions (private)
kraken futures ws balancesStream balances and margins (private)
kraken futures ws notificationsStream notifications (private)
kraken futures ws account-logStream account log (private)

WebSocket (Streaming and Request/Response)

CommandDescription
kraken ws ticker <PAIR...> [--event-trigger bbo]Stream tickers
kraken ws trades <PAIR...>Stream trades
kraken ws book <PAIR...> [--depth 10]Stream L2 order book
kraken ws ohlc <PAIR...> [--interval 1]Stream OHLC candles
kraken ws instrument [PAIR...]Stream instrument metadata
kraken ws executionsStream trade executions (auth)
kraken ws balancesStream balance updates (auth)
kraken ws level3 <PAIR...>Stream L3 order book (auth)
kraken ws add-orderPlace order via WebSocket (auth)
kraken ws amend-orderAmend order via WebSocket (auth)
kraken ws cancel-orderCancel order(s) via WebSocket (auth)
kraken ws cancel-allCancel all orders via WebSocket (auth)
kraken ws cancel-after <TIMEOUT>Dead man's switch via WebSocket (auth)
kraken ws batch-addBatch add orders via WebSocket (auth)
kraken ws batch-cancelBatch cancel orders via WebSocket (auth)

Utility

CommandDescription
kraken setupInteractive setup wizard
kraken shellInteractive REPL
kraken auth set/show/test/resetCredential management

Paper Trading

Paper trading provides a safe sandbox for testing trading logic against live Kraken prices. No API keys, no account, no real money. The command interface mirrors live trading exactly; agents can switch between paper and live by changing the command prefix (kraken paper buy vs kraken order buy).

Agent pattern:

kraken paper init --balance 10000 -o json
kraken paper buy BTCUSD 0.01 -o json
kraken paper sell BTCUSD 0.005 --type limit --price 70000 -o json
kraken paper status -o json
kraken paper reset -o json

Human pattern:

kraken paper init --balance 5000 --currency EUR
kraken paper buy BTCUSD 0.01
kraken paper balance
kraken paper status
kraken paper orders
kraken paper history
kraken paper reset
CommandDescription
kraken paper init [--balance 10000] [--currency USD]Initialize paper account
kraken paper resetReconcile pending orders, then reset
kraken paper balanceAll balances (total, reserved, available)
kraken paper buy <PAIR> <VOL> [--type limit --price P]Paper buy (market or limit)
kraken paper sell <PAIR> <VOL> [--type limit --price P]Paper sell (market or limit)
kraken paper ordersOpen limit orders
kraken paper cancel <ORDER_ID>Cancel a limit order
kraken paper cancel-allCancel all limit orders
kraken paper historyFilled trade history
kraken paper statusPortfolio value, unrealized P&L, trade count

Prices come from the public Kraken Ticker API (no auth needed). A 0.26% taker fee (Kraken Starter tier default) is applied to all fills. Limit orders fill at the limit price when the live market crosses the order price.

All output is labeled [PAPER] in table mode and includes "mode": "paper" in JSON mode.

Examples

Conditional order based on live price

PRICE=$(kraken ticker BTCUSD -o json | jq -r '.[].c[0]')
kraken order buy BTCUSD 0.001 --type limit --price "$PRICE" -o json

Portfolio rebalance check

BTC=$(kraken balance -o json | jq -r '.BTC // "0"')

if [ "$(echo "$BTC > 0.001" | bc)" -eq 1 ]; then kraken order sell BTCUSD 0.001 --type market -o json fi

Real-time price stream

kraken ws ticker BTC/USD -o json | while read -r line; do
  LAST=$(echo "$line" | jq -r '.data[0].last // empty')
  [ -n "$LAST" ] && echo "BTC: $LAST"
done

Stream multiple tickers

kraken ws ticker BTC/USD ETH/USD SOL/USD -o json

Dead man's switch

kraken order cancel-after 60

Cancels all open orders if the CLI does not reset the timer within 60 seconds.

Agent Skills

Ships with 50 agent skills covering trading strategies, market analysis, and portfolio management. See the full Skills Index.

Troubleshooting

macOS blocks the binary ("Apple could not verify")

xattr -d com.apple.quarantine /usr/local/bin/kraken

"EAPI:Invalid key" or authentication errors

Check that KRAKEN_API_KEY and KRAKEN_API_SECRET are set correctly. Keys are case-sensitive. Verify the API key has the required permissions for the command (Query Funds for balance, Modify Orders for order buy, etc.).

Rate limit errors

The CLI does not pre-throttle or retry rate-limited requests. The Kraken API server enforces rate limits, and the CLI returns the error immediately with a suggestion field containing tier-specific limits and a docs_url pointing to the relevant Kraken documentation. Read the suggestion and adjust request frequency. For sustained high-frequency use, prefer WebSocket streaming over REST polling.

"No tools found" in MCP client

Verify kraken is on your PATH. Run kraken mcp -s market in a terminal to confirm the server starts. Check that your client configuration matches the JSON format in the MCP Server section.

Paper trading state errors

Run kraken paper reset to clear and reinitialize.

Architecture
src/
  main.rs          -- CLI entry point, clap parsing, exit codes
  lib.rs           -- AppContext, shared dispatcher, module re-exports
  auth.rs          -- HMAC-SHA512 signing (Spot + Futures), nonce management
  config.rs        -- Config file I/O, credential resolution, secret wrappers
  client.rs        -- HTTP clients with transient-error retry and enriched rate-limit errors
  errors.rs        -- Unified error types with category-based JSON envelopes
  paper.rs         -- Paper trading state engine (local simulation)
  shell.rs         -- Interactive REPL with rustyline
  telemetry.rs     -- Agent client identification, instance tracking, user-agent
  commands/        -- One module per command group
    mod.rs         -- Module re-exports
    helpers.rs     -- Shared utilities (JSON extraction, output formatting)
    market.rs      -- Public market data
    account.rs     -- Private account data
    trade.rs       -- Spot trading
    funding.rs     -- Deposits, withdrawals, wallet transfers
    earn.rs        -- Staking/earn
    subaccount.rs  -- Subaccount management
    futures.rs     -- Futures trading and market data
    futures_ws.rs  -- Futures WebSocket v1 streaming
    websocket.rs   -- Spot WebSocket v2 streaming
    paper.rs       -- Paper trading commands
    auth.rs        -- Credential management commands
    utility.rs     -- Setup wizard
  mcp/             -- Built-in MCP server
    mod.rs         -- Service group parsing, streaming exclusion filters
    server.rs      -- ServerHandler impl, tool dispatch, env-based URL resolution
    registry.rs    -- Tool registry built from clap tree + tool-catalog.json
    schema.rs      -- JSON Schema generation from clap argument metadata
  output/          -- Rendering layer
    mod.rs         -- Format dispatch, CommandOutput type
    table.rs       -- Human-readable table output
    json.rs        -- JSON output and NDJSON streaming

Development

cargo build                    # dev build
cargo test                     # run tests
cargo clippy -- -D warnings    # lint

Contributing

Bug reports, feature requests, and pull requests are welcome. See CONTRIBUTING.md for guidelines.

License & Disclaimer

MIT. See LICENSE.

This is experimental software. Commands interact with the live Kraken exchange and can result in real financial transactions. Orders, withdrawals, and transfers are irreversible once processed. The authors accept no liability for financial losses. See DISCLAIMER.md for full terms.

SEE ALSO

clihub3/27/2026KRAKEN-CLI(1)