This page will help you get started with Ticker Websocket.

Channel: ticker

The ticker channel provides latest best bid and ask market data. All markets are of type update. A snapshot message is returned immediately after subscriber. Update messages are sent when the new data is available.

🚧

Empty book

When price and size are both zero, it means that side of the book is empty.

wscat -c wss://ws.testnet.bsx.exchange/ws -x '{"op":"sub","channel":"ticker","product":"BTC-PERP"}'
{"type":"message", "connection_id":"93199dfb-34d9-40cc-a6d5-f5bf5c925d1a"}
{"channel":"ticker","product":"BTC-PERP","type":"subscribed"}
{"channel":"ticker","product":"BTC-PERP","type":"snapshot","data":{"bid":{"price":"64858","size":"1.472"},"ask":{"price":"64866","size":"1.009"},"timestamp":1721288080968033000,"gsn":109364155},"timestamp":"1721288080968033000"}
// Request
{
  "op": "sub",
  "channel": "ticker",
  "product": "BTC-PERP"
}
// Response
{
  "channel": "ticker",
  "product": "BTC-PERP",
  "type": "snapshot",
  "data": {
    "bid": {
      "price" :"37201.52",
      "size": "123.45"
    }, 
    "ask": {
      "price": "37205.12",
      "size": "123.32"
    },
    "timestamp": 1703513424291498000, // in nanosecond
    "gsn": 2219507 // exchange's internal global sequence number
  },
  "timestamp": "1703513424291498000"
}

// Response
{
  "channel": "ticker",
  "product": "BTC-PERP",
  "type": "update",
  "data": {
    "bid": {
      "price" :"37201.52",
      "size": "123.45"
    }, 
    "ask": {
      "price": "37205.12",
      "size": "123.32"
    },
    "timestamp": 1703513424291498000, // in nanosecond
    "gsn": 2219507 // exchange's internal global sequence number
  },
  "timestamp": "1703513424291498000"
}

{
  "channel": "ticker",
  "type": "error",
  "message": "given channel/product is unsupported",
  "code": 400
}