This page will help you get started with Oracle Prices Websocket.
Channel: oracle
The oracle
channel provides updates on the oracle prices (mark price and index price). One snapshot of the current prices is returned upon subscribing. After subscription an update
is sent for every price update we get from Stork
wscat -c wss://ws.testnet.bsx.exchange/ws -x '{"op":"sub","channel":"oracle","product":"BTC-PERP"}'
{"type":"message", "connection_id":"a118a43b-4f14-4bc9-90bc-cd7d8c4ef3b8"}
{"channel":"oracle","product":"BTC-PERP","type":"subscribed"}
{"channel":"oracle","product":"BTC-PERP","type":"snapshot","data":{"asset":"BTC","mark_price":"64678.262359500002","index_price":"64688.829657499995","timestamp":1721281212870000000},"timestamp":"1721281213529688000"}
{"channel":"oracle","product":"BTC","type":"update","data":{"asset":"BTC","mark_price":"64678.500612999999","index_price":"64687.931321","timestamp":1721281213884371000},"timestamp":"1721281213884371000"}
{"channel":"oracle","product":"BTC","type":"update","data":{"asset":"BTC","mark_price":"64679.746479500002","index_price":"64691.926269000001","timestamp":1721281214895813000},"timestamp":"1721281214895813000"}
// Request
{
"op": "sub",
"channel": "oracle",
"product": "BTC-PERP"
}
// Response
{
"channel": "oracle",
"product": "BTC-PERP",
"type": "snapshot",
"data": {
"mark_price": "37201.15",
"index_price": "37201.50",
"timestamp": 1707898364000000000
},
"timestamp": "1707898364000000000"
}
{
"channel": "oracle",
"type": "error",
"message": "given channel/product is unsupported",
"code": 400
}