Order Book

Real-time order books for a specified currency pair.

Subscription Instructions

Subscription Format
Example

orderbook.net.<basequote>

orderbook.net.btcusd

Payload Details

Order book subscriptions receive full order book snapshots for the pair. sFOX does not support sending changes at this time.

Key
Description

bids

An array of the bids available in this order book. Each bid is a price, quantity, and liquidity source

asks

An array of the asks available in this order book. Each ask is a price, quantity, and liquidity source

market making

The best bids and offers of the available destinations for maker orders placed on this pair

pair

The currency pair of this order book

lastupdated

The UNIX timestamp this order book was last updated

lastpublished

The UNIX timestamp this order book was last published

Example Code & Order Book Message

const WebSocket = require('ws')

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

ws.on('open', function() {
  const authMessage = {
   type: 'authenticate',
   apiKey: '<ENTERPRISE_API_KEY>',
   enterprise: 'true'
  }
  
  ws.send(JSON.stringify(authMessage))
})

// After successful authentication, subscribe to order book feed
const subscribeMsg = {
  type: 'subscribe',
  feeds: ['orderbook.net.btcusd', 'orderbook.net.ethusd']
}

ws.send(JSON.stringify(subscribeMsg))

Last updated