Command-line Interface

The python-kraken-sdk provides a command-line interface to access the Kraken API using basic instructions while performing authentication tasks in the background. The Spot and Futures APIs are accessible and follow the pattern kraken {spot,futures} [OPTIONS] URL. All endpoints of the Kraken Spot and Futurs API can be accessed like that. See examples below.

Command-line Interface Examples
 1# get server time
 2kraken spot https://api.kraken.com/0/public/Time
 3{'unixtime': 1716707589, 'rfc1123': 'Sun, 26 May 24 07:13:09 +0000'}
 4
 5# get user's balances
 6kraken spot --api-key=<api-key> --secret-key=<secret-key> -X POST https://api.kraken.com/0/private/Balance
 7{'ATOM': '17.28229999', 'BCH': '0.0000077100', 'ZUSD': '1000.0000'}
 8
 9# get user's trade balances
10kraken spot --api-key=<api-key> --secret-key=<secret-key> -X POST https://api.kraken.com/0/private/TradeBalance --data '{"asset": "DOT"}'
11{'eb': '2.8987347115', 'tb': '1.1694303513', 'm': '0.0000000000', 'uv': '0', 'n': '0.0000000000', 'c': '0.0000000000', 'v': '0.0000000000', 'e': '1.1694303513', 'mf': '1.1694303513'}
12
13# get 1D candles for a futures instrument
14kraken futures https://futures.kraken.com/api/charts/v1/spot/PI_XBTUSD/1d
15{'candles': [{'time': 1625616000000, 'open': '34557.84000000000', 'high': '34803.20000000000', 'low': '33816.32000000000', 'close': '33880.22000000000', 'volume': '0' ...
16
17# get user's open futures positions
18kraken futures --api-key=<api-key> --secret-key=<secret-key> https://futures.kraken.com/derivatives/api/v3/openpositions
19{'result': 'success', 'openPositions': [], 'serverTime': '2024-05-26T07:15:38.91Z'}

kraken

Command-line tool to access the Kraken Crypto Asset Exchange API

Usage

kraken [OPTIONS] COMMAND [ARGS]...

Options

--version
-v, --verbose

Increase verbosity

futures

Access the Kraken Futures REST API

Usage

kraken futures [OPTIONS] URL

Options

-X <x>

Required Request method

Default:

'GET'

Options:

GET | POST | PUT | DELETE

-d, --data <data>

POST parameters as valid JSON string

-q, --query <query>

Query parameters as valid JSON string

--timeout <timeout>

Timeout in seconds

--api-key <api_key>

Kraken Public API Key

--secret-key <secret_key>

Kraken Secret API Key

Arguments

URL

Required argument

spot

Access the Kraken Spot REST API

Usage

kraken spot [OPTIONS] URL

Options

-X <x>

Required Request method

Default:

'GET'

Options:

GET | POST | PUT | DELETE

-d, --data <data>

Payload as valid JSON string

--timeout <timeout>

Timeout in seconds

--api-key <api_key>

Kraken Public API Key

--secret-key <secret_key>

Kraken Secret API Key

Arguments

URL

Required argument