Skip to content

Meridian Python SDK

PyPI version Python versions Downloads

A Python SDK for interacting with the Meridian DEX.

Overview

The Meridian Python SDK provides a simple interface for trading, accessing market data, and managing accounts on the Meridian 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 meridian-exchange

Alternatively, you can use pip:

pip install meridian-exchange

View the source code on PyPI.

Quick Start

The SDK provides two client types:

AsyncRESTClient (recommended):

import asyncio
from meridian import AsyncRESTClient

async def main():
    client = await AsyncRESTClient.create({
        "base_url": "https://api.meridian.xyz",
        "chain_config": {
            "rpc_url": "https://rpc.mainnet.chain.robinhood.com",
            "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 meridian import RESTClient

client = RESTClient({
    "base_url": "https://api.meridian.xyz",
    "chain_config": {
        "rpc_url": "https://rpc.mainnet.chain.robinhood.com",
        "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 streams for live market data and order updates