Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.tickdb.ai/llms.txt

Use this file to discover all available pages before exploring further.

This page documents WebSocket channels, how to subscribe/unsubscribe, and the message formats for each channel.

Supported Channels

ChannelDescriptionSupported Markets
tickerReal-time ticker updatesForex, Metals, Indices, US Stocks, HK Stocks, A-Shares, Crypto
depthOrder book depth updatesUS Stocks, HK Stocks, A-Shares, Crypto
tradeTrade recordsHK Stocks, Crypto

ticker Channel

Subscribe

{
  "cmd": "subscribe",
  "data": {
    "channel": "ticker",
    "symbols": ["AAPL.US", "BTCUSDT"]
  }
}

Unsubscribe

{
  "cmd": "unsubscribe",
  "data": {
    "channel": "ticker",
    "symbols": ["AAPL.US"]
  }
}

Server Response

The ticker message returns different fields based on market type.

Index

{
  "cmd": "ticker",
  "data": {
    "symbol": "SPX",
    "last_price": "6703.59",
    "ask_price": "0.00",
    "bid_price": "0.00",
    "type": "index",
    "timestamp": 1773331355037
  }
}

Metals

{
  "cmd": "ticker",
  "data": {
    "symbol": "XAUUSD",
    "last_price": "5130.72000",
    "ask_price": "5131.07000",
    "bid_price": "5130.37000",
    "spread": "0.70000",
    "exchange": 48,
    "timestamp": 1773334355000
  }
}

Forex

{
  "cmd": "ticker",
  "data": {
    "symbol": "EURUSD",
    "last_price": "1.15200",
    "ask_price": "1.15202",
    "bid_price": "1.15199",
    "spread": "0.00003",
    "exchange": 48,
    "timestamp": 1773334426000
  }
}

Stocks

{
  "cmd": "ticker",
  "data": {
    "symbol": "TSLA.US",
    "last_price": "400.67",
    "timestamp": 1773335203000
  }
}
{
  "cmd": "ticker",
  "data": {
    "symbol": "600519.SH",
    "last_price": "1401",
    "timestamp": 1769756400000
  }
}

Crypto

{
  "cmd": "ticker",
  "data": {
    "symbol": "BTCUSDT",
    "last_price": "70480.57000000",
    "volume_24h": "23737.52989000",
    "high_24h": "71321.00000000",
    "low_24h": "69205.91000000",
    "price_change_24h": "-362.06000000",
    "price_change_percent_24h": "-0.511",
    "timestamp": 1773335135026
  }
}

Fields

FieldTypeDescriptionMarkets
symbolstringTrading symbolAll
last_pricestringLast traded priceAll
timestampintServer timestamp in msAll
ask_pricestringAsk priceForex, Metals, Index
bid_pricestringBid priceForex, Metals, Index
spreadstringBid-ask spreadForex, Metals
exchangeintExchange codeForex, Metals
typestringType identifier (e.g., “index”)Index
volume_24hstring24-hour trading volumeCrypto
high_24hstring24-hour high priceCrypto
low_24hstring24-hour low priceCrypto
price_change_24hstring24-hour price changeCrypto
price_change_percent_24hstring24-hour price change percentageCrypto

depth Channel

Subscribe

{
  "cmd": "subscribe",
  "data": {
    "channel": "depth",
    "symbols": ["AAPL.US", "BTCUSDT"]
  }
}

Unsubscribe

{
  "cmd": "unsubscribe",
  "data": {
    "channel": "depth",
    "symbols": ["AAPL.US"]
  }
}

Server Response

{
  "cmd": "depth",
  "data": {
    "symbol": "BTCUSDT",
    "bids": [
      ["43250.50", "0.125"],
      ["43250.00", "0.250"]
    ],
    "asks": [
      ["43251.00", "0.180"],
      ["43251.50", "0.320"]
    ],
    "timestamp": 1703123456789
  }
}

Fields

FieldTypeDescription
symbolstringTrading symbol
bidsarrayBid levels: [price, quantity]
asksarrayAsk levels: [price, quantity]
timestampintServer timestamp in ms
Ordering
  • bids: price descending
  • asks: price ascending

trade Channel

Subscribe

{
  "cmd": "subscribe",
  "data": {
    "channel": "trade",
    "symbols": ["700.HK", "BTCUSDT"]
  }
}

Unsubscribe

{
  "cmd": "unsubscribe",
  "data": {
    "channel": "trade",
    "symbols": ["700.HK"]
  }
}

Server Response

{
  "cmd": "trade",
  "data": {
    "symbol": "700.HK",
    "trades": [
      {
        "id": "20950",
        "price": "553.000",
        "quantity": "100",
        "side": "buy",
        "timestamp": 1773371154
      }
    ]
  }
}

Fields

FieldTypeDescription
symbolstringTrading symbol
tradesarrayArray of trade records
└─ idstringTrade ID
└─ pricestringTrade price
└─ quantitystringTrade quantity
└─ sidestringbuy or sell
└─ timestampintTrade timestamp (seconds)