Skip to main content

Sample Kraken WebSockets client

Project description

Kraken WebSockets Client in Python

Sample Kraken WebSockets client in Python. This client was created for demonstration purposes only. It is neither maintained nor supported.

Installation

pip install kraken-wsclient-py

Sample Usage

from kraken_wsclient_py import kraken_wsclient_py as client

def my_handler(message):
    # Here you can do stuff with the messages
    print(message)

my_client = client.WssClient()
my_client.start()

# Sample public-data subscription:

my_client.subscribe_public(
    subscription = {
        'name': 'trade'
    },
    pair = ['XBT/USD', 'XRP/USD'],
    callback = my_handler
)

# Sample private-data subscription:

my_client.subscribe_private(
    subscription = {
        'name': 'openOrders',
        'token': '__WS_TOKEN_HERE__'
    },
    callback = my_handler
)

# Sample order-entry call:

my_client.request(
    request = {
        'token': '__WS_TOKEN_HERE__',
        'event': 'addOrder',
        'type': 'buy',
        'ordertype': 'limit',
        'pair': 'XBT/USD',
        'price': '9000',
        'volume': '0.01',
        'userref': '666'
    },
    callback = my_handler
)

Compatibility

This code has been tested on Python 3.7.

Contributing

Pull requests are not monitored and likely will be ignored.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kraken-wsclient-py-0.0.9.tar.gz (4.0 kB view details)

Uploaded Source

File details

Details for the file kraken-wsclient-py-0.0.9.tar.gz.

File metadata

  • Download URL: kraken-wsclient-py-0.0.9.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.7.0

File hashes

Hashes for kraken-wsclient-py-0.0.9.tar.gz
Algorithm Hash digest
SHA256 cc80aab5e048616a2f592e423d82273c9f4cb2421b8b4fd25776bdd7996ecc77
MD5 43f6b8d1c8819f21b4c0ef1c0d91c9b5
BLAKE2b-256 1b78b4a060af43031ba2f4a8bffcfc2dce827f5700be4a4466324b13bd341306

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page