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

Uploaded Source

Built Distribution

kucoin_websocket-1.0.3-py3-none-any.whl (8.8 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