Websocket API
Subscribe to live-streamed market events
Overview
The websocket API streams market updates at low latency for use cases that require monitoring of the market in real time. It supports all feeds, symbols, and exchanges for L3 Atom. Messages will be of the form:
{
"feed": <Name of the feed>,
"exchange": <Exchange the message is from>,
"symbol": <What symbol the message is for>,
"data": [
...
]
}in cases where you specify the feed, exchange, and symbol in the subscription message. In other types of feeds, you will see a similar structure, but you may not see an exchange or symbol field if it is not relevant. data is an array of the market updates / events, whose format is dependent on the feed. However, each entry in data will have one of the following structures:
{
...,
"event_timestamp": "2022-11-10T02:46:35.255000Z",
"atom_timestamp": 1668048395421519
}{
...,
"blockTimestamp": "2022-11-10T02:46:35Z",
"atomTimestamp": 1668048395421519
}Where the former relates to off-chain data with individual event timestamps, and the latter relates to on-chain data with timestamps of blocks. These formats are guaranteed throughout all feeds.
See the Schema Reference for more information on what all of these fields mean. Note that when sending out floats or large integers, we encode them as strings. This is because JSON can't guarantee floating point precision if these numbers were simply encoded and sent out as floats, but by sending them out as strings, we can preserve precision regardless. This is a practice that's commonly used by other Websocket APIs.
Base Endpoint
wss://ws.shared.projectx.network
Quickstart
The following code shows an example of how you can interact with this API:
Install the async websockets library if you don't have it already:
and then run by passing in command line arguments for what exchange, feed, and symbol to subscribe to. Below is an example.
Off-Chain
L3 Lob Events
Every update to the orderbook, including order IDs. Can be used to rebuild the exchange's orderbook.
Schema
Subscribe
Unsubscribe
Initial Response
Example message
L2 Lob Events
Every update to the orderbook, excluding order IDs. Can be used to rebuild the exchange's orderbook.
Schema
Subscribe
Unsubscribe
Initial Response
Example message
L3 Trade Events
Matches that occur on the exchange. Includes IDs of the orders involved.
Schema
Subscribe
Unsubscribe
Initial Response
Example message
L2 Trade Events
Matches that occur on the exchange. Does not provide IDs of the orders involved.
Schema
Subscribe
Unsubscribe
Initial Response
Example message
Ticker
High level overview of the state of the order book.
Schema
Subscribe
Unsubscribe
Initial Response
Example message
Candle
Open High Low Close Volume (OHLCV) data at the highest frequency we can get.
Schema
Subscribe
Unsubscribe
Initial Response
Example message
Funding Rate
Funding rate updates for futures exchanges.
Schema
Subscribe
Unsubscribe
Initial Response
Example message
Open Interest
Open Interest updates for futures exchanges.
Schema
Subscribe
Unsubscribe
Initial Response
Example message
On-Chain
Since each DEX supports a large number of symbol pairs and trades are far more infrequent than off-chain data, for now you must subscribe to exchanges as a whole and receive swaps data for all supported symbol pairs.
Ethereum Blocks
Details on every new block that is minted on the Ethereum mainnet.
Schema
Subscribe
Unsubscribe
Initial Response
Example message
Ethereum Transactions
Details on every transaction on the Ethereum mainnnet.
Ethereum Transactions aren't necessarily sent in the order they appear in the block, however a previous block's transactions will always come before a later block's transactions
Schema
Subscribe
Unsubscribe
Initial Response
Example message
Ethereum Logs
Smart contract logs for events on the Ethereum mainnet.
Ethereum logs aren't necessarily sent in the order they appear in the block, however a previous block's logs will always come before a later block's logs
Schema
Subscribe
Unsubscribe
Initial Response
Example message
Ethereum Token Transfers
Specific contract logs for token transfer events, decoded so you can derive the value of the transfer as well as the token and addresses involved.
Schema
Subscribe
Unsubscribe
Initial Response
Example message
Dex Trades
Normalised trades data for Ethereum DEXes.
Schema
Subscribe
Unsubscribe
Initial Response
Example message
Dex Liquidity
Liquidity updates for Ethereum DEXes.
Schema
Subscribe
Unsubscribe
Initial Response
Example message
Last updated
