Skip to main content

Sample Kraken WebSockets client V2

Project description

Kraken WebSockets Client v2 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-v2

Sample Usage

import time

from kraken_wsclient_v2 import kraken_wsclient_v2 as client

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

my_websockets_token = ''

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

# Sample public-data subscription:

my_client.subscribe_public(
    # Insert params and req_id as described in the docs
    params = {
        'channel': 'ticker',
        'snapshot': True,
        'symbol': ['BTC/USD', 'XRP/USD'],
    },
    req_id = 1234567890,
    callback = my_handler
)

time.sleep(3)

# Sample private-data subscription:

my_client.subscribe_private(
    # Insert params and req_id as described in the docs
    params = {
        'channel': 'executions',
        'snapshot': True,
        'snapshot_trades': True,
        'order_status': True,
        'ratecounter': True,
        'token': my_websockets_token
    },
    req_id = 1234567891,
    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-v2-0.0.2.tar.gz (4.6 kB view hashes)

Uploaded Source

Built Distribution

kraken_wsclient_v2-0.0.2-py3-none-any.whl (4.9 kB view hashes)

Uploaded Python 3

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