CCXW - CryptoCurrency eXchange Websocket Library
This library is designed to fetch data from exchange WebSocket APIs and store or update data in a temporary SQLite database in the background, making it readily accessible for retrieval.
Currently, it is available for several exchanges, including Binance, Bybit, and more. You can find a complete list of supported exchanges using Ccxw.get_supported_exchanges().
Furthermore, the library supports a variety of endpoints, such as order_book, kline, and more. A comprehensive list of supported endpoints can be found via Ccxw.get_supported_endpoints().
Example
Install
pip install ccxw
Use
import time
import pprint
from ccxw import Ccxw
symbol = 'BTC/USDT'
streams = [\
{\
'endpoint': 'order_book',\
'symbol': symbol
},\
{\
'endpoint': 'kline',\
'symbol': symbol,\
'interval': interval\
},\
{\
'endpoint': 'trades',\
'symbol': symbol
},\
{\
'endpoint': 'ticker',\
'symbol': symbol
}\
]
wsm = Ccxw('binance',\
streams,\
result_max_len=5,\
data_max_len=10)
wsm.start() # Start getting data
time.sleep(2) # Wait for available data
for i in range(0, 10):
for stream in streams:
interval = 'none'
if 'interval' in stream:
interval = stream['interval']
data = wsm.get_current_data(stream['endpoint'], stream['symbol'], interval)
pprint.pprint(data, sort_dicts=False)
print('----------------------------------')
time.sleep(1)
print('============================================================')
wsm.stop() # Stop getting data
Important Information
Please be aware that each instance opens a new connection to websockets. If you create multiple instances for the same exchange, you may exceed the websockets connection limits set by exchanges. Make sure to check the connection limits of exchanges before opening numerous instances.
Metadata
Release files for ccxw 0.2.37
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ccxw-0.2.37.tar.gz | 52.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ccxw-0.2.37-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 104.6 kB
Release files / ccxw-0.2.37.tar.gz
| Download URL | ccxw-0.2.37.tar.gz |
|---|---|
| Size | 52.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
180160b071b111a60a35ffbc2fdeea190236c6b8642ef50505e550977efe052f
|
|
BLAKE2b-256 checksum How to use checksums |
8a49d0a348ce4fb025763e7d7682a845f0dd90dedad95b4d2c3c82ed5e59abcc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Release files / ccxw-0.2.37-py3-none-any.whl
| Download URL | ccxw-0.2.37-py3-none-any.whl |
|---|---|
| Size | 51.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
082333f466b5bda06f5339772310351a4fe0b451ebdb857111aa6b3afce80032
|
|
BLAKE2b-256 checksum How to use checksums |
83866c21ec862abeaef74703a3129600e4fa8f988f742be02c047f853e439c83
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|