krakenex

raw JSON →
2.2.2 verified Fri May 01 auth: no python

Python client for the Kraken cryptocurrency exchange REST API. Current version 2.2.2, stable with infrequent releases. Supports Python >=3.3.

pip install krakenex
error ModuleNotFoundError: No module named 'krakenex'
cause The package is installed under a different name or not installed.
fix
Run pip install krakenex. Ensure the correct import statement: import krakenex.
error connect() got an unexpected keyword argument 'headers'
cause Library version incompatibility with requests library in older Python versions (pre-2.2.0).
fix
Upgrade krakenex: pip install --upgrade krakenex. If persists, pin requests>=2.22.0.
error AttributeError: module 'krakenex' has no attribute 'API'
cause Outdated version (<2.0.0) that used a different API class.
fix
Upgrade krakenex: pip install --upgrade krakenex. Old code should use krakenex.API if upgraded.
breaking Version 2.0.0 changed the API constructor to require no arguments; old code using `API('key','secret')` will break.
fix Use `api.load_key('filename')` or `api.key = '...'; api.secret = '...'`.
gotcha The library does not set a User-Agent header by default; Kraken may reject requests.
fix Set `api.user_agent = 'MyApp/1.0'` after creating API instance.
deprecated The `Trade` module is deprecated and may be removed in a future release. Use the raw API methods instead.
fix Use `api.query_public('Trades', {'pair': 'XBTUSD'})` instead of `Trade().get_trades('XBTUSD')`.

Initialize API, load key file, query private endpoint.

import krakenex

api = krakenex.API()
api.load_key('kraken.key')
print(api.query_private('Balance'))