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":"06dc044e-cd4c-467b-b3e2-1bf4a81cd4fc"}
{"channel":"oracle","product":"BTC-PERP","type":"subscribed"}
{"channel":"oracle","product":"BTC-PERP","type":"snapshot","data":{"asset":"BTC","mark_price":"43770.722156213661","index_price":"43726.433932850329","timestamp":1703513327000000000}}
{"channel":"oracle","product":"BTC","type":"update","data":{"asset":"BTC","mark_price":"43778.65591406084","timestamp":1703513332000000000}}
{"channel":"oracle","product":"BTC","type":"update","data":{"asset":"BTC","index_price":"43727.764841443254","timestamp":1703513332000000000}}
// 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
  } 
}