Ticker

Receive aggregated 24-hour OHLCV data from all supported exchanges and the last price before each update every 3 seconds. Subscriptions to the ticker feed will receive real-time trades that occur on any of the exchanges that are active on the sFOX platform.

Subscribing

Feed

ticker.sfox.<basequote>

Example

ticker.sfox.btcusd

// Request -> ticker feed
{
    "type": "subscribe", 
    "feeds": ["ticker.sfox.btcusd"]
}

Ticker Message

Ticker Object

KeyDescription

amount

Quantity of the most recent trade on this pair

exchange

Location of the most recent trade on this pair

last

Price of the most recent trade on this pair

high

High price since 00:00:00 GMT

low

Low price since 00:00:00 GMT

open

Open price at 00:00:00 GMT

pair

Currency pair

source

Data source

timestamp

Time of the trade

volume

Volume traded since 00:00:00 GMT (base currency)

vwap

Volume-weighted average price since 00:00:00 GMT

Ticker Message

// Ticker feed message
{
  "sequence": 4,
  "recipient": "ticker.sfox.btcusd",
  "timestamp": 1649901842979345289,
  "payload": {
    "amount": 0.00005737,
    "exchange": "coinbase",
    "high": 41512.43,
    "last": 41420.58,
    "low": 41058.82,
    "open": 41141.31,
    "pair": "btcusd",
    "route": "Smart",
    "source": "ticker-info",
    "timestamp": "2022-04-14T02:04:02.481Z",
    "volume": 1387.77211046,
    "vwap": 41283.96339697249
  }
}

Example Code & Ticker Message

const WebSocket = require('ws')

const ws = new WebSocket('wss://ws.sfox.com/ws')

ws.on('message', function(data) {
    console.log(data);
});

ws.on('open', function() {
  const subscribeMsg = {
    type: 'subscribe',
    feeds: ['ticker.sfox.btcusd']
  }
  ws.send(JSON.stringify(subscribeMsg));
});

Last updated