Skip to content

WebSocket Price Feed

The WebSocket feed provides real-time BTC price updates, round lifecycle events, and odds changes.

Connection

wss://rgs.velo.games/ws/v1/feed?operator_id=YOUR_ID&api_key=YOUR_KEY

Message Format

All messages are JSON. Each message has a type field:

json
{
  "type": "price_update",
  "data": { ... },
  "timestamp": 1710437400000
}

Message Types

price_update

Sent every 100ms during an active round.

json
{
  "type": "price_update",
  "data": {
    "price": 71284.50,
    "change_pct": 0.42,
    "round_elapsed_ms": 142000,
    "round_remaining_ms": 158000
  }
}

round_start

Sent when a new round begins.

json
{
  "type": "round_start",
  "data": {
    "round_id": "round_184722",
    "entry_price": 71284.50,
    "start_time": 1710437400000,
    "end_time": 1710437700000,
    "duration_ms": 300000,
    "buffer_ms": 10000
  }
}

odds_update

Sent whenever odds change (approximately every second).

json
{
  "type": "odds_update",
  "data": {
    "up": 1.82,
    "down": 2.05,
    "prob_up": 0.578,
    "vig_pct": 6.2,
    "vol_regime": "normal"
  }
}

round_lock

Sent when the buffer zone activates (last 10 seconds).

json
{
  "type": "round_lock",
  "data": {
    "round_id": "round_184722",
    "lock_price": 71310.25
  }
}

round_settle

Sent when the round is settled via Chainlink.

json
{
  "type": "round_settle",
  "data": {
    "round_id": "round_184722",
    "entry_price": 71284.50,
    "settlement_price": 71310.25,
    "result": "up",
    "chainlink_report_id": "0x7a3f...c82d",
    "verification_url": "https://data.chain.link/..."
  }
}

Client Example

javascript
const ws = new WebSocket('wss://rgs.velo.games/ws/v1/feed?operator_id=demo&api_key=demo');

ws.onmessage = (event) => {
  const msg = JSON.parse(event.data);
  
  switch (msg.type) {
    case 'price_update':
      updateChart(msg.data.price);
      break;
    case 'round_start':
      resetRound(msg.data);
      break;
    case 'odds_update':
      updateOddsDisplay(msg.data);
      break;
    case 'round_settle':
      showResult(msg.data);
      break;
  }
};

Heartbeat

The server sends a ping frame every 15 seconds. Your client must respond with pong or the connection will be dropped after 30 seconds.

B2B Integration Documentation