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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file kraken-wsclient-v2-0.0.2.tar.gz.

File metadata

  • Download URL: kraken-wsclient-v2-0.0.2.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for kraken-wsclient-v2-0.0.2.tar.gz
Algorithm Hash digest
SHA256 770095818926bc9f0ad28774a73b98b486c31e7a19334070e615866741430491
MD5 1116876e2825623dd658d44ec07b6249
BLAKE2b-256 effca2779625c4107f756cb831a84a9f625b03fdd6b126d751f4d19b69b3c2d9

See more details on using hashes here.

File details

Details for the file kraken_wsclient_v2-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for kraken_wsclient_v2-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a9e24a8aa793dfb834b9050487324b26a7bde7b4d7e88bcfaee86d3fbc31f081
MD5 9a6f2dc7717165f4e4e599c677be1b14
BLAKE2b-256 f90df5797e2e5e7fdb584598dad1523408497573abe4f05d84dcff3d2ac4332d

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