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
Hashes for Cryptostats_Python-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aae474b93bef75b381b70a18b547869057d69d0e0282cb8dc6f7a022fa71e634 |
|
MD5 | e0914d1086463ab8d16508f5953921e7 |
|
BLAKE2b-256 | 5a62e0d633bce3373d15900a2d649161c6657877c83824f597025067a1019cd7 |