|
1 | | -<h1 align="center">Futures and Spot REST and Websocket API Python SDK for the Kraken Crypto Asset Exchange 🐙</h1> |
| 1 | +<h1 align="center">Spot, xStocks, and Futures REST and Websocket API Python SDK for the Kraken Crypto Asset Exchange 🐙</h1> |
2 | 2 |
|
3 | 3 | <div align="center"> |
4 | 4 |
|
@@ -56,10 +56,10 @@ General: |
56 | 56 |
|
57 | 57 | Available Clients: |
58 | 58 |
|
59 | | -- Spot REST Clients (sync and async) |
60 | | -- Spot Websocket Client (using Websocket API v2) |
61 | | -- Spot Orderbook Client (using Websocket API v2) |
62 | | -- Futures REST Clients (sync and async) |
| 59 | +- Spot REST Clients - including xStocks capability |
| 60 | +- Spot Websocket Client (Websocket API v2) |
| 61 | +- Spot Orderbook Client (Websocket API v2) |
| 62 | +- Futures REST Clients |
63 | 63 | - Futures Websocket Client |
64 | 64 |
|
65 | 65 | Documentation: |
@@ -91,6 +91,7 @@ new releases. |
91 | 91 | - [ Installation and setup ](#installation) |
92 | 92 | - [ Command-line interface ](#cliusage) |
93 | 93 | - [ Spot Clients ](#spotusage) |
| 94 | +- [ xStocks ](#xstocksusage) |
94 | 95 | - [ Futures Clients ](#futuresusage) |
95 | 96 | - [ Troubleshooting ](#trouble) |
96 | 97 | - [ Contributions ](#contribution) |
@@ -315,6 +316,57 @@ if __name__ == "__main__": |
315 | 316 | asyncio.run(main()) |
316 | 317 | ``` |
317 | 318 |
|
| 319 | +<a name="xstocksusage"></a> |
| 320 | +
|
| 321 | +# 📍 xStocks |
| 322 | +
|
| 323 | +Kraken recently added support for trading of tokenized stocks (xStocks) on their |
| 324 | +platform. The python-kraken-sdk fully supports this new feature, allowing users |
| 325 | +to trade xStocks seamlessly alongside other crypto assets. |
| 326 | +
|
| 327 | +For accessing xStocks, you can use the same `SpotClient` and `SpotAsyncClient` |
| 328 | +classes that are used for regular spot trading. The endpoints and methods for |
| 329 | +xStocks are integrated into these clients, making it easy to manage your xStock |
| 330 | +trades. |
| 331 | +
|
| 332 | +It is important to note that the xStocks feature is not available globally. Please |
| 333 | +check Kraken's documentation to understand the availability zones and ensure |
| 334 | +that you can trade xStocks from your location. |
| 335 | +
|
| 336 | +For trading or filtering for xStocks assets, the new asset class |
| 337 | +`tokenized_asset` must be used, e.g. when creating an order: |
| 338 | +
|
| 339 | +```python |
| 340 | + from kraken.spot import SpotClient, Trade |
| 341 | +
|
| 342 | + # Option 1: Create an order using the SpotClient directly: |
| 343 | + client = SpotClient(key="api-public-key", secret="api-secret-key") |
| 344 | + client.request( |
| 345 | + method="POST", |
| 346 | + uri="/0/private/AddOrder", |
| 347 | + params={ |
| 348 | + "type": "buy", |
| 349 | + "volume": "1", |
| 350 | + "ordertype": "limit", |
| 351 | + "pair": "AAPLxUSD", |
| 352 | + "price": "100.0", |
| 353 | + "validate": True, |
| 354 | + "asset_class": "tokenized_asset", # <- important! |
| 355 | + }, |
| 356 | + ) |
| 357 | + # Option 2: Create an order using the Trade client: |
| 358 | + trade = Trade(key="api-public-key", secret="api-secret-key") |
| 359 | + trade.create_order( |
| 360 | + pair="AAPLxUSD", |
| 361 | + side="buy", |
| 362 | + ordertype="limit", |
| 363 | + volume="1", |
| 364 | + price="100.0", |
| 365 | + validate=True, |
| 366 | + extra_params={"asset_class": "tokenized_asset"}, # <- important! |
| 367 | + ) |
| 368 | +``` |
| 369 | +
|
318 | 370 | <a name="futuresusage"></a> |
319 | 371 |
|
320 | 372 | # 📍 Futures Clients |
@@ -475,6 +527,8 @@ if __name__ == "__main__": |
475 | 527 | keys will result in invalid nonce errors. |
476 | 528 | - Always keep an eye on https://status.kraken.com/ when encountering |
477 | 529 | connectivity problems. |
| 530 | +- The xStocks feature is not available globally. Please checkout Kraken's |
| 531 | + documentation to get to know the availability zones. |
478 | 532 |
|
479 | 533 | --- |
480 | 534 |
|
|
0 commit comments