WebSocket Info API Reference
Overview
The Reya DEX Trading WebSocket API v2 provides real-time streaming data for decentralized exchange operations on the Reya Network. This version offers user-friendly data structures with human-readable formats, removing blockchain-specific details while maintaining comprehensive trading functionality.
For placing and cancelling orders over WebSocket, see WebSocket Order Entry API Reference. The recommended Market Maker integration runs both connections in parallel: that surface for order entry, this surface for read-side fanout.
Server Endpoints
Production Environment
URL:
wss://ws.reya.xyzProtocol: WSS
Description: Production WebSocket server for live trading
Staging Environment
URL:
wss://websocket-staging.reya.xyzProtocol: WSS
Description: Staging WebSocket server for pre-production testing
Test Environment
URL:
wss://websocket-testnet.reya.xyzProtocol: WSS
Description: Test WebSocket server for development
Channel Architecture
The API uses a hierarchical channel structure with clear separation between different data types:
Market Data Channels
/v2/markets/summary- Perp market summaries/v2/market/{symbol}/summary- Individual perp market summary/v2/spotMarkets/summary- Spot market summaries/v2/spotMarket/{symbol}/summary- Individual spot market summary/v2/market/{symbol}/perpExecutions- Market-specific perpetual executions/v2/market/{symbol}/depth- L2 order book depth snapshots, only relevant for markets using the Reya Order Book instead of the AMM/v2/market/{symbol}/spotExecutions- Market-specific spot executions/v2/market/{symbol}/spotExecutionBusts- Market-specific spot execution busts (failed spot fills)/v2/prices- All symbol prices/v2/prices/{symbol}- Individual symbol prices
Wallet Data Channels
/v2/wallet/{address}/positions- Position updates/v2/wallet/{address}/orderChanges- Order change updates/v2/wallet/{address}/perpExecutions- Wallet-specific perpetual executions/v2/wallet/{address}/spotExecutions- Wallet-specific spot executions/v2/wallet/{address}/spotExecutionBusts- Wallet-specific spot execution busts/v2/wallet/{address}/accountBalances- Account balance updates
Parameter Validation
Symbol Parameter
Pattern:
^[A-Za-z0-9]+$Examples:
BTCRUSDPERP,ETHRUSD,kBONKRUSDPERP,AI16ZRUSDPERPDescription: Trading symbol supporting alphanumeric characters
Address Parameter
Pattern:
^0x[a-fA-F0-9]{40}$Example:
0x6c51275fd01d5dbd2da194e92f920f8598306df2Description: Ethereum wallet address (40 hexadecimal characters)
Message Structure
The Info surface uses one envelope shape for streamed channel data, plus a small set of control envelopes for subscription management. All envelopes share a type discriminator at the top level; the rest of the body is type-specific.
Channel Data Envelope (Server → Client)
type: Always
"channel_data"for data updatestimestamp: Server timestamp in milliseconds
channel: Specific channel identifier
data: Channel-specific payload (object or array)
Subscribe Envelope (Client → Server)
The id is an optional client-chosen correlation marker. The server does not echo it back in the confirmation and does not enforce uniqueness across in-flight subscribes; it is purely for client-side bookkeeping.
Subscribed Confirmation (Server → Client)
The contents field carries an initial snapshot for channels that provide one (e.g. /v2/market/{symbol}/depth); otherwise it is omitted.
Unsubscribe Envelope (Client → Server)
Unsubscribed Confirmation (Server → Client)
Error Envelope (Server → Client)
The shape and the full set of possible message values are documented in Error Catalog below.
Heartbeats
The heartbeat / connection-liveness mechanism is documented in detail on its own page — see Heartbeats. Short version: protocol-level pings handle liveness automatically, no application-level code is required on the client.
Channels Reference
1. Market Data Channels
/v2/markets/summary
/v2/markets/summaryPurpose: Real-time updates for all market summaries
Subscription:
Message Structure:
Data Type - MarketSummary
symbol(string): Trading symbolupdatedAt(integer): Last calculation timestamp (milliseconds)longOiQty(string): Long open interest in lotsshortOiQty(string): Short open interest in lotsoiQty(string): Total open interest quantityfundingRate(string): Current hourly funding ratelongFundingValue(string): Current long funding valueshortFundingValue(string): Current short funding valuefundingRateVelocity(string): Funding rate velocityvolume24h(string): 24-hour trading volumepxChange24h(string, optional): 24-hour price changethrottledOraclePrice(string, optional): Last oracle price at summary updatethrottledPoolPrice(string, optional): Last pool price at summary updatepricesUpdatedAt(integer, optional): Last price update timestamp
/v2/market/{symbol}/summary
/v2/market/{symbol}/summaryPurpose: Real-time updates for a specific market's summary
Parameters:
symbol: Trading symbol (e.g.,BTCRUSDPERP,kBONKRUSDPERP)
Subscription:
Message Structure:
Data Type - MarketSummary
Same as above - see /v2/markets/summary channel for complete field definitions.
/v2/spotMarkets/summary
/v2/spotMarkets/summaryPurpose: Real-time updates for all spot market summaries
Subscription:
Message Structure:
Data Type - SpotMarketSummary
symbol(string): Trading symbolupdatedAt(integer): Last calculation timestamp (milliseconds)volume24h(string): 24-hour trading volume in USDpxChange24h(string, optional): Absolute 24-hour price changeoraclePrice(string, optional): Current oracle price
/v2/spotMarket/{symbol}/summary
/v2/spotMarket/{symbol}/summaryPurpose: Real-time updates for a specific spot market's summary
Parameters:
symbol: Trading symbol (e.g.,WETHRUSD)
Subscription:
Message Structure:
Data Type - SpotMarketSummary
Same as above - see /v2/spotMarkets/summary channel for complete field definitions.
/v2/market/{symbol}/perpExecutions
/v2/market/{symbol}/perpExecutionsPurpose: Real-time perpetual executions for a specific market
Parameters:
symbol: Trading symbol (e.g.,BTCRUSDPERP,AI16ZRUSDPERP)
Subscription:
Message Structure:
Data Type - PerpExecution
exchangeId(integer): Exchange identifiersymbol(string): Trading symbolaccountId(integer): Account identifierqty(string): Execution quantityside(Side): Execution side (B=Buy, A=Sell)fee(string): Total execution fee in rUSDopeningFee(string, optional): Opening fee portion of the total fee in rUSD. Absent for position-extending executions.price(string): Execution pricetype(ExecutionType): Execution type (ORDER_MATCH, LIQUIDATION, ADL)timestamp(integer): Execution timestamp (milliseconds)sequenceNumber(integer): Global sequence numberrealizedPnl(string, optional): Realized PnL from this execution in rUSD (priceVariationPnl + fundingPnl). Absent for position-extending executions.priceVariationPnl(string, optional): PnL component from price movement in rUSD. Absent for position-extending executions.fundingPnl(string, optional): PnL component from funding payments in rUSD. Absent for position-extending executions.
/v2/prices
/v2/pricesPurpose: Real-time price updates for all symbols
Subscription:
Message Structure:
Data Type - Price
symbol(string): Trading symboloraclePrice(string): Oracle price - Price given by the Stork feeds, used both as the peg price for prices on Reya, as well as Mark PricespoolPrice(string, optional): Pool price - The price currently quoted by the AMM for zero volumeupdatedAt(integer): Last update timestamp (milliseconds)
/v2/prices/{symbol}
/v2/prices/{symbol}Purpose: Real-time price updates for a specific symbol
Parameters:
symbol: Trading symbol (e.g.,BTCRUSDPERP,kBONKRUSDPERP)
Subscription:
Message Structure:
/v2/market/{symbol}/depth
/v2/market/{symbol}/depthPurpose: Real-time L2 order book depth snapshots for a specific market
Parameters:
symbol: Trading symbol (e.g.,BTCRUSDPERP,DOGERUSDPERP)
Subscription:
Message Structure:
Data Type - Depth
symbol(string): Trading symboltype(DepthType): Depth message type (SNAPSHOT, UPDATE)bids(array): Bid side levels aggregated by price, sorted descending by pricepx(string): Price levelqty(string): Aggregated quantity at this price level
asks(array): Ask side levels aggregated by price, sorted ascending by pricepx(string): Price levelqty(string): Aggregated quantity at this price level
updatedAt(integer): Snapshot generation timestamp (milliseconds)
/v2/market/{symbol}/spotExecutions
/v2/market/{symbol}/spotExecutionsPurpose: Real-time spot executions for a specific market
Parameters:
symbol: Trading symbol (e.g.,ETHRUSD,BTCRUSD)
Subscription:
Message Structure:
Data Type - SpotExecution
exchangeId(integer, optional): Exchange identifiersymbol(string): Trading symbolaccountId(integer): Account identifier of the taker side of the trademakerAccountId(integer): Maker account ID (counterparty providing liquidity)orderId(string, optional): Taker-side order ID. Absent when the taker order was filled and removed in the same matching round.makerOrderId(string, optional): Maker-side order ID. Absent when the maker order was fully filled in this execution.qty(string): Execution quantity in base asset unitsside(Side): Taker side (B=Buy, A=Sell). The maker is always the opposite side.price(string): Execution price in quote-per-base unitsfee(string): Fee charged to the taker, in the market's fee assettype(ExecutionType): Execution type (ORDER_MATCH, LIQUIDATION, ADL)timestamp(integer): Execution timestamp (milliseconds since epoch)sequenceNumber(integer): Monotonic per-execution sequence number across the spot matching engine; increases by 1 for every spot execution on Reya. Use this to dedup and gap-detect on the consumer side after a reconnect.
/v2/market/{symbol}/spotExecutionBusts
/v2/market/{symbol}/spotExecutionBustsPurpose: Real-time spot execution busts (failed spot fills) for a specific market
Parameters:
symbol: Trading symbol (e.g.,ETHRUSD,BTCRUSD)
Subscription:
Message Structure:
Data Type - SpotExecutionBust
A bust is emitted when the matching engine matched two orders but the on-chain settlement attempt reverted (e.g. insufficient balance, signature staleness, market paused). The match is rolled back; both orders are released back to their owners' state. See Trade Busts for the full trade lifecycle, when busts happen, and how clients should handle them.
symbol(string): Trading symbolaccountId(integer): Account identifier of the taker side of the failed tradeexchangeId(integer): Exchange identifiermakerAccountId(integer): Maker account ID (counterparty)orderId(string): Taker-side order IDmakerOrderId(string): Maker-side order IDqty(string): Failed base quantity in base asset unitsside(Side): Taker side (B=Buy, A=Sell)price(string): Price at which the failed match was attemptedreason(string): Hex-encoded revert reason bytes from the on-chain settlement attempt. Clients can ABI-decode this against the OrdersGateway error ABI to recover the specific revert (e.g.InsufficientBalance,UnauthorizedSigner). The first 4 bytes are the selector; subsequent bytes are the ABI-encoded args.timestamp(integer): Block timestamp of the failed settlement (milliseconds since epoch). This is the chain-side timestamp, not the original off-chain match timestamp.
2. Wallet Data Channels
/v2/wallet/{address}/positions
/v2/wallet/{address}/positionsPurpose: Real-time position updates for a wallet
Parameters:
address: Ethereum wallet address (e.g.,0x6c51275fd01d5dbd2da194e92f920f8598306df2)
Subscription:
Message Structure:
Data Type - Position
exchangeId(integer): Exchange identifiersymbol(string): Trading symbolaccountId(integer): Account identifierqty(string): Position quantityside(Side): Position side (B=Buy, A=Sell)avgEntryPrice(string): Average entry priceavgEntryFundingValue(string): Average entry funding valuelastTradeSequenceNumber(integer): Last execution sequence number
/v2/wallet/{address}/orderChanges
/v2/wallet/{address}/orderChangesPurpose: Real-time order change updates for wallet
Parameters:
address: Ethereum wallet address
Subscription:
Message Structure:
Data Type - Order
exchangeId(integer): Exchange identifiersymbol(string): Trading symbolaccountId(integer): Account identifierside(Side): Order side (B=Buy, A=Sell)limitPx(string): Limit priceorderType(OrderType): Order type (LIMIT, TP, SL)status(OrderStatus): Order status (OPEN, FILLED, CANCELLED, REJECTED)createdAt(integer): Creation timestamp (milliseconds)lastUpdateAt(integer): Last update timestamp (milliseconds)orderId(string): Order identifierqty(string, optional): Order quantityexecQty(string, optional): Executed quantity in the current order updatecumQty(string, optional): Total executed quantity across all fillstriggerPx(string, optional): Trigger price for TP/SL orderstimeInForce(TimeInForce, optional): Time in force (IOC, GTC)reduceOnly(boolean, optional): Reduce-only flag (exclusively for LIMIT IOC orders)
/v2/wallet/{address}/perpExecutions
/v2/wallet/{address}/perpExecutionsPurpose: Real-time perpetual execution updates for a wallet
Parameters:
address: Ethereum wallet address
Subscription:
Message Structure:
Data Type - PerpExecution
Same as above - see /v2/market/{symbol}/perpExecutions channel for complete field definitions.
/v2/wallet/{address}/spotExecutions
/v2/wallet/{address}/spotExecutionsPurpose: Real-time spot execution updates for a wallet
Parameters:
address: Ethereum wallet address
Subscription:
Message Structure:
Data Type - SpotExecution
Same as above - see /v2/market/{symbol}/spotExecutions channel for complete field definitions.
/v2/wallet/{address}/spotExecutionBusts
/v2/wallet/{address}/spotExecutionBustsPurpose: Real-time spot execution bust updates for a wallet
Parameters:
address: Ethereum wallet address
Subscription:
Message Structure:
Data Type - SpotExecutionBust
Same as above - see /v2/market/{symbol}/spotExecutionBusts channel for complete field definitions.
/v2/wallet/{address}/accountBalances
/v2/wallet/{address}/accountBalancesPurpose: Real-time account balance updates for a wallet
Parameters:
address: Ethereum wallet address
Subscription:
Message Structure:
Data Type - AccountBalance
accountId(integer): Account identifierasset(string): Asset symbol (e.g., WSTETH, RUSD)realBalance(string): Sum of account net deposits and realized PnL from closed positionsbalanceDEPRECATED(string): Sum of account net deposits only (deprecated, will be removed)
Error Catalog
The server emits an error envelope when it cannot process a frame. The connection stays open; only the offending operation is rejected. Every error envelope shares this shape:
The channel field is included when the error relates to a specific channel (e.g. an invalid subscribe target). It is omitted for frame-level errors that aren't tied to a particular channel.
The full set of message strings emitted by the server:
Invalid JSON
The frame body could not be parsed as JSON.
Fix the client serializer.
Invalid type
The frame's type field is not one of subscribe, unsubscribe, ping. (pong is server-only — clients don't send JSON pong frames.)
Verify the request type.
Invalid channel name
The subscribe / unsubscribe target does not match a known channel path or has malformed parameters (e.g. an invalid symbol or address).
Check the channel name against the Channels Reference and the Parameter Validation rules.
Error while fetching snapshot from {channel}
The server failed to compute the initial snapshot for a freshly-subscribed channel (typically a transient backend issue). The subscription is rolled back; the client may retry.
Retry the subscribe after a short backoff. If the problem persists, contact support with the channel name and timestamp.
Data Types & Schemas
Enumeration Types
ExecutionType - Type of execution that occurred
ORDER_MATCH: Regular order matchingLIQUIDATION: Liquidation executionADL: Auto-deleveraging execution
OrderStatus - Current status of an order
OPEN: Order is active and can be filledFILLED: Order has been completely filledCANCELLED: Order has been cancelledREJECTED: Order was rejected
DepthType - Order book depth message type
SNAPSHOT: Full order book snapshotUPDATE: Single level change update
AccountType - Account type classification
MAINPERP: Main perpetual trading accountSUBPERP: Sub perpetual trading accountSPOT: Spot trading only account
Connection Management
Reconnection Pattern
Reconnect with the usual exponential-backoff-with-jitter pattern any robust WebSocket client should use. The Reya-specific bits are:
Re-subscribe to every channel. The server holds no per-connection subscription state across disconnects — a client that had three channels subscribed before the drop has zero subscribed after the new connection opens. Track active subscriptions client-side and replay them on reconnect.
Reconcile missed events from REST. Channels are best-effort streams. Between disconnect and re-subscribe the client may miss order updates, executions, or balance changes. After reconnect, refresh from REST (e.g.
GET /v2/wallet/{address}/openOrders,GET /v2/wallet/{address}/perpExecutions) before trusting cached state.
For the meaning of WS close codes you'll see on onclose (1000, 1001, 1006, etc.), see What Happens When the Server Closes the Connection.
Graceful Shutdown
The server's drain-and-close behavior on rolling deploys (10s drain, /ready returns 503, idle connections closed first, 1001 SERVER_SHUTTING_DOWN on close) is shared with the Order Entry WebSocket and documented in Server-Side Graceful Shutdown.
Python SDK Example
Worked examples are included in the Reya Python SDK under examples/websocket/. The directory is split by market type:
examples/websocket/perps/market_monitoring.py— subscribe to perp market summariesexamples/websocket/perps/prices_monitoring.py— subscribe to the price streamexamples/websocket/perps/wallet_monitoring.py— subscribe to wallet-scoped channels (positions, order changes, executions, balances)examples/websocket/spot/spot_executions.py— subscribe to spot execution streamsexamples/websocket/spot/depth_market_maker.py— bootstrap state via REST, then drive a market-maker loop off ofdepth,accountBalances,openOrders, andspotExecutionsupdates
Run any of them with:
See each script's docstring for prerequisites (.env setup, funded test accounts on cronos).
Last updated