Skip to main content

Faster deployment is what we want!

Project description

kucoin-websocket

Multi-threaded KuCoin WebSocket with self-management mechanisms to ensure stable streaming at all times. More control and abstraction than the native kucoin-python-sdk.

Note This package is still under development and probably will not contain the full functionality described under KuCoin documentation!

Features

Subscription Strategy

According to KuCoin documentations, maximum number of batch subscriptions is 100 topics per 10 seconds. KuCoin policy is to ignore the rest of the subscriptions if the limitation is violated. To avoid this behavior, a configurable Backoff Strategy is used to keep congestion low while allowing for asynchronous subscription.

Auto-connect on Errors

There are numerous errors that can occur during the stream (KuCoin errors) that can interrupt the stream flow. Most of the errors are TimeOut or ConnectionClosed and such errors are generally not a big concern due to network volatility, so the WebSocket tries to reconnect at most 5 times before giving up.

Auto-Token Renewal

Currently, KuCoin tokens expire after 24 hours (KuCoin FAQ) and the stream is stopped immediately. To overcome this, WebSocket details like token and endpoint are renewed after an interval, so that the connection stays alive at all time. Default interval is set to 12 hours to leave no room for error.

Limitless Subscriptions

KuCoin has a limitation of maximum 300 active subscriptions at the time (KuCoin FAQ). To scale the subscriptions, multiple WebSockets are automatically created on parallel threads that at most 200 subscriptions. (to my experience, better not challenge the threshold ^_^)

Credits

🤝 Contribution

Your contributions are welcomed, as always!

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

kucoin_websocket-1.0.3.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

kucoin_websocket-1.0.3-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file kucoin_websocket-1.0.3.tar.gz.

File metadata

  • Download URL: kucoin_websocket-1.0.3.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.10

File hashes

Hashes for kucoin_websocket-1.0.3.tar.gz
Algorithm Hash digest
SHA256 de509420039ad60f2618381d921a92683ddb99bf8d7a87c0a53a29ba3afc1ec2
MD5 166efc8961a176be8df9dc5575fb302d
BLAKE2b-256 58643874f649d96239df1bafc98cb046a8cbdb3eacf48c491ab23d8da073771d

See more details on using hashes here.

File details

Details for the file kucoin_websocket-1.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for kucoin_websocket-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 5e69ebcf735dc13801e600f6f9cc39c5e77aaac5aed2df18749a2bb6eaebc0f6
MD5 435fafa5c6414c61c937064412b7dc1c
BLAKE2b-256 8e60e94ea63ac00a66747f83a252f74e9a13a13014843ad990a486c38547d260

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