Built into AlgoGP Pro
BrokerMarket dataCrypto API key

Kraken API guide

Kraken is one of the longest-running crypto exchanges and one of the few major venues open to most US residents. Its spot REST API splits cleanly into public endpoints (prices, OHLC, order book) and private ones signed with an API key, a nonce and an HMAC-SHA512 signature.

Last verified

Quick answer

Kraken’s spot REST API has public endpoints (OHLC, order book, trades) and private ones signed with HMAC-SHA512 over the URI path and SHA-256 of nonce + body, sent as API-Key and API-Sign headers with an always-increasing nonce. Rate limits differ by API family, endpoint and account tier; there is no spot testnet, but validate=true checks an order without placing it.

Kraken API at a glance

Pricing
Free API; trading fees apply
Availability
Most countries including most US states
Paper trading
No sandbox
Integration type
REST + API key
In AlgoGP
Built in: broker and data adapter (Pro)
REST base
https://api.kraken.com/0/public/… and /0/private/…
Auth
API-Key header + API-Sign (HMAC-SHA512) + increasing nonce
Candles
GET /0/public/OHLC, last 720 bars per interval
Paper trading
No spot sandbox; validate=true checks an order without placing it

Public OHLC data

GET /0/public/OHLC?pair=XBTUSD&interval=1440 returns [time, open, high, low, close, vwap, volume, count] rows. interval is in minutes: 1, 5, 15, 30, 60, 240, 1440, 10080, 21600. Kraken only returns the most recent 720 bars of each interval, so long daily histories need another source, while the last 720 hourly bars (30 days) are plenty for live warm-up.

How private requests are signed

  1. 1

    Build the POST body

    URL-encode the parameters including a nonce that always increases (milliseconds since the epoch works).

  2. 2

    Hash it

    SHA-256 of nonce + body.

  3. 3

    Sign it

    HMAC-SHA512 of uri_path + sha256_digest, keyed with the base64-decoded private key; base64-encode the result.

  4. 4

    Send it

    Headers API-Key: <public key> and API-Sign: <signature>.

A nonce lower than the last one used by the same key fails with EAPI:Invalid nonce, which is why two bots should never share a key.

Testing without a sandbox

Kraken has no spot testnet. Its AddOrder endpoint accepts validate=true, which runs every check (pair, size, funds, permissions) and returns a description without placing the order. AlgoGP’s sandbox mode for Kraken uses exactly that, so you can prove the integration before any real order is sent.

Use Kraken in AlgoGP

Open a project, go to the APIs & keys tab and, under Platforms, pick Kraken as the market data source (market_data.py) and the broker (brokers.py). The choice is saved to config.json as a new strategy version:

{
  "platforms": {
    "data": "kraken",
    "broker": "kraken"
  }
}
In-app backtests always use AlgoGP’s normalized history so results stay comparable; this choice decides what backtest.py and live.py connect to when you run the exported code.
KeyWhat it is
KRAKEN_API_KEYKraken API key (Settings → API), with Query Funds and Create & Modify Orders.
KRAKEN_API_SECRETKraken private key (base64); shown once when the key is created.
Names the generated code reads. Add values under Keys & secrets or in a local .env.
  • TRADING_MODE=paper (default): simulated fills on your machine; the broker is never contacted.
  • TRADING_MODE=sandbox: orders go to Kraken in validate-only mode, which checks each order without placing it.
  • TRADING_MODE=live: real orders, and only once LIVE_TRADING_ACKNOWLEDGED=yes is set.

New to Kraken? Follow the step-by-step Kraken API key guide.

Kraken API: frequently asked questions

Is the Kraken API available in the US?

Kraken serves most US states; a few have restrictions on some products. Check Kraken’s availability page for your state.

Does Kraken have a paper trading account?

Not for spot. Use validate=true orders to check integrations, and a simulated paper broker to measure a strategy.

How far back does Kraken OHLC data go?

The REST OHLC endpoint returns only the latest 720 bars per interval. Full trade history is available as downloadable files.

Build a Kraken trading bot in minutes

Describe the strategy in plain English, backtest it on years of data, then export Python that already talks to Kraken: paper, sandbox and live modes, keys handled for you.

  • Generated adapter for Kraken orders and balances
  • Backtests with costs, slippage and walk-forward checks
  • Paper first; live trading only after you opt in

Free plan, no card required. Kraken is included with Pro.

Kraken alternatives

Independent guide. AlgoGP is not affiliated with Kraken. Limits, prices and availability change; confirm them in the official documentation. Nothing here is investment advice.