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-Go-SDK in Python:

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_price_event
async def on_price_event(event: events.DataFeed):
    print("Price 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.subscribe())

    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.1.4.tar.gz (9.9 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.1.4-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for relayer_python_sdk-0.1.4.tar.gz
Algorithm Hash digest
SHA256 9d1754252ec2eb2da4be3bc37a40eb3c8e49bb727fb8ce004949e3f669406102
MD5 c1d362555bc05b1044a49bbf62eb5267
BLAKE2b-256 1683788f59602eda93e783d15872de1fa8429d9efae04b08329e835fe2854917

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for relayer_python_sdk-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 31b4c1c2159f420a4381361fd5fdf8c5d7f23c6aa4aa800423e3e24b8a104984
MD5 77402a3df269183b035d1886fca7562d
BLAKE2b-256 d010d688af01159f3325c2eac4a4284b9b6bcc0eb73a2705cce94d71daf6d3cb

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