@@ -45,24 +45,25 @@ regarding the use of this software.
4545
4646## Features
4747
48- Available Clients:
49-
50- - NFT REST Clients
51- - Spot REST Clients
52- - Spot Websocket Clients (Websocket API v1 and v2)
53- - Spot Orderbook Clients (Websocket API v1 and v2)
54- - Futures REST Clients
55- - Futures Websocket Client
56-
5748General:
5849
50+ - command-line interface
5951- access both public and private, REST and websocket endpoints
6052- responsive error handling and custom exceptions
6153- extensive example scripts (see ` /examples ` and ` /tests ` )
6254- tested using the [ pytest] ( https://docs.pytest.org/en/7.3.x/ ) framework
6355- releases are permanently archived at [ Zenodo] ( https://zenodo.org/badge/latestdoi/510751854 )
6456- releases before v2.0.0 also support Python 3.7+
6557
58+ Available Clients:
59+
60+ - NFT REST Clients
61+ - Spot REST Clients
62+ - Spot Websocket Clients (Websocket API v1 and v2)
63+ - Spot Orderbook Clients (Websocket API v1 and v2)
64+ - Futures REST Clients
65+ - Futures Websocket Client
66+
6667Documentation:
6768
6869- [ https://python-kraken-sdk.readthedocs.io/en/stable ] ( https://python-kraken-sdk.readthedocs.io/en/stable )
@@ -84,6 +85,8 @@ new releases.
8485## Table of Contents
8586
8687- [ Installation and setup ] ( #installation )
88+ - [ Command-line interface ] ( #cliusage )
89+ - [ SDK Usage Hints ] ( #sdkusage )
8790- [ Spot Clients ] ( #spotusage )
8891 - [ REST API] ( #spotrest )
8992 - [ Websocket API V2] ( #spotws )
@@ -96,8 +99,6 @@ new releases.
9699- [ Notes ] ( #notes )
97100- [ References ] ( #references )
98101
99- ---
100-
101102<a name =" installation " ></a >
102103
103104# 🛠 Installation and setup
@@ -123,7 +124,59 @@ API permissions</b>, <b style="color: yellow">rate limits</b>, update the
123124python-kraken-sdk, see the [ Troubleshooting] ( #trouble ) section, and if the error
124125persists please open an issue.
125126
126- ---
127+ <a name =" cliusage " ></a >
128+
129+ # 📍 Command-line interface
130+
131+ The python-kraken-sdk provides a command-line interface to access the Kraken API
132+ using basic instructions while performing authentication tasks in the
133+ background. The Spot, NFT and Futures API are accessible and follow the pattern
134+ ` kraken {spot,futures} [OPTIONS] URL ` . See examples below.
135+
136+ ``` bash
137+ # get server time
138+ kraken spot https://api.kraken.com/0/public/Time
139+ {' unixtime' : 1716707589, ' rfc1123' : ' Sun, 26 May 24 07:13:09 +0000' }
140+
141+ # get user's balances
142+ kraken spot --api-key=< api-key> --secret-key=< secret-key> -X POST https://api.kraken.com/0/private/Balance
143+ {' ATOM' : ' 17.28229999' , ' BCH' : ' 0.0000077100' , ' ZUSD' : ' 1000.0000' }
144+
145+ # get user's trade balances
146+ kraken spot --api-key=< api-key> --secret-key=< secret-key> -X POST https://api.kraken.com/0/private/TradeBalance --data ' {"asset": "DOT"}'
147+ {' 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' }
148+
149+ # get 1D candles for a futures instrument
150+ kraken futures https://futures.kraken.com/api/charts/v1/spot/PI_XBTUSD/1d
151+ {' candles' : [{' time' : 1625616000000, ' open' : ' 34557.84000000000' , ' high' : ' 34803.20000000000' , ' low' : ' 33816.32000000000' , ' close' : ' 33880.22000000000' , ' volume' : ' 0' ...
152+
153+ # get user's open futures positions
154+ kraken futures --api-key=< api-key> --secret-key=< secret-key> https://futures.kraken.com/derivatives/api/v3/openpositions
155+ {' result' : ' success' , ' openPositions' : [], ' serverTime' : ' 2024-05-26T07:15:38.91Z' }
156+ ` ` `
157+
158+ ... All endpoints of the Kraken Spot and Futurs API can be accessed like that.
159+
160+ < a name=" sdkusage" ></a>
161+
162+ # 📍 SDK Usage Hints
163+
164+ The python-kraken-sdk provides lots of functions to easily access most of the
165+ REST and websocket endpoints of the Kraken Cryptocurrency Exchange API. Since
166+ these endpoints and their parameters may change, all implemented endpoints are
167+ tested on a regular basis.
168+
169+ If certain parameters or settings are not available, or
170+ specific endpoints are hidden and not implemented, it is always possible to
171+ execute requests to the endpoints directly using the ` _request` method provided
172+ by any client. This is demonstrated below.
173+
174+ ` ` ` python
175+ from kraken.spot import User
176+
177+ user = User(key=" <your-api-key>" , secret=" <your-secret-key>" )
178+ print(user._request(method=" POST" , uri=" /0/private/Balance" ))
179+ ` ` `
127180
128181< a name=" spotusage" ></a>
129182
0 commit comments