Socket.io (deprecated)
Ethereal uses Socket.io, a library that extends the standard WebSocket protocol. Socket.io provides ready-made client libraries in multiple languages with automatic reconnection handling and built-in ping/pong frames to maintain stable connections, saving developers from implementing these basic features themselves.
Refer to Socket.io for language specific client implementations.
wss://ws.ethereal.trade/v1/stream
Live - Soon to be deprecated
WebSockets
Ethereal also offers WebSocket support, which communicates with plain JSON payloads, resulting in lower latency, reduced overhead, and smaller message sizes. This makes it well-suited for latency-sensitive integrations and lightweight clients that don't need the built-in reconnections provided by Socket.io.
Websockets support a subset of the Socket.io feeds. If you require additional data streams, use the Socket.io gateway above which supports the full set of subscription types.
Socket.io Subscription Streams
Subscribe
The WebSocket gateway offers the following subscription streams:
BOOK_DEPTH - Provides order book depth updates for a specific product.
BookDepthevents are emitted on a configurable fixed interval (as of writing, this is configured to be once every 200ms)previousTimestampis in milliseconds and represents the last time theBookDepthemittedtimestampalso in milliseconds and the system timestamp of when thisBookDepthwas emittedUsing both the
previousTimestampandtimestampyou can infer whether or not any events were missed during connection or during consumptionasksan array of price/quantity tuples representing asksbidsan array of price/quantity tuples representing bidstrepresents server time when response was published (epoch in miliseconds)
MARKET_PRICE - Delivers real-time market price updates for a specified product.
MarketPriceevents are emitted on a configurable fixed interval (currently configured to be once every second)trepresents server time when response was published (epoch in miliseconds)
ORDER_FILL - Notifies when orders are filled for a specific subaccount.
OrderFillevents are emitted in real-time as they occurtrepresents server time when response was published (epoch in miliseconds)
TRADE_FILL - Provides a stream of trades that have occurred filtered by product.
TradeFillevents are emitted in real-time as they occurtrepresents server time when response was published (epoch in miliseconds)Similar to
OrderFill, an array of trade fills will be emitted in a single message, grouped by the product they were traded on
ORDER_UPDATE - Provides updates about order status changes for a specific subaccount.
OrderUpdateevents are emitted in real-timetrepresents server time when response was published (epoch in miliseconds)
SUBACCOUNT_LIQUIDATION - Provides an update when a subaccount is liquidated.
SubaccountLiquidationevents are emitted in real-timesubaccountIdthe subaccount that has been liquidated,liquidatedAtthe time (in ms, since the Unix epoch) when the liquidation occurredtrepresents server time when response was published (epoch in miliseconds)
TOKEN_TRANSFER - Updates on token transfers (deposits/withdrawals) for a specific subaccount.
trepresents server time when response was published (epoch in miliseconds)
Unsubscribe
To stop receiving data from a previously established subscription, you can unsubscribe using the same payload format as your original subscription. Simply emit an unsubscribe event to the socket with the identical payload structure you used when subscribing.
Handling Socket.io Exceptions
Exceptions are exposed in its own event aptly named "exception". Exceptions follow the following shape:
patternindicates the source event pattern if available e.g. "subscribe"statusthe error statuserrorgeneral body of the error its shape changes depending on the status
Last updated