sFOX WebSocket API

Real-time streaming API for market data (order book, trades, ticker) and private account data (open orders, trades, balances, post-trade settlement). Authenticate then subscribe to feeds.

AsyncAPI Specification

sfox-websocket-asyncapi.yml Raw ↑
asyncapi: 2.6.0
info:
  title: sFOX WebSocket API
  version: '1.0.0'
  description: >-
    Real-time streaming API for sFOX. Clients connect over WSS, authenticate with
    their API key (for private feeds), then subscribe/unsubscribe to feeds via a
    JSON control message: { "type": "subscribe", "feeds": ["<feed>", ...] }.
    This AsyncAPI document is GENERATED by the API Evangelist enrichment pipeline
    from the public sFOX WebSocket documentation (not published by sFOX).
  x-provenance:
    generated: '2026-07-21'
    method: generated
    source: https://docs.sfox.com/websocket-api/introduction
servers:
  production:
    url: ws.sfox.com/ws
    protocol: wss
    description: Production WebSocket endpoint (wss://ws.sfox.com/ws).
  sandbox:
    url: ws.staging.sfox.com/ws
    protocol: wss
    description: Sandbox WebSocket endpoint (access on request via support).
defaultContentType: application/json
channels:
  orderbook.net.{basequote}:
    description: Real-time net order book for a currency pair.
    parameters:
      basequote:
        description: Currency pair, e.g. btcusd.
        schema:
          type: string
    subscribe:
      operationId: subOrderbookNet
      message:
        $ref: '#/components/messages/OrderBookUpdate'
  orderbook.sfox.{basequote}:
    description: Real-time sFOX order book for a currency pair.
    parameters:
      basequote:
        schema:
          type: string
    subscribe:
      operationId: subOrderbookSfox
      message:
        $ref: '#/components/messages/OrderBookUpdate'
  trades.sfox.{basequote}:
    description: Real-time tick data of publicly executed trades.
    parameters:
      basequote:
        schema:
          type: string
    subscribe:
      operationId: subTrades
      message:
        $ref: '#/components/messages/TradeTick'
  ticker.sfox.{basequote}:
    description: Real-time day OHLCV and last-trade ticker.
    parameters:
      basequote:
        schema:
          type: string
    subscribe:
      operationId: subTicker
      message:
        $ref: '#/components/messages/Ticker'
  private.user.open-orders:
    description: Real-time updates to your open orders (auth required).
    subscribe:
      operationId: subUserOpenOrders
      message:
        $ref: '#/components/messages/UserOrderUpdate'
  private.user.trades:
    description: Real-time updates of your completed trades (auth required).
    subscribe:
      operationId: subUserTrades
      message:
        $ref: '#/components/messages/UserTradeUpdate'
  private.user.balances:
    description: Real-time updates to your account balances (auth required).
    subscribe:
      operationId: subUserBalances
      message:
        $ref: '#/components/messages/BalanceUpdate'
  private.user.post-trade-settlement:
    description: Real-time post-trade-settlement credit and risk updates (auth required).
    subscribe:
      operationId: subUserPTS
      message:
        $ref: '#/components/messages/PostTradeSettlementUpdate'
components:
  messages:
    OrderBookUpdate:
      name: orderBookUpdate
      title: Order book update
      payload:
        type: object
        properties:
          recipient:
            type: string
          sequence:
            type: integer
          timestamp:
            type: integer
          payload:
            type: object
    TradeTick:
      name: tradeTick
      title: Public trade tick
      payload:
        type: object
    Ticker:
      name: ticker
      title: Ticker (day OHLCV + last trade)
      payload:
        type: object
    UserOrderUpdate:
      name: userOrderUpdate
      title: Private open-order update
      payload:
        type: object
    UserTradeUpdate:
      name: userTradeUpdate
      title: Private trade update
      payload:
        type: object
    BalanceUpdate:
      name: balanceUpdate
      title: Private balance update
      payload:
        type: object
    PostTradeSettlementUpdate:
      name: postTradeSettlementUpdate
      title: Post-trade-settlement credit/risk update
      payload:
        type: object
  securitySchemes:
    apiKey:
      type: httpApiKey
      in: user
      name: authenticate
      description: >-
        Private feeds require an `authenticate` control message carrying the sFOX
        API key before subscribing.