Real-Time Index API SSE, Hang Seng, S&P 500, Nasdaq & WebSocket WEBSOCKET API Provides streaming access to the latest global index data, covering major core indices such as SSE Composite Index, CSI 300, Dow Jones, S&P 500, NASDAQ, and Hang Seng, pushing key data including latest prices, percentage changes, and trading volumes with millisecond-level low latency.

Indices WebSocket Documentation

The iTick Indices WebSocket API provides streaming access to the latest global indices data. You can specify the channels to use by sending instructions in the form of operations. When events occur in your subscribed channels, our WebSockets emit events to notify you.

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

Step 1: Connect

With the advanced 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/indices  -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: Subscribe

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

{
  "ac":"subscribe",
  "params":"DJI$GB,SPX$GB",
  "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.

Subscription successful response.

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

Subscription failure response. Below are respectively: exceeding the maximum subscription limit of the package plan, subscription parameter error.

{
  "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 servers must buffer messages and send them at a rate the client can receive. If the client consumes messages too slowly 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 as follows:

Trade Response Content

{
    "code": 1,
    "data": {
        "s": "DJI$GB",         // Code `symbol$region`
        "ld": 225.215,         // Latest price
        "v": 16742235,         // Volume
        "t": 1731689407000,    // Timestamp
        "type": "tick"         // types tick、quote、depth
    }
}

Quote Response Content

{
    "code": 1,
    "data": {
        "s": "DJI$GB",           // Code `symbol$region`
        "ld": 225.215,           // Latest price
        "o": 226.27,             // Open
        "h": 226.92,             // High
        "l": 224.44,             // Low
        "t": 1731689407000,      // Timestamp
        "v": 16742235,           // Volume (Daily Trading Volume)
        "tu": 3774688301.452,    // Turnover (Daily Trading Value)
        "type": "quote"          // types tick、quote、depth
    }
}

Market Depth Response Content

{
    "code": 1,
    "data": {
        "s": "DJI$GB",            // 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
    }
}

Kline Response Content

{
  "code": 1,
  "data": {
      "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)
      "type": "kline@1",    // Interval
      "s": "DJI",           // Code symbol
      "r": "GB"             // Code region
     }
}

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: Keep Alive

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 timestamp of ping and pong must be consistent

  1. Forex QuotesWebsocket API

    Provides streaming access to the latest global forex data, pushing real-time quotes, tick transactions, order book depth, and exchange rate changes for major currency pairs such as EUR, GBP, JPY, and CHF in real-time. The data sources cover multiple liquidity providers with millisecond-level low-latency delivery.

  2. Websocket APIStock Quotes

    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.