3commas websocket stream assist
Project description
three-commas-websocket-assist
GNU General Public License v3.0
pip install three-commas-websocket-assist
Import
from three-commas-websocket-assist import ThreeCommasWebsocketHandler
1. Setting up the listener
Pass 3commas api key/secret and the channel you desire to ThreeCommasWebsocketHandler:
st = ThreeCommasWebsocketHandler(
api_key=API_KEY,
api_secret=API_SECRET,
channel="DealsChannel",
)
ThreeCommasWebsocketHandler automatically generates the stream identifier and uses that for the stream
2. Handle event
Pass a custom event handler to the ThreeCommasWebsocketHandler to handle any event based on your deal channel:
Event handler is Callable[[Dict], None]
st = ThreeCommasWebsocketHandler(
api_key=API_KEY,
api_secret=API_SECRET,
channel="DealsChannel",
external_event_handler=sample_event_handler
)
Sample event handler:
def sample_event_handler(data:Dict) -> None:
"""
Sample Event Handler for websocket
"""
_LOGGER.debug("Bot_id: %s", data['bot_id'])
# Do something with the data here
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 three-commas-websocket-assist-0.1.9.tar.gz.
File metadata
- Download URL: three-commas-websocket-assist-0.1.9.tar.gz
- Upload date:
- Size: 16.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.10.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
61921faf0b9b9819687827e9642ad252980e54abfa3e59211a5e5cd1d85e772e
|
|
| MD5 |
03c6434a5e0a4dd63b021ec7869d4790
|
|
| BLAKE2b-256 |
ff63f9e7172d123ee6566f1d9071ab32c9ae9f6ac989291a1c1ea8e06a6b3996
|
File details
Details for the file three_commas_websocket_assist-0.1.9-py3-none-any.whl.
File metadata
- Download URL: three_commas_websocket_assist-0.1.9-py3-none-any.whl
- Upload date:
- Size: 17.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.10.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
65c764d5191431c364f090c71c1bc42d4fa1563e9437f2ccf48e680bab9388e7
|
|
| MD5 |
b6bd289669e0e40fdba5075a3c3cdfdf
|
|
| BLAKE2b-256 |
0311a702df342c3454884c275bf037a39164ac844b6e3cfe3ddde1d25887af1e
|