Skip to main content
This WebSocket API will be deprecated on July 1, 2026. See the Migration Guide to move to the Centrifuge-based API.
Subscribe to changes in a particular order book. You will receive updates when orders are filled, cancelled, or posted. Note that for performance reasons, updates are delayed by at most 100ms. CHANNEL NAME FORMAT order_book_v2:{token}:{marketHash}
NameTypeDescription
tokenstringRestrict updates to only orders denominated in this token
marketHashstringThe market to subscribe to
MESSAGE PAYLOAD FORMAT The message payload is an array of JSON objects representing each object with the fields below. Note that these are the same fields as mentioned in the orders section, with an additional status and updateTime field.
NameTypeDescription
orderHashstringA unique identifier for this order
statusstring”ACTIVE” if this order is still valid, “INACTIVE” if cancelled, “FILLED” if completely filled
fillAmountstringHow much this order has been filled in Ethereum units up to a max of totalBetSize. See the token section of how to convert this into nominal amounts
pendingFillAmountstringWhat amount is pending fill in Ethereum units up to a max of totalBetSize. See the token section of how to convert this into nominal amounts
makerstringThe market maker for this order
totalBetSizestringThe total size of this order in Ethereum units. See the token section for how to convert this into nominal amounts.
percentageOddsstringThe odds that the maker receives in the sportx protocol format. To convert to an implied odds divide by 10^20. To convert to the odds that the taker would receive if this order would be filled in implied format, use the formula takerOdds=1-percentageOdds/10^20. See the unit conversion section for more details.
expirynumberDepcreated field: the time in unix seconds after which this order is no longer valid. Always 2209006800
apiExpirynumberThe time in unix seconds after which this order is no longer valid
saltstringA random number to differentiate identical orders
isMakerBettingOutcomeOnebooleantrue if the maker is betting outcome one (and hence taker is betting outcome two if filled)
signaturestringSignature of the maker on this order
updateTimestringServer-side clock time for the last modification of this order.
sportXeventIdstringThe event related to this order
Note that the messages are sent in batches in an array. If you receive two updates for the same orderHash within an update, you can order them by updateTime after converting the updateTime to a BigInt or BigNumber.
const marketHash =
  "0x04b9af76dfb92e71500975db77b1de0bb32a0b2413f1b3facbb25278987519a7";
const token = "0xa25dA0331C0853FD17C47c8c34BCCBAaF516C438";
const channel = realtime.channels.get(`order_book_v2:${token}:${marketHash}`);
channel.subscribe((message) => {
  console.log(message.data);
});
The above command returns JSON structured like this
[
  {
    "orderHash": "0x7bd76648f589f3e272d48294d8881fe68aae7704f7b2ef0a50bf612be44271",
    "status": "INACTIVE",
    "fillAmount": "2000000000",
    "pendingFillAmount": "1000000000",
    "maker": "0x9883D5e7dC023A441A81Ef95af406C69926a0AB6",
    "totalBetSize": "500000000",
    "percentageOdds": "750000000000000000000",
    "expiry": 1747500000000,
    "apiExpiry": 1747500000000,
    "salt": "12345678901234567890",
    "isMakerBettingOutcomeOne": false,
    "signature": "0xbf099ab02255d5e2a9e063dc43a7afe96e65f5e8fc2ed3d2ba60b0a3fcadb3441bf32271293e85b7a795c9d86a2384035a0da3285113e746547e236bc58885e01",
    "updateTime": 1747490000000,
    "sportXeventId": "L13772588"
  }
]