Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
K

kraken-cli

> 编程语言
Open source

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

678 stars0 likes0 views
WebsiteGitHub

About

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

Kraken CLI

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."

"Open a 10x leveraged long on BTC futures paper with $5,000 collateral. Set a trailing stop at 3%."


[!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
  • What You Can Trade
  • Quick Start
  • MCP Server
  • Workspaces, Sessions, and Research
  • Paper Trading
  • Commands
  • API Keys & Configuration
  • Verifying Binaries
  • Contributing
  • License & Disclaimer

Installation

Single binary, no runtime dependencies.

One-liner

bash
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:

bash
kraken status && kraken ticker BTCUSD

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

Build from source

Requires Rust.

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

Or clone and build:

bash
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 class Instruments Margin Flag Example
Crypto spot 1,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 more Up to 3x on top 10 --asset-class tokenized_asset kraken order buy AAPLx/USD 0.1 --type limit --price 200 --asset-class tokenized_asset
Forex 11 fiat pairs: EUR/USD, GBP/USD, USD/JPY, AUD/USD, and more — --asset-class forex kraken ticker EURUSD --asset-class forex
Perpetual futures 317 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 futures 20 contracts: BTC, ETH, SOL, LTC, XRP, ADA, DOGE, LINK Varies (futures engine) kraken futures order buy FI_XBTUSD_260327 1 --type limit --price 50000
Earn / staking Flexible and bonded strategies across multiple assets — — kraken 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:

Resource Description
CONTEXT.md Runtime context for tool-using agents
AGENTS.md Full integration guide: auth, invocation, errors, rate limits
docs/feedback-ingest.md How kraken feedback uploads to Kraken (limits, retention)
agents/tool-catalog.json 174 commands with parameter schemas, types, and safety flags
agents/error-catalog.json 10 error categories with retry guidance
skills/ Goal-oriented SKILL.md workflow packages
CLAUDE.md Claude-specific integration guidance

Core invocation pattern:

bash
kraken  [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 — structured JSON logs (warnings/errors by default, more with -v or RUST_LOG). 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 (spot) and kraken futures paper (perpetual futures) commands. No API keys, no real money, same interface as live trading.
  • Market memory. kraken record captures live streams into a local DuckDB/JSONL tape library with integrity counters; finalized tapes replay into paper sessions and feed the autoresearch lab.
  • Full API surface. The catalog describes 174 request/response commands covering Spot, Futures, xStocks, Forex, Funding, Earn, Subaccounts, and paper trading. Long-running WebSocket, recording, replay, session-start, and stream-daemon surfaces remain CLI-only.
  • 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:

bash
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:

bash
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:

bash
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):

bash
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)

bash
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:

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

Variable Default Description
KRAKEN_SPOT_URL https://api.kraken.com Spot REST API base URL
KRAKEN_FUTURES_URL https://futures.kraken.com/derivatives/api/v3 Futures REST API base URL
KRAKEN_WS_PUBLIC_URL wss://ws.kraken.com/v2 Public WebSocket endpoint
KRAKEN_WS_AUTH_URL wss://ws-auth.kraken.com/v2 Authenticated Spot WebSocket endpoint
KRAKEN_WS_L3_URL wss://ws-l3.kraken.com/v2 Level 3 order book WebSocket endpoint
KRAKEN_FUTURES_WS_URL wss://futures.kraken.com/ws/v1 Futures WebSocket endpoint
KRAKEN_FEEDBACK_ENDPOINT https://cli-feedback.kraken.com/v1/feedback Product feedback ingest URL (trusted hosts only; see docs/feedback-ingest.md)

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.

bash
kraken mcp                           # default: market, account, paper, workspace, feedback
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.):

json
{
  "mcpServers": {
    "kraken": {
      "co

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Rust

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言