Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

three-commas-websocket-assist-0.1.4.tar.gz (16.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

three_commas_websocket_assist-0.1.4-py3-none-any.whl (17.0 kB view details)

Uploaded Python 3

File details

Details for the file three-commas-websocket-assist-0.1.4.tar.gz.

File metadata

File hashes

Hashes for three-commas-websocket-assist-0.1.4.tar.gz
Algorithm Hash digest
SHA256 60863c6975edb3956f83621c26d902091c9896d5a78ed5e32cc4701e23ed4085
MD5 5c9978e3a3cbb13aea80e9e68f43a417
BLAKE2b-256 ccee007f9e1d0b207f41ccba1f0bef40d4359cb709d246a49c652baf5df8fd1e

See more details on using hashes here.

File details

Details for the file three_commas_websocket_assist-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for three_commas_websocket_assist-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 e3199f7c958d7bffa556f40c81ae1cbb9d1d0dc5eff8332b5a968b49025462ea
MD5 2d3185f0b8343a85f8912d5b9417731e
BLAKE2b-256 bb284429f9c9479404d532d0161fd80623204c51156dd4cc1ddf60a97ae6dc8c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page