This page will help you get started with Ticker Websocket.
Channel: trades
The trades
channel provides trades data. All markets are of type update
. Updates are sent when there is available data.
wscat -c wss://ws.testnet.bsx.exchange/ws -x '{"op":"sub","channel":"trades","product":"BTC-PERP"}'
{"type":"message", "connection_id":"62ea5c59-90d8-493a-aa89-74dbc7a2ab0a"}
{"channel":"trades","product":"BTC-PERP","type":"subscribed"}
{"channel":"trades","product":"BTC-PERP","type":"update","data":{"price":"43699.9","size":"0.3259","maker_side":"sell","id":"0x25e866b311cc491c9313b3ba6b3cf8a3a7daf82e807b4bf7b7c701d658a397f4","liquidation":false,"time":"1703513510240541000"}}
// Request
{
"op": "sub",
"channel": "trades",
"product": "BTC-PERP"
}
// Response
{
"channel": "trades",
"product": "BTC-PERP",
"type": "update",
"data": {
"price": "37201.52", // price of the BTC in this trade
"size": "1.12",
"maker_side": "buy", // buy or sell
"id": "0xf7695fdab16c40c4a7b23d0e66de72cc3dc42f13e013426e9a25c421a4386cf5", // an unique trade_id
"liquidation": false,
"time": "1702111485000000000" // unix timestamp in nanosecond of the trade, NOT current time
},
"timestamp": "1702111485000000000"
}
{
"channel": "trades",
"type": "error",
"message": "given channel/product is unsupported",
"code": 400
}