Stream cryptocurrency data and analytics for 15,000+ instruments with a single websocket.
Project description
Cryptostats-Python
Cryptostats is a streaming cryptocurrency data and analytics service. You can read the documentation or visit the homepage.
This is a simple Python implementation of a Websocket to stream data, subscribe to and unsubscribe from channels.
Explore the docs »
View Example Web Platform
·
Cryptostats-Pythonrt Bug
·
Request Feature
About The Project
Cryptostats is a streaming analytics platform for cryptocurrencies. You can access analytics and normalized, multi-exchange data via API or web platform.
There are 25+ exchanges and over 15,000 instruments currently covered.
Check out the documentation or the homepage.
Built With
Getting Started
To get a local copy up and running follow these simple steps.
Prerequisites
You will need Python 3.6+.
Installation
pip install Cryptostats-Python
Usage
Subscribe to new channels using the additional subscribe and unsubscribe methods:
from CryptostatsPython.Cryptostats import Cryptostats
import time
# Configuration
API_KEY = "YOUR_API_KEY"
channels = ["deribit.BTC-PERPETUAL.trade", "BTCUSD perpetual.combined_orderbook"]
# Callbacks
def on_open(_):
print("Opened")
cryptostats.unsubscribe("deribit.BTC-PERPETUAL.trade")
cryptostats.subscribe("deribit.ETH-PERPETUAL.trade")
def on_message(message):
print(message)
def on_error(_, message):
print(message)
# Usage of reconnect code is recommended for long-running connections
def on_close(_):
print("Closed - reconnecting")
cryptostats.connect()
cryptostats = Cryptostats(API_KEY, channels, on_open, on_message, on_error, on_close)
# Event loop
while True:
time.sleep(1)
For more examples, please refer to the Documentation
Contributing
Feel free to contribute more examples or cool use cases.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
License
Distributed under the MIT License. See LICENSE for more information.
Contact
Cryptostats - hello@cryptostats.dev
Project Link: https://github.com/Cryptostats/Cryptostats-Python
Dependencies
Full dependencies are provided below:
-
Dependencies
If installing from source you will need:
pip install websocket-client
pip install ujson
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file Cryptostats-Python-1.0.0.tar.gz.
File metadata
- Download URL: Cryptostats-Python-1.0.0.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
17c5290958bd8bba7f3485022ca3b7a1450e3b5a4b83bb5e778aabf4db705db4
|
|
| MD5 |
40529073b84ab186d189cd4495938cdc
|
|
| BLAKE2b-256 |
544debe1e1652c4bca753c345d79aef29f3967bf20fd66304e4dceba22662124
|
File details
Details for the file Cryptostats_Python-1.0.0-py3-none-any.whl.
File metadata
- Download URL: Cryptostats_Python-1.0.0-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aae474b93bef75b381b70a18b547869057d69d0e0282cb8dc6f7a022fa71e634
|
|
| MD5 |
e0914d1086463ab8d16508f5953921e7
|
|
| BLAKE2b-256 |
5a62e0d633bce3373d15900a2d649161c6657877c83824f597025067a1019cd7
|