Fund Real-time Quotes WEBSOCKET API 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.

ETF Fund WebSocket Documentation

The iTick Fund WebSocket API provides streaming access to the latest data from major global ETF funds. 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/fund  -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":"QQQ$US",
  "types":"quote"
}

params: Symbol code, supports subscribing to multiple symbols
types: Subscription type - depth (order book), quote (quotes), tick (trades)

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": "QQQ$US",
        "ld": 225.215,
        "v": 16742235,
        "t": 1731689407000,
        "type": "tick"
    }
}

Quote Response Content

{
    "code": 1,
    "data": {
        "s": "QQQ$US",
        "ld": 3034,
        "t": 1731690011321,
        "v": 0.6186,
        "tu": 1876.832564,
        "ts": 0,
        "type": "quote"
    }
}

Order Book Response Content

{
    "code": 1,
    "data": {
        "s": "QQQ$US",
        "a": [
            {
                "po": 1,
                "p": 3034.01,
                "v": 10.6023,
                "o": 10.6023
            }
        ],
        "b": [
            {
                "po": 1,
                "p": 3034,
                "v": 20.9758,
                "o": 20.9758
            }
        ],
        "type": "depth"
    }
}

Candlestick Response Content

{
    "code": 0,
    "msg": null,
    "data": {
        "s":"QQQ$US",
        "t":1,
        "k":
        {
            "tu": 157513,
            "c": 3059.39,
            "t": 1731660060000,
            "v": 28,
            "h": 3061.41,
            "l": 3055.24,
            "o": 3055.36
        }
     }
}

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

Client sends to server:

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

Server sends to client:

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

The timestamps in ping and pong must be consistent