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:
If installing from source you will need:
pip install websocket-client
pip install ujson
Metadata
Release files for Cryptostats-Python 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| Cryptostats-Python-1.0.0.tar.gz | 4.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| Cryptostats_Python-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.6 kB
Release files / Cryptostats-Python-1.0.0.tar.gz
| Download URL | Cryptostats-Python-1.0.0.tar.gz |
|---|---|
| Size | 4.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
17c5290958bd8bba7f3485022ca3b7a1450e3b5a4b83bb5e778aabf4db705db4
|
|
BLAKE2b-256 checksum How to use checksums |
544debe1e1652c4bca753c345d79aef29f3967bf20fd66304e4dceba22662124
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / Cryptostats_Python-1.0.0-py3-none-any.whl
| Download URL | Cryptostats_Python-1.0.0-py3-none-any.whl |
|---|---|
| Size | 5.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
aae474b93bef75b381b70a18b547869057d69d0e0282cb8dc6f7a022fa71e634
|
|
BLAKE2b-256 checksum How to use checksums |
5a62e0d633bce3373d15900a2d649161c6657877c83824f597025067a1019cd7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|