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

L3 Lob

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

L2 Lob

Subscribe

Unsubscribe

Initial Response

Example message

L3 Trade Events

Matches that occur on the exchange. Includes IDs of the orders involved.

Schema

L3 Trades

Subscribe

Unsubscribe

Initial Response

Example message

L2 Trade Events

Matches that occur on the exchange. Does not provide IDs of the orders involved.

Schema

L2 Trades

Subscribe

Unsubscribe

Initial Response

Example message

Ticker

High level overview of the state of the order book.

Schema

Ticker

Subscribe

Unsubscribe

Initial Response

Example message

Candle

Open High Low Close Volume (OHLCV) data at the highest frequency we can get.

Schema

Candle

Subscribe

Unsubscribe

Initial Response

Example message

Funding Rate

Funding rate updates for futures exchanges.

Schema

Funding Rate

Subscribe

Unsubscribe

Initial Response

Example message

Open Interest

Open Interest updates for futures exchanges.

Schema

Open Interest

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

Ethereum Blocks

Subscribe

Unsubscribe

Initial Response

Example message

Ethereum Transactions

Details on every transaction on the Ethereum mainnnet.

Schema

Ethereum Transactions

Subscribe

Unsubscribe

Initial Response

Example message

Ethereum Logs

Smart contract logs for events on the Ethereum mainnet.

Schema

Ethereum Logs

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

Ethereum Token Transfers

Subscribe

Unsubscribe

Initial Response

Example message

Dex Trades

Normalised trades data for Ethereum DEXes.

Unlike off-chain trades, subscribing to Dex Trades for a specific DEX subscribes you to trades on all the supported symbols for that DEX

Schema

Dex Trades

Subscribe

Unsubscribe

Initial Response

Example message

Dex Liquidity

Liquidity updates for Ethereum DEXes.

Schema

Dex Liquidity

Subscribe

Unsubscribe

Initial Response

Example message

Last updated