Skip to main content

Python SDK for interacting with the Relayer WS API

Project description

Relayer-Python-SDK CC BY-NC-SA 4.0

Relayer-Go-SDK by Yggdrasil-Protocol is licensed under CC BY-NC-SA 4.0

Example

Here is an example of how to use the Relayer-Python-SDK:

import asyncio
from relayer_python_sdk.ws import RelayerWS
from relayer_python_sdk import events

feedIDs = ["SPOT:BTC_USDT", "SPOT:ETH_USDT"]
ws = RelayerWS(feedIDs)


@ws.on_data_event
async def on_data_event(event: events.DataFeed):
    print("Data Feed Event:", event)


@ws.on_info_event
async def on_info_event(event: events.SubscriptionMsg):
    print("Info event:", event)


async def main():
    sub_task = asyncio.create_task(ws.connect())

    await asyncio.sleep(10)
    await ws.close()

    await sub_task


if __name__ == "__main__":
    asyncio.run(main())

This code will subscribe to the data feeds SPOT:BTC_USDT and SPOT:ETH_USDT and print the price events and info events.

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

relayer_python_sdk-0.2.5.tar.gz (10.0 kB view details)

Uploaded Source

Built Distribution

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

relayer_python_sdk-0.2.5-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file relayer_python_sdk-0.2.5.tar.gz.

File metadata

  • Download URL: relayer_python_sdk-0.2.5.tar.gz
  • Upload date:
  • Size: 10.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.1 Linux/6.5.0-1025-azure

File hashes

Hashes for relayer_python_sdk-0.2.5.tar.gz
Algorithm Hash digest
SHA256 2b3cc8bd431cfb2626d611e3fbd1dcbd66a0165f1f4d390aaeafb90abd169b54
MD5 13305cf0ebcaaf81c3cf504445519957
BLAKE2b-256 0475d85518615d3e7dc3d7b508a8baf1fcd8f2f64547f84d9ecf975acd64a43a

See more details on using hashes here.

File details

Details for the file relayer_python_sdk-0.2.5-py3-none-any.whl.

File metadata

  • Download URL: relayer_python_sdk-0.2.5-py3-none-any.whl
  • Upload date:
  • Size: 11.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.1 Linux/6.5.0-1025-azure

File hashes

Hashes for relayer_python_sdk-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 b0d3173c243fd4185a91b07c53cfd9bc51c9dec312113768c27c7666bc9e7550
MD5 dec15768c8b681dcd69346fa15192304
BLAKE2b-256 2878a979b95b57a6f452685c94cbf08e5831ef4873993f01427eed4a15f84709

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