Trades

Real-time tick data feed of any trade executed across all of sFOX’s integrated liquidity providers. Please note that this feed does not only represent trades executed on sFOX.

Subscribing

Feed

trades.sfox.<basequote>

Example

trades.sfox.btcusd

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

Trades Message

Trades Object

Key
Description

buyOrderId

Order ID of the buy trade

sellOrderId

Order ID of the sell trade

pair

The currency pair of this trade

price

Price of this trade

quantity

Quantity traded

side

Side taken buy or sell

exchange

Location of the trade

exchange_id

ID of the trade location

timestamp

Time of the trade

Trades Message

// Trades feed message
{
  "sequence": 24,
  "recipient": "trades.sfox.btcusd",
  "timestamp": 1649901441593380244,
  "payload": {
    "id": "1062696823",
    "quantity": "0.005",
    "price": "41492",
    "exchange": "bitfinex",
    "exchange_id": 2,
    "side": "buy",
    "pair": "btcusd",
    "pair_id": 1,
    "timestamp": "2022-04-14T01:57:21.521999872Z",
    "timeStamp": "2022-04-14T01:57:21.521",
    "buyOrderId": "",
    "sellOrderId": "",
    "is_decimal": true
  }
}

Example Code

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: ['trades.sfox.btcusd']
  }
  ws.send(JSON.stringify(subscribeMsg));
});

Last updated