For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Logo
Join CommunityStart Trading
HomeOverviewDIME UtilityTradingRisk & LiquidationsParadex ChainEcosystemREST APIWebSocket APIAgentic AI HubRelease Notes
HomeOverviewDIME UtilityTradingRisk & LiquidationsParadex ChainEcosystemREST APIWebSocket APIAgentic AI HubRelease Notes
  • General Information
    • Introduction
    • Server Location
    • Authentication
    • Subscription Channels
    • Error Handling
    • Code Examples
    • Rate Limits
  • WebSocket Channels
  • Useful Resources
    • Paradex Github
    • Paradex CLI
    • Code Samples
    • Python SDK
    • CCXT Integration
Join CommunityStart Trading
On this page
  • Server URLs
  • Public vs Private Channels
  • Establishing a Connection
  • Example in Python
  • Maintaining a Connection
  • Next Steps
General Information

WebSocket API

Was this page helpful?
Edit this page
Previous

Server Location

Next
Built with

The Paradex WebSocket API provides real-time market data and account updates. WebSockets allow for a persistent connection between the client and server, enabling efficient two-way communication.

Server URLs

EnvironmentWebSocket URL
Testnet (Sepolia)wss://ws.api.testnet.paradex.trade/v1
Mainnetwss://ws.api.prod.paradex.trade/v1

Public vs Private Channels

The Paradex WebSocket API provides two types of channels:

  • Public Channels: Publish information about the exchange that is not specific to a particular account. Examples include market summary, order book, trades, etc. You do not need to authenticate to subscribe to public channels.

  • Private Channels: Publish information about a particular account. You need to authenticate to subscribe to private channels.

Establishing a Connection

To establish a WebSocket connection, you can use various programming languages and libraries. When running Python-based code, Python 3.10+ is recommended.

Example in Python

1import websocket
2import json
3
4websocket_url = "wss://ws.api.testnet.paradex.trade/v1"
5
6# Define a callback to check connection success
7def on_open(ws):
8 print('Connected')
9
10# Connect to the WebSocket server
11ws = websocket.WebSocketApp(websocket_url, on_open=on_open)
12
13# Wait for a response
14ws.run_forever()

Upon successful connection, you should see:

Connected

Maintaining a Connection

Paradex has implemented ping/pong functionality as part of the WebSocket specification. This works at the protocol level:

  • The server sends a ping message every 55 seconds
  • The client must respond with a pong within 5 seconds
  • Upon receiving the pong, the connection is renewed for 60 seconds
  • If the server doesn’t receive a pong within the 5-second window, the connection is terminated

Most modern WebSocket libraries and frameworks automatically handle ping/pong messages. If you’re using older libraries or building a WebSocket client from scratch, you may need to implement this functionality manually.

To display incoming ping messages, you can use the following wscat command:

$wscat -P -w 120 -c wss://ws.api.testnet.paradex.trade/v1 -x '{"id":1,"jsonrpc":"2.0","method":"subscribe","params":{"channel":"markets_summary"}}' | grep "ping"

Next Steps

  • Learn how to authenticate your WebSocket connection
  • Explore available channels and subscription methods
  • Understand error handling for WebSocket connections