Skip to content

Ethereal Python SDK

A Python SDK for interacting with the Ethereal DEX.

Overview

The Ethereal Python SDK provides a simple interface for trading, accessing market data, and managing accounts on the Ethereal DEX. This SDK supports both REST API and WebSocket connections.

Installation

We recommend using uv to manage your environment:

# Install uv
curl -LsSf https://astral.sh/uv/install.sh | sh

# Install the SDK
uv add ethereal-sdk

Alternatively, you can use pip:

pip install ethereal-sdk

Quick Start

The SDK provides two client types:

AsyncRESTClient (recommended):

import asyncio
from ethereal import AsyncRESTClient

async def main():
    client = await AsyncRESTClient.create({
        "base_url": "https://api.ethereal.trade",
        "chain_config": {
            "rpc_url": "https://rpc.ethereal.trade",
            "private_key": "your_private_key",  # optional - required for trading
        }
    })

    # Get market data
    products = await client.list_products()
    tokens = await client.list_tokens()

    await client.close()

asyncio.run(main())

RESTClient (Synchronous):

from ethereal import RESTClient

client = RESTClient({
    "base_url": "https://api.ethereal.trade",
    "chain_config": {
        "rpc_url": "https://rpc.ethereal.trade",
        "private_key": "your_private_key",  # optional - required for trading
    }
})

# Get market data
products = client.list_products()
tokens = client.list_tokens()

See the quickstart guide for more examples.

Key Features

  • Market Data: Access products, prices, and order book information
  • Trading: Place and manage orders
  • Account Management: Manage subaccounts and positions
  • Real-time Updates: Websocket support for live order book and fill updates