sFOX API
Sign InOpen Account
Connect API
Connect API
  • Introduction
    • Welcome
    • Getting Started
    • Resources
      • Terminology
      • Systems & Operations
      • Integration Options
    • Guides
      • End User Onboarding & KYC
        • Individuals
        • Businesses
        • Enhanced Due Diligence
  • REST API
    • REST Endpoints
    • Authentication
    • End Users
      • Create End User Account
      • Request Verification Code
      • Confirm Verification Code
      • Create User Auth Token(s)
      • Get End User(s)
      • Get EDD Requests
      • Get EDD Prompts
      • Create EDD Responses
        • Uploading Files as Responses
      • Submit Documents
      • Deactivate User
    • Payments
      • Create Bank Account (Plaid)
      • Create Bank Account
      • Get Bank Account
      • Get Plaid Processors
      • Amend Plaid Processors
      • Verify Bank Account
      • Delete Bank Account
      • Get Wire Instructions
      • Get ACH Agreement Status
      • Request ACH Onboarding
      • Get ACH Deposit Limit
    • Withdrawals
      • Confirm Withdrawal
      • Resend Confirmation Code
      • Cancel Withdrawal
    • Transfers
      • Create Transfer
      • Confirm Transfer
      • Resend Confirmation Code
      • Cancel Transfer
      • Get Transfer Permissions
      • Get Transfer History
    • Monetization
      • Create Setting
      • Update Setting
      • Delete Setting
      • Get Settings
      • Get Permissions
      • Get Monetization History
  • WebSocket API
    • Connecting
    • Authentication
    • Subscribing & Unsubscribing
    • Message Format
    • End Users
      • Onboarding
      • Balances
      • Orders
      • Trades
    • Market Data
      • Order Book
      • Trades
      • Ticker
  • Single Sign-On
    • Overview
      • IdP Initiated SSO
    • IdP Data
    • SAML Response Data
  • Errors
    • Error Codes
Powered by GitBook
On this page
  • Subscription Instructions
  • Payload Details
  • Example Code & Trades Message
  1. WebSocket API
  2. Market Data

Ticker

Real-time streaming day OHLCV and last trade data

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 realtime trades that occur on any of the liquidity venues that are active on the sFOX platform.

Subscription Instructions

Subscription Format
Example

ticker.sfox.<basequote>

ticker.sfox.btcusd

Payload Details

Key
Description

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

Example Code & Trades 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 ticker feed
const subscribeMsg = {
  type: 'subscribe',
  feeds: ['ticker.sfox.btcusd', 'ticker.sfox.ethusd']
}

ws.send(JSON.stringify(subscribeMsg))
import asyncio
import json
import websockets

async def main(uri):
    async with websockets.connect(uri) as ws:
        await ws.send(json.dumps({
            "type": "authenticate",
            "apiKey": "<ENTERPRISE_API_KEY>",
            "enterprise": "true"
        }))

        # After successful authentication message, subscribe to the trades feed
        await ws.send(json.dumps({
            "type": "subscribe",
            "feeds": ["ticker.sfox.btcusd"]
        }))
        async for msg in ws:
            print(msg)


asyncio.run(main("wss://ws.sfox.com/ws"))
{
  "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
  }
}

PreviousTradesNextOverview

Last updated 1 year ago