Skip to main content

Paradex Python SDK

Release Build status codecov Commit activity License

Paradex Python SDK provides a simple interface to interact with the Paradex REST and WS API.

Examples

L1 + L2 Authentication (Traditional)

from paradex_py import Paradex
from paradex_py.environment import Environment

paradex = Paradex(env=Environment.TESTNET, l1_address="0x...", l1_private_key="0x...")
print(hex(paradex.account.l2_address)) # 0x...
print(hex(paradex.account.l2_public_key)) # 0x...
print(hex(paradex.account.l2_private_key)) # 0x...

The L2 address comes from GET /onboarding, so it matches the account the Paradex app created for the same key, legacy or current account class. To derive it locally instead (no extra request), pass server_derive_address=False; that computes the legacy proxy-class address, which is wrong for accounts created with the current class. When the server's address is not the legacy one, the SDK logs a warning naming both.

When this onboards a new account, the L1 key (or Ledger) also signs a Sign-In with Ethereum message linking the wallet as the account's parent, sent in the PARADEX-PARENT-SIWE-MESSAGE and PARADEX-PARENT-SIGNATURE headers. An account that already exists, one onboarded with only an L2 key, or one onboarded by calling onboarding() yourself with auto_auth=False signs nothing extra; the SDK drops the L1 key once init_account returns.

L2-Only Authentication (Subkey)

from paradex_py import ParadexSubkey
from paradex_py.environment import Environment

# Use ParadexSubkey for L2-only authentication
paradex = ParadexSubkey(
    env=Environment.TESTNET,
    l2_private_key="0x...",
    l2_address="0x..."
)
print(hex(paradex.account.l2_address)) # 0x...
print(hex(paradex.account.l2_public_key)) # 0x...
print(hex(paradex.account.l2_private_key)) # 0x...

L2 Key Held Elsewhere (External Signer)

from paradex_py.account import ExternalSignerAccount, HeaderSigner
from paradex_py.api.api_client import ParadexApiClient
from paradex_py.environment import TESTNET

# A signing proxy holds the L2 key and signs each request on its way to Paradex
client = ParadexApiClient(env=TESTNET, api_base_url="https://your-signing-proxy/v1")
account = ExternalSignerAccount(
    config=client.fetch_system_config(),
    l2_address="0x...",
    l2_public_key="0x...",
    signer=HeaderSigner(header="X-Sign-Hash", signature="PROXY_SIGNATURE"),
)
client.init_account(account)

WebSocket Usage

The SDK provides two WebSocket client options. Both connect with SBE binary encoding, which the Paradex WebSocket endpoints require (a plain JSON connect is rejected with HTTP 400). Frames are decoded before your callback runs, so it still receives dicts; pass ws_sbe_enabled=False (or sbe_enabled=False on a client) only for an endpoint that still serves JSON.

Public market data always arrives as SBE. Private channels (orders, fills, positions, account) may arrive as SBE or JSON depending on the account, and some field names differ between the two (e.g. order_id vs id). Every message carries message["encoding"], either "sbe" or "json", so a callback can tell which shape it received:

async def on_order(ws_channel, message):
    data = message["params"]["data"]
    order_id = data["order_id"] if message["encoding"] == "sbe" else data["id"]

Option 1: Async Client (Default)

Use the async client when you're comfortable with asyncio and need maximum performance:

async def on_message(ws_channel, message):
    print(ws_channel, message)

await paradex.ws_client.connect()
await paradex.ws_client.subscribe(ParadexWebsocketChannel.MARKETS_SUMMARY, callback=on_message)

Option 2: Threaded Client (Synchronous)

Use the threaded client for simpler integration without asyncio knowledge:

from paradex_py.api.ws_client_threaded import ThreadedParadexWebsocketClient
from paradex_py.api.ws_client import ParadexWebsocketChannel
from paradex_py.environment import TESTNET

# Simple synchronous usage - no asyncio required
ws_client = ThreadedParadexWebsocketClient(env=TESTNET)

with ws_client:
    ws_client.subscribe(ParadexWebsocketChannel.MARKETS_SUMMARY)

    # Blocking call - waits for messages
    msg = ws_client.get_updates(timeout=5.0)
    if msg:
        print(f"Channel: {msg.channel}, Data: {msg.data}")

When to use which:

Feature Async Client Threaded Client
Asyncio knowledge Required Not required
Integration Async codebases Synchronous codebases
Performance Optimal Good
Complexity Higher Lower
Runtime subscription Via callbacks Via subscribe() anytime

📖 For complete documentation refer to tradeparadex.github.io/paradex-py

💻 For comprehensive examples refer to following files:

Development

make install
make check
make test
make build
make clean-build
make publish
make build-and-publish
make docs-test
make docs
make help

Using uv

This project uses uv for managing dependencies and building. Below are instructions for installing uv and the basic workflow for development outside of using make commands.

Installing uv

uv is a fast and modern Python package manager. You can install it using the standalone installer for macOS and Linux:

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

For other installation methods, refer to the uv installation documentation.

Basic Workflow with uv

If you prefer not to use make commands, you can directly use uv for development tasks:

  • Install dependencies: Sync your environment with the project's dependencies.
    uv sync
    
  • Run tests: Execute the test suite using pytest within the uv environment.
    uv run pytest
    
  • Build the project: Create a distribution package for the SDK.
    uv build
    

For more detailed information on using uv, refer to the uv documentation.

The CI/CD pipeline will be triggered when a new pull request is opened, code is merged to main, or when new release is created.

Notes

Metadata

Release files for paradex_py 0.10.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for paradex_py 0.10.0
File Size Uploaded Provenance Actions
paradex_py-0.10.0.tar.gz 592.6 kB Without provenance Details for paradex_py-0.10.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for paradex_py 0.10.0
File Interpreter ABI Platform Actions
paradex_py-0.10.0-py3-none-any.whl Python 3 none any Details for paradex_py-0.10.0-py3-none-any.whl

Total release size: 794.8 kB

Release files / paradex_py-0.10.0.tar.gz

Download URL paradex_py-0.10.0.tar.gz
Size 592.6 kB
Tags Source
SHA-256 checksum
How to use checksums
d848fcb9cd07a64887ef2ca5b3146d80a4f13e91437fe1d408dc14eaf42df2cf
BLAKE2b-256 checksum
How to use checksums
6ac23fba89e6944bee35b73678668c71b58c4960b0feb87e6162e8b09f617a53
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / paradex_py-0.10.0-py3-none-any.whl

Download URL paradex_py-0.10.0-py3-none-any.whl
Size 202.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d33111633d5cdd7294bdf0866e266b27738c6f3af039617149d9405b79e10279
BLAKE2b-256 checksum
How to use checksums
73e01aa45332680a228ec7fcc6f2b162def18aa0390ccd52b158922200d76104
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for paradex_py 0.10.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.10.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page