KRAKEN API - Cryptocurrency Trading

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Internet and Network > MCP. - MCP (Model-Context Protocol) server operations >

KRAKEN API - Cryptocurrency Trading

The KRAKEN.* commands provide access to the Kraken cryptocurrency exchange API, one of the oldest and most secure Bitcoin exchanges.

Feature

Value

API Base URL

https://api.kraken.com

Authentication

HMAC-SHA512 Signature

Default Pair

XXBTZUSD

(Kraken uses X-prefixed asset codes)

Asset Pair Notation

Kraken uses unique asset codes with X/Z prefixes:

XXBT = Bitcoin (XBT)XETH = EthereumZUSD = US DollarZEUR = EuroXXBTZUSD = BTC/USD pairXETHZEUR = ETH/EUR pair

Available Commands

Command

Purpose

API Key Required

KRAKEN.Init

Initialize the API

No

KRAKEN.SetKey

Set your API Key

N/A

KRAKEN.SetSecret

Set your API Private Key

N/A

KRAKEN.GetPrice

Get current price for a pair

No

KRAKEN.GetBalance

Get account balance (JSON)

Yes

KRAKEN.PlaceOrder

Place a buy/sell order

Yes

KRAKEN.CancelOrder

Cancel an open order

Yes

KRAKEN.GetOrders

Get list of open orders

Yes

Quick Start Example

; Initialize Kraken API

KRAKEN.Init

 

; Set your API credentials

KRAKEN.SetKey|your_api_key_here

KRAKEN.SetSecret|your_private_key_base64_here

 

; Get current Bitcoin price in USD

KRAKEN.GetPrice|XXBTZUSD|btcPriceJson

; Parse JSON to extract price using PSJ commands...

Security Notes

Never commit API keys to version control.The Kraken private key is base64 encoded - copy it directly from the Kraken website.Consider using a demo/sub-account for testing.Never enable withdrawal permissions for API keys used by scripts.

See Also

BINANCE API - Alternative exchangePSJ.Parse - Parse JSON responses