WebSocket API for Futures Real-Time Quotes & Order Book Depth WEBSOCKET API Provides WebSocket real-time market data streams for all types of futures contracts, covering commodity futures and financial futures main and continuous contracts. Millisecond-level push of tick transactions, multi-level order books, K-line updates, and open interest changes, supporting major domestic and international futures exchanges.

Futures WebSocket Documentation

The iTick Future WebSocket API provides streaming access to the latest data from major global futures markets. You can specify which channels to use by sending commands in operation format. When events occur in the channels you subscribe to, our WebSockets will emit events to notify you.

Our WebSocket API is authorization-based, which controls which WebSocket clusters you can connect to and what types of data you can access. You can log in to view examples that include your API key and are personalized according to your authorization.

Step 1: Connection

With the premium plan, you will be able to use a single connection to the cluster. If another connection attempts to connect to the cluster simultaneously, the current connection will be disconnected. If you need more connections to this cluster simultaneously, you can contact support.

Connect to the cluster:

wscat -c wss://api.itick.org/future  -H "token: 2abf6c0*************************dd8a1930a2f48ba14a"

After connecting, you will receive the following message:

{
  "code":1,
  "msg": "Connected Successfully"
}

Step 2: Authentication

After successful authentication, you will receive the following message:

{
  "code":1,
  "resAc":"auth",
  "msg": "authenticated"
}

If authentication fails, the connection will be disconnected and the process terminated:

{
  "code":0,
  "resAc":"auth",
  "msg": "auth failed"
}

Step 3: Subscription

After authentication, you can request streams. You can request multiple streams in the same request.

{
  "ac":"subscribe",
  "params":"GC$US,ZS$US",
  "types":"quote"
}

params:Symbols symbol$region. Multiple symbols are supported and should be separated by English commas. A single WebSocket connection may subscribe to a maximum of 500 symbols; exceeding this limit will result in restriction.
types: Subscription types

  • depth: Order book (Level 2 market depth)
  • quote: Real-time quote
  • tick: Trade execution data
  • kline: K-line/candlestick data (for 1-minute interval, specify: kline@1)

Note: The kline@1 subscription is currently only available to users on Premium or higher tiers, as well as those with a stock data package.

Successful subscription response:

{
  "code":1,
  "resAc":"subscribe",
  "msg": "subscribe Successfully"
}

Failed subscription responses. The following are: exceeding maximum plan limit and subscription parameter error respectively:

{
  "code":0,
  "resAc":"subscribe",
  "msg": "exceeding the maximum subscription limit"
}
{
  "code":0,
  "resAc":"subscribe",
  "msg": "cannot be resolved action"
}

Step 4: Response Content

iTick.org WebSocket clients must be able to handle many incoming messages per second. Due to the nature of the WebSocket protocol, if the client retrieves messages from the server slowly, iTick.org's server must buffer messages and send them at a rate the client can receive. If the client consumes messages at too slow a rate for an extended period, iTick.org's server-side buffer may become too large. If this happens, iTick.org will terminate the WebSocket connection. If you frequently encounter this situation, consider subscribing to fewer symbols or channels.

After successful subscription, data is sent according to the following content:

Trade Response Content

{
    "code": 1,
    "data": {
        "s": "GC$US",        // Code `symbol$region`
        "ld": 3034.15,       // Last price
        "v": 16742235,       // Volume
        "t": 1731689407000,  // Timestamp
        "type": "tick"       // types tick、quote、depth
    }
}

Quote Response Content

{
    "code": 1,
    "data": {
        "s": "GC$US",            // Code `symbol$region`
        "ld": 3034.25,           // Last price
        "o": 3034.27,            // Open
        "h": 3034.92,            // High
        "l": 3034.44,            // Low
        "t": 1731689407000,      // Timestamp
        "v": 16742235,           // Volume (Daily Trading Volume)
        "tu": 3774688301.452,    // Turnover (Daily Trading Value)
        "type": "quote"          // types tick、quote、depth
    }
}

Order Book Response Content

{
    "code": 1,
    "data": {
        "s": "GC$US",            // Code `symbol$region`
        "a": [                   // Ask
            {
                "po": 1,         // Levels
                "p": 3034.01,    // Ask Price
                "v": 10.6023,    // Ask Volume
                "o": 10.6023     // Ask Size
            }
        ],
        "b": [                   // Bid
            {
                "po": 1,         // Levels
                "p": 3034,       // Bid Price
                "v": 20.9758,    // Bid Volume
                "o": 20.9758     // Bid Size
            }
        ],
        "type": "depth"          // types tick、quote、depth
    }
}

Candlestick Response Content

{
    "code": 0,
    "msg": null,
    "data": {
        "s":"GC$US",              // Code `symbol$region`
        "t":1,                    // Kline period
        "k":{
            "tu": 157513,         // Turnover (for the Current Period/Interval)
            "c": 3059.39,         // Close (for the Current Period/Interval)
            "t": 1731660060000,   // Timestamp
            "v": 28,              // Volume (for the Current Period/Interval)
            "h": 3061.41,         // High (for the Current Period/Interval)
            "l": 3055.24,         // Low (for the Current Period/Interval)
            "o": 3055.36          // Open (for the Current Period/Interval)
        }
     }
}

t Kline period: Period 1 minute, 2 five minutes, 3 fifteen minutes, 4 thirty minutes, 5 one hour, 8 one day, 9 one week, 10 one month

Step 5: Heartbeat Maintenance

The client must transmit heartbeat packets to the server. If no heartbeat is received for over one (1) minute, the server will terminate the connection after a grace period. To maintain a stable connection, it is recommended that the client issues a keepalive signal at least every 30 seconds.

{
  "ac":"ping",
  "params":"1731688569840"
}

Server sends to client:

{
  "resAc":"pong",
  "data": {"params":"1731688569840"}
}

The timestamps in ping and pong must be consistent

  1. Stock QuotesWebsocket API

    Global stock WebSocket real-time market API, covering multiple global markets including US stocks, Hong Kong stocks, and A-shares, with millisecond-level push of Level 1 & Level 2 data. Services include tick transactions, five/ten-level order books, and K-line updates.

  2. Websocket APIFund Quotes

    Provides WebSocket real-time market data streams for exchange-traded funds (ETFs/LOFs), fully pushing real-time prices, trading volumes, IOPV net asset value estimates, and order book depth changes for funds. The data covers all categories of funds including equity ETFs, bond ETFs, and commodity ETFs, with millisecond-level low-latency delivery.