Websocket API
If you connect to the WebSocket endpoint, you can subscribe to some channels and receive updates about objects.
Updates come in the form of a full object and can substitute existing objects by their object identifier.
The common form of messages received is
In several subscriptions, specifically market, trades, userOrders, orderbook, userFills
(in other words, except candles
), the client receives history objects as events, which are similar to those from calling the corresponding HTTP API with the default limit parameter.
Subscriptions
trades
trades
Subscription parameters
channel
string "trades"
the channel name
market
string
a market contract address
Event data
A trade object
userOrders
userOrders
Subscription parameters
channel
string "userOrders"
the channel name
market
string
a market contract address
user
string
a user address
Event data
An order object.
orderbook
orderbook
Subscription parameters
channel
string "orderbook"
the channel name
market
string
a market contract address
aggregation
number
an order book level of aggregation
Event data
An object:
aggregation
string represents an aggregation of the market
an order book aggregation level
levels
object with fields"asks" and "bids"
Each field is a sorted array of order book level objects; asks are sorted in ascending order by price, and bids are sorted in descending order.
userFills
userFills
Subscription parameters
channel
string "userFills"
the channel name
market
string
a market contract address
user
string
a user address
Event data
An object with keys representing user addresses and values as arrays of order fill objects.
candles
candles
Subscription parameters
channel
string "candles"
the channel name
market
string
a market contract address
resolution
string
one of the candle object's resolutions
Event data
An object with keys representing a resolution and the values being candle objects.
market
market
Subscription parameters
channel
string "market"
the channel name
market
string
a market contract address
Event data
An array of market objects.
Last updated