WebSocket API

Real-time market data and account updates via WebSocket.

Connection

EnvironmentURL
Testnetwss://ws.testnet.rise.trade/ws
Mainnetwss://ws.rise.trade/ws

Authentication

Authentication is required before subscribing to private channels (orders, positions). Public channels (orderbook) can be subscribed without authentication.

Authentication Request

{
  "method": "auth",
  "params": {
    "account": "0x1234567890123456789012345678901234567890",
    "signer": "0xabcdefabcdefabcdefabcdefabcdefabcdefabcd",
    "message": "Please sign in with your wallet to access rise.trade. You are signing in on 2025-01-15 12:00:00 (GMT). This message is exclusively signed with rise.trade for security.",
    "nonce": 1736942400,
    "signature": "0x..."
  }
}
ParameterTypeRequiredDescription
accountstringYesYour main Ethereum wallet address
signerstringYesSession key address (must be registered on-chain)
messagestringYesHuman-readable message that was signed
noncenumberYesUnix timestamp in seconds (must be within ±60 seconds of server time)
signaturestringYesEIP-712 signature in hex format

Authentication Response

Success:

{
  "method": "auth",
  "status": "success",
  "message": "Authentication successful",
  "data": {
    "account": "0x1234567890123456789012345678901234567890",
    "signer": "0xabcdefabcdefabcdefabcdefabcdefabcdefabcd"
  }
}

Error:

{
  "method": "auth",
  "status": "error",
  "message": "session key not active (status: 0)"
}

Subscription Format

Subscribe

{
  "method": "subscribe",
  "params": {
    "channel": "<channel_name>",
    "market_ids": [1, 2],
    "makers": ["0x..."]
  }
}
ParameterTypeRequiredDescription
channelstringYesChannel name: orders, orderbook, positions, or trades
market_idsnumber[]NoFilter by market IDs. Empty or omitted = all markets
makersstring[]NoFilter by account addresses. Empty or omitted = all accounts

Unsubscribe

{
  "method": "unsubscribe",
  "params": {
    "channel": "<channel_name>"
  }
}

Subscription Response

{
  "method": "subscribe",
  "status": "success",
  "message": "Subscribed to orders",
  "channel": "orders",
  "data": {
    "market_ids": [1, 2],
    "makers": ["0x1234567890123456789012345678901234567890"]
  }
}

Available Channels

ChannelAuth RequiredDescriptionFilters
ordersYesReal-time order updates with snapshotsmarket_ids, makers
orderbookNoReal-time orderbook updates with snapshotsmarket_ids
positionsYesReal-time position updates with snapshotsmarket_ids, makers

Message Types

All channel messages include a type field:

TypeDescription
snapshotFull state sent on initial subscription
updateIncremental update

Common Fields

All update messages include these fields:

FieldTypeDescription
channelstringChannel name
typestringsnapshot or update
market_idstringMarket ID
dataarrayChannel-specific data
block_numbernumberBlockchain block number
block_timestampstringBlockchain timestamp (nanoseconds)
timestampstringServer timestamp (nanoseconds)

Re-subscription Behavior

Re-subscribing to the same channel replaces the previous subscription filters. To receive events from multiple markets, specify all market IDs in a single subscription.

Price and Size Format

All prices and sizes are represented as integer strings in wei (18 decimals).

Example: "50000000000000000000000" = 50,000

Market IDs

Market IDSymbol
1BTC-PERP
2ETH-PERP

Error Handling

{
  "method": "subscribe",
  "status": "error",
  "message": "authentication required",
  "channel": "orders"
}

Health Checks

The server sends ping messages every 30 seconds. Respond with pong to keep the connection alive. Connections timeout after 60 seconds of inactivity.