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.9.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.9-py3-none-any.whl (17.0 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for three-commas-websocket-assist-0.1.9.tar.gz
Algorithm Hash digest
SHA256 61921faf0b9b9819687827e9642ad252980e54abfa3e59211a5e5cd1d85e772e
MD5 03c6434a5e0a4dd63b021ec7869d4790
BLAKE2b-256 ff63f9e7172d123ee6566f1d9071ab32c9ae9f6ac989291a1c1ea8e06a6b3996

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for three_commas_websocket_assist-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 65c764d5191431c364f090c71c1bc42d4fa1563e9437f2ccf48e680bab9388e7
MD5 b6bd289669e0e40fdba5075a3c3cdfdf
BLAKE2b-256 0311a702df342c3454884c275bf037a39164ac844b6e3cfe3ddde1d25887af1e

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