Skip to main content

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!

Metadata

Release files for kucoin-websocket 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kucoin-websocket 1.0.3
File Size Uploaded
kucoin_websocket-1.0.3.tar.gz 8.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for kucoin-websocket 1.0.3
File Interpreter ABI Platform
kucoin_websocket-1.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 17.5 kB

Release files / kucoin_websocket-1.0.3.tar.gz

Download URL kucoin_websocket-1.0.3.tar.gz
Size 8.7 kB
Tags Source
SHA-256 checksum
How to use checksums
de509420039ad60f2618381d921a92683ddb99bf8d7a87c0a53a29ba3afc1ec2
BLAKE2b-256 checksum
How to use checksums
58643874f649d96239df1bafc98cb046a8cbdb3eacf48c491ab23d8da073771d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.10

Release files / kucoin_websocket-1.0.3-py3-none-any.whl

Download URL kucoin_websocket-1.0.3-py3-none-any.whl
Size 8.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5e69ebcf735dc13801e600f6f9cc39c5e77aaac5aed2df18749a2bb6eaebc0f6
BLAKE2b-256 checksum
How to use checksums
8e60e94ea63ac00a66747f83a252f74e9a13a13014843ad990a486c38547d260
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.10

Release history Release notifications | RSS feed

This release

1.0.3 This release

2 release files

1.0.2

2 release files

1.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page