{"id":21819,"library":"python-kraken-sdk","title":"python-kraken-sdk","description":"A comprehensive Python SDK for the Kraken cryptocurrency exchange, providing both REST and WebSocket clients for Spot and Futures trading. Version 3.2.8 requires Python >=3.11. Released monthly.","status":"active","version":"3.2.8","language":"python","source_language":"en","source_url":"https://github.com/btschwertfeger/python-kraken-sdk","tags":["kraken","cryptocurrency","exchange","api","trading","websocket"],"install":[{"cmd":"pip install python-kraken-sdk","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"Primary client for Spot REST API.","symbol":"KrakenSpot","correct":"from kraken.spot import KrakenSpot"},{"note":"Primary client for Futures REST API.","symbol":"KrakenFutures","correct":"from kraken.futures import KrakenFutures"},{"note":"WebSocket client for Spot data.","symbol":"KrakenSpotWS","correct":"from kraken.spot import KrakenSpotWS"},{"note":"Common mistake: Market lives under kraken.spot, not top-level.","wrong":"from kraken import Market","symbol":"Market","correct":"from kraken.spot import Market"}],"quickstart":{"code":"import os\nfrom kraken.spot import KrakenSpot\n\napi_key = os.environ.get('KRAKEN_API_KEY', '')\nsecret_key = os.environ.get('KRAKEN_SECRET_KEY', '')\n\nclient = KrakenSpot(api_key=api_key, secret_key=secret_key)\nprint(client.get_account_balance())","lang":"python","description":"Initialize a Spot client and fetch account balance (requires API keys)."},"warnings":[{"fix":"Use `from kraken.spot import Market` instead.","message":"In v3.x, the package structure changed: all modules are under `kraken.spot` and `kraken.futures`. Previously, top-level imports like `from kraken import Market` no longer work.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Always use context managers or try/finally to connect and disconnect.","message":"WebSocket clients (KrakenSpotWS, KrakenFuturesWS) require explicit connection and disconnection. Using them without calling `connect()` or forgetting `stop()` can cause resource leaks.","severity":"gotcha","affected_versions":"all"},{"fix":"Replace `async_close()` or `stop()` with `disconnect()`.","message":"Methods `async_close` and `stop` on websocket clients are deprecated in v3.1.6+. Use `disconnect()` instead.","severity":"deprecated","affected_versions":">=3.1.6"},{"fix":"Upgrade to >=3.2.2 or pass `stptype` manually if using older version.","message":"The `create_order` parameter `stp_type` must be sent as `stptype` to the API. In v3.2.2, the SDK incorrectly used `stp_type`. This was fixed in v3.2.2+.","severity":"gotcha","affected_versions":"<3.2.2"},{"fix":"Use Python 3.11 or later.","message":"In v3.0.0, the minimum Python version was raised to 3.11. Python 3.10 and below are no longer supported.","severity":"breaking","affected_versions":">=3.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run `pip install python-kraken-sdk` and use `from kraken.spot import KrakenSpot`.","cause":"Package not installed or wrong import path.","error":"ModuleNotFoundError: No module named 'kraken'"},{"fix":"Use `from kraken.spot import Market`.","cause":"Trying to import Market from top-level kraken, which was valid in v2.x but not in v3.x.","error":"AttributeError: module 'kraken' has no attribute 'Market'"},{"fix":"Check parameter names against Kraken API documentation. For v<3.2.2, use 'stptype' explicitly.","cause":"Missing or incorrect API parameters (e.g., 'stp_type' instead of 'stptype' in older versions).","error":"kraken.exceptions.KrakenException: EGeneral:Invalid arguments"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}