HitBTC Websocket API Client
Project description
hitbtc_wss
HitBTC Websocket API 2.0 Client written in Python 3.
Forked from Crypto-toolbox/hitbtc_wss. At the time of this writing, Crypto-toolbox had not accepted a pull request into his repo in 7 months. Seems like they might have moved on to do other things. I figured I'd pick the ball up and run with it.
Release History
| Date | Description |
|---|---|
| 09/02/2018 | Published bug fix to PyPi so the login method works with HitBTC v2 login method. |
The client supplies data both visually via console, as well as python objects via its HitBTC.recv().
It's important to note that this does not receive data from the API directly -
instead, the data is pulled from a queue.Queue object, which defaults to a length of
100 items. So only the last 100 messages will be cached - either make sure you process the messages
fast enough, or increase the length of the queue (can be done by passing the q_maxsize kwarg on
instantiation).
By default, data is unpacked - that means you will never see the raw JSONRPC message
(this, too, can be turned off by passing raw=True upon initialization). This will, however, also
turn off all handling of error messages etc.
For an in-depth description of the client and its methods, please see the documenation at readthedocs.org
Installation
Stable: pip install hitbtc_wss
Release Candidate: pip install --pre hitbtc_wss
Example Usage
import time
import queue
from hitbtc_wss import HitBTC
c = HitBTC()
c.start() # start the websocket connection
time.sleep(2) # Give the socket some time to connect
c.subscribe_ticker(symbol='ETHBTC') # Subscribe to ticker data for the pair ETHBTC
while True:
try:
data = c.recv()
except queue.Empty:
continue
# process data from websocket
...
c.stop()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file hitbtc_wss-1.0.6.tar.gz.
File metadata
- Download URL: hitbtc_wss-1.0.6.tar.gz
- Upload date:
- Size: 9.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
636e8301413df09d10535ce73dcc61f984528f2621039040f51df8fa904386e5
|
|
| MD5 |
b66e4b872bdfaf3d1a21f319421bcd93
|
|
| BLAKE2b-256 |
8a4004ca651ead2343f076119e6e69f8f6c5ac1631c3eb4cd5b001ffef103f92
|