Skip to main content

Message Schema

This page documents the payload formats pushed by TickDB WebSocket.

Common Fields

Most server messages use:
FieldTypeDescription
cmdstringMessage type (usually equals channel name)
dataobjectPayload data
timestamp fields are milliseconds (ms).

ticker Message

Example

{
  "cmd": "ticker",
  "data": {
    "symbol": "AAPL.US",
    "last_price": "150.25",
    "timestamp": 1703123456789
  }
}

Fields

FieldTypeDescription
symbolstringTrading symbol
last_pricestringLast traded price
timestampintServer timestamp in ms

depth Message (Stocks & Crypto only)

Example

{
  "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 Message (Stocks & Crypto only)

Example

{
  "cmd": "trade",
  "data": {
    "symbol": "AAPL.US",
    "price": "150.25",
    "quantity": "100",
    "side": "buy",
    "timestamp": 1703123456789
  }
}

Fields

FieldTypeDescription
symbolstringTrading symbol
pricestringTrade price
quantitystringTrade quantity
sidestringbuy or sell
timestampintServer timestamp in ms