# 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
```bash
pip install ccxw
```
###Use
```python
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.
[View License](LICENSE)
Raw data
{
"_id": null,
"home_page": "https://github.com/rmalvarezkai/ccxw",
"name": "ccxw",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": null,
"author": "Ricardo Marcelo Alvarez",
"author_email": "rmalvarezkai@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/73/a5/a7626e79178e19004dc6e2cc56c21f0e0756c9fd97cb40f4e3778d5aead1/ccxw-0.2.9.tar.gz",
"platform": null,
"description": "\n# CCXW - CryptoCurrency eXchange Websocket Library\n\nThis 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. \n\nCurrently, 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()`.\n\nFurthermore, 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()`.\n\n## Example:\n\n###Install\n```bash\npip install ccxw\n```\n###Use\n\n```python\nimport time\nimport pprint\nfrom ccxw import Ccxw\n\nsymbol = 'BTC/USDT'\n\nstreams = [\\\n {\\\n 'endpoint': 'order_book',\\\n 'symbol': symbol\n },\\\n {\\\n 'endpoint': 'kline',\\\n 'symbol': symbol,\\\n 'interval': interval\\\n },\\\n {\\\n 'endpoint': 'trades',\\\n 'symbol': symbol\n },\\\n {\\\n 'endpoint': 'ticker',\\\n 'symbol': symbol\n }\\\n ]\n\nwsm = Ccxw('binance',\\\n streams,\\\n result_max_len=5,\\\n data_max_len=10)\n\nwsm.start() # Start getting data\n\ntime.sleep(2) # Wait for available data\n\nfor i in range(0, 10):\n for stream in streams:\n interval = 'none'\n if 'interval' in stream:\n interval = stream['interval']\n data = wsm.get_current_data(stream['endpoint'], stream['symbol'], interval)\n pprint.pprint(data, sort_dicts=False)\n print('----------------------------------')\n time.sleep(1)\n print('============================================================')\n\nwsm.stop() # Stop getting data\n```\n\n### Important Information\n\nPlease 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.\n\n[View License](LICENSE)\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Ccxw - CryptoCurrency eXchange Websocket Library",
"version": "0.2.9",
"project_urls": {
"Homepage": "https://github.com/rmalvarezkai/ccxw"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "71591c2f307aa5867f42a4f629f4d094c8ab08096afd43fc60d549ccbaef45f0",
"md5": "b3bea45a825c37327c9f6fe4b046b730",
"sha256": "4c5d61907f34d155462dd290fc52c17510781c9956ae45b08ebe668c2b0d2d73"
},
"downloads": -1,
"filename": "ccxw-0.2.9-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b3bea45a825c37327c9f6fe4b046b730",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 43031,
"upload_time": "2024-11-09T19:39:55",
"upload_time_iso_8601": "2024-11-09T19:39:55.650391Z",
"url": "https://files.pythonhosted.org/packages/71/59/1c2f307aa5867f42a4f629f4d094c8ab08096afd43fc60d549ccbaef45f0/ccxw-0.2.9-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "73a5a7626e79178e19004dc6e2cc56c21f0e0756c9fd97cb40f4e3778d5aead1",
"md5": "de94e2ce21c57ebd7b122b51621a1f24",
"sha256": "84ed20e24ffcaf075ae83fa0a7def8ef3013e6f2923dbffb42043cfcf76ebfcc"
},
"downloads": -1,
"filename": "ccxw-0.2.9.tar.gz",
"has_sig": false,
"md5_digest": "de94e2ce21c57ebd7b122b51621a1f24",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 39468,
"upload_time": "2024-11-09T19:39:57",
"upload_time_iso_8601": "2024-11-09T19:39:57.717857Z",
"url": "https://files.pythonhosted.org/packages/73/a5/a7626e79178e19004dc6e2cc56c21f0e0756c9fd97cb40f4e3778d5aead1/ccxw-0.2.9.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-09 19:39:57",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "rmalvarezkai",
"github_project": "ccxw",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "ccxw"
}