clikraken

Description

Note: As of 2019, I do not intend to maintain this tool further myself. Feel free to fork it if you want. If a well maintained fork appears, let me know, so I can link to it from here.

clikraken is a command-line client for the Kraken exchange written in Python.

This command line client allows you to get useful public and private information from Kraken’s API and displays it in formatted tables.

Moreover, you can place or cancel simple orders (only simple buy/sell market/limit orders are currently implemented).

It is mainly oriented as an alternative to manually entering orders on Kraken’s webpages, to save some time and eliminate mouse clicks. It is not optimized for automated use.

WARNING: This software is currently in development. I consider it in alpha state, which means that it works well enough for me but hasn’t been thoroughly tested. There are probably undetected bugs left. Use at your own risk!

Project page / Bug reports / Download

The code is hosted on GitHub : https://github.com/zertrin/clikraken (Last update: 2 February 2024)

Feedback and pull requests are welcome (but note that I am not actively maintaining the tool as of 2019)! However, please always use individual feature branches for each pull request. I may not accept a pull request from a master branch.

The python package is available on PyPI: https://pypi.python.org/pypi/clikraken

Installation / Configuration / Upgrade

See the README on GitHub for up-to-date instructions.

Usage examples

Note: unless explicitly specified via the option -p or --pair, the default asset pair is assumed (current default: XETHZEUR).

Available commands

See clikraken’s help for an up-to-date list of available commands (clikraken --help)

At the time of writing, the following commands are implemented:

generate_settings   [clikraken] Print default settings.ini to stdout
asset_pairs (ap)    [public] Get the list of available asset pairs
ticker (t)          [public] Get the Ticker
depth (d)           [public] Get the current market depth data
last_trades (lt)    [public] Get the last trades
balance (bal)       [private] Get your current balance
place (p)           [private] Place an order
cancel (x)          [private] Cancel an order
olist (ol)          [private] Get a list of your open orders
clist (cl)          [private] Get a list of your closed orders
Getting help about the commands

To know how to use a command, enter clikraken <command> --help

For example for help on the command used to place an order: clikraken place --help

usage: ck place [-h] [-p PAIR] [-t {market,limit}] [-s STARTTM] [-e EXPIRETM]
                [-q] [-v]
                {sell,buy} volume [price]

positional arguments:
  {sell,buy}
  volume
  price

optional arguments:
  -h, --help            show this help message and exit
  -p PAIR, --pair PAIR  asset pair (default: XETHZEUR)
  -t {market,limit}, --ordertype {market,limit}
                        order type. Currently implemented: [limit, market].
                        (default: limit)
  -s STARTTM, --starttm STARTTM
                        scheduled start time (default: 0)
  -e EXPIRETM, --expiretm EXPIRETM
                        expiration time (default: 0)
  -q, --viqc            volume in quote currency (default: False)
  -v, --validate        validate inputs only. do not submit order (default:
                        False)
Get public data from Kraken’s API

Market ticker: clikraken ticker or clikraken t

pair         last       high      low        vol       wavg  vol value          ask        bid
------  ---------  ---------  -------  ---------  ---------  -----------  ---------  ---------
ETHEUR    61.4       62.8222    53.7   259165       58.9763  15 MEUR        61.394     61.2013
ETHUSD    67.0199    68.4998    59.05   98463.8     64.2727  6329 kUSD      67.2722    67.1325
XBTEUR  1209.9     1224.57    1179.95   11543.1   1211.87    14 MEUR      1212.18    1209.9
XBTUSD  1321.51    1355.55    1295.5     3370.21  1330.36    4484 kUSD    1327.66    1321.53

Market depth: clikraken depth or clikraken d:

  ETHEUR Ask    Volume  Age
------------  --------  -------------
     9.2979     48.75   just now
     9.28368    50.34   8 minutes ago
     9.28367    10.547  just now
     9.28366     0.26   just now
     9.27396  2015.81   just now
     9.27393    68.225  just now

  ETHEUR Bid    Volume  Age
------------  --------  --------------
     9.207     914.181  seconds ago
     9.205       0.1    10 minutes ago
     9.20101    44.115  just now
     9.201       1      17 minutes ago
     9.20058     0.217  6 minutes ago
     9.2       936.012  16 minutes ago
     9.1611    100.581  just now

Last trades: clikraken last_trades or clikraken lt

Trade type    Order type      Price     Volume  Age
------------  ------------  -------  ---------  -------------
buy           limit         9.20701    0.39     seconds ago
sell          limit         9.207     39.6962   seconds ago
buy           market        9.27395   29.9342   a minute ago
buy           market        9.27394    0.1      a minute ago
buy           market        9.27394   25.5943   a minute ago
buy           market        9.27393   17.506    a minute ago
buy           market        9.27393  149.71     a minute ago
buy           market        9.207      0.29     a minute ago
sell          limit         9.27394    0.39     a minute ago
buy           limit         9.207      0.1      a minute ago
buy           market        9.2745     0.21645  2 minutes ago
buy           market        9.27409    4.32747  2 minutes ago
buy           market        9.27398  167.926    2 minutes ago
buy           market        9.27397    9.8347   2 minutes ago
buy           market        9.27396    0.1      2 minutes ago

             Price (EUR)    Volume  Age
---------  -------------  --------  -----------
Last Sell        9.207     39.6962  seconds ago
Last Buy         9.20701    0.39    seconds ago

Last ID = 1483711040526035580
Get private user data from Kraken’s API

Current user balance: clikraken balance or clikraken bal

asset      balance
-------  ---------
ETH        0.01337
EUR        0.42
XBT        0.00314

Closed orders: clikraken clist or clikraken cl

orderid              status    type       vol    vol_exec  pair    ordertype       price      cost      fee  viqc    closing_date
-------------------  --------  ------  ------  ----------  ------  -----------  --------  --------  -------  ------  -------------------
OWABCD-WQLIB-8RX2KQ  closed    buy     0.015    0.015      ETHEUR  limit         9.78333   0.14675  0.00023  False   2016-11-09 00:57:31
OL1H5E-LP5WQ-LALALA  canceled  buy     0.5      0.0887112  ETHEUR  limit        10.5887    0.93934  0.0015   False   2016-10-25 09:08:41
Custom market terminal

For example, by combining clikraken with the watch command in different screen windows, you can create your own personal exchange terminal:

For Ethereum (default currency pair):

watch -n 5 clikraken depth -c 12
watch -n 9 clikraken last_trades

And for Bitcoin:

watch -n 5 clikraken depth -c 12 -p XXBTZEUR
watch -n 9 clikraken last_trades -p XXBTZEUR

(you can omit -p XXBTZEUR on the command line by setting an environment variable like this: export CLIKRAKEN_DEFAULT_PAIR="XXBTZEUR")

Example of using clikraken to build your own customized terminal
Example of using clikraken to build your own customized terminal, here showing market depth and last trades for Ethereum (above) and Bitcoin (under)