Market Data WebSocket API

Connect to our real-time market data WebSocket for live quotes, time & sales, level 2 order book data, and market status updates.

Connection URL

wss://api.tradearies.dev/v1/marketdata/ws

Authentication

Clients must authenticate upon connection. Request:
{
  "action": "auth",
  "token": "<USER_ACCESS_TOKEN>",
  "xAPIKey": "<APIKEY>"
}
Response:
{
  "action": "auth",
  "message": "success"
}

Ping Messages (Keep-Alive Support)

To keep the WebSocket connection alive, clients may periodically send a ping message.
This is Compulsory
Client Ping Message
{
  "action": "ping"
}
Response:
{
  "action": "ping",
  "message": "pong"
}

Market status messages

initial market status message is sent right after successful authentication with web socket. Consecutive updates are only sent if there is some change in any of the field values messages are automatically sent without any subscription message Light Green = Pre Market Green = Real Time Light Red = After Hours Red = Closed Response:
{
  "action": "publish",
  "type": "marketStatus",
  "data": {
    "afterHours": false,
    "currencies": {
      "crypto": "open",
      "fx": "open"
    },
    "earlyHours": false,
    "exchanges": {
      "nasdaq": "closed",
      "nyse": "closed",
      "otc": "closed"
    },
    "indicesGroups": {
      "cccy": "open",
      "cgi": "open",
      "dow_jones": "closed",
      "ftse_russell": "closed",
      "msci": "closed",
      "mstar": "open",
      "mstarc": "open",
      "nasdaq": "open",
      "s_and_p": "open",
      "societe_generale": "open"
    },
    "market": "closed",
    "serverTime": "2025-07-17T03:33:11.000Z"
  }
}

Subscriptions

Subscribe to Equity Quotes Request:
{
  "action": "subscribe",
  "type": "equityComposite",
  "data": [
    {
      "symbol": "AAPL",
      "fields": ["askPrice", "bidPrice", "askSize", "bidSize"]
    },
    {
      "symbol": "GOOGL",
      "fields": ["*"]
    }
  ]
}
Response:
{
  "type": "equityComposite",
  "data": {
    "symbol": "AAPL",
    "bidPrice": "1234",
    "askPrice": "1234"
  }
}
Subscribe to Option Quotes Request:
{
  "action": "subscribe",
  "type": "optionComposite",
  "data": [
    {
      "symbol": "SPXW250606P04200000",
      "fields": ["askPrice", "bidPrice", "askSize", "bidSize"]
    }
  ]
}
Response:
{
  "type": "optionComposite",
  "data": {
    "symbol": "AAPL250411C00100000",
    "bidPrice": "1234",
    "askPrice": "1234"
  }
}
Subscribe to Time and Sales Request:
{
  "action": "subscribe",
  "type": "timeAndSales",
  "data": [
    {
      "symbol": "AAPL"
    }
  ]
}
Response:
// INITIAL RESPONSE - only send once per subscription request
{
  "action": "subscribe",
  "type": "timeAndSales",
  "data": {
    "Snapshot": [
      {
        "symbol": "AAPL",
        "price": "212.46",
        "tick": "0",
        "tradeSeq": "1429781",
        "size": "10",
        "tradeExchange": "PACF|NYSE ARCA (Pacific)",
        "tradeTimestamp": "2025-07-07T07:03:02.752-04:00"
      },
      {
        "symbol": "AAPL",
        "price": "212.45",
        "tick": "0",
        "tradeSeq": "1429782",
        "size": "10",
        "tradeExchange": "PACF|NYSE ARCA (Pacific)",
        "tradeTimestamp": "2025-07-07T07:03:02.752-04:00"
      },
      {
        "symbol": "AAPL",
        "price": "212.44",
        "tick": "0",
        "tradeSeq": "1429784",
        "size": "1",
        "tradeExchange": "PACF|NYSE ARCA (Pacific)",
        "tradeTimestamp": "2025-07-07T07:03:02.753-04:00"
      }
    ]
  }
}

// CONSICUTIVE RESPONSE - active updates per symbol
{
    "type": "timeAndSales",
    "data": {
        "lastPrice": "0.00",
        "price": "212.40",
        "size": "11",
        "symbol": "AAPL",
        "tick": "0",
        "tradeExchange": "BATS|BATS Trading",
        "tradeSeq": "1.436256e+06",
        "tradeTimestamp": "2025-07-07T07:03:31.326-04:00"
    }
}
Subscribe to Level2 and Order book
{
  "action": "subscribe",
  "type": "lvl2nOB",
  "data": [
    {
      "symbol": "AAPL"
    }
  ]
}
Response:
{
  "type": "lvl2nOB",
  "data": {
    "symbol": "AAPL",
    "quotes": ["NSDQ:123.12:10:234.32:15", "ARSF:123.12:10:234.32:15"],
    "orderBook": ["12:123.12:25", "15:123.15:30"]
  }
}

Unsubscriptions

Unsubscribe from Stock Composite (quote + trade fields) Request:
{
  "action": "unsubscribe",
  "type": "equityComposite",
  "data": [
    {
      "symbol": "AAPL",
      "fields": ["askSize", "bidSize"]
    },
    {
      "symbol": "MSFT",
      "fields": ["*"]
    }
  ]
}
Unsubscribe from Option Quotes Request:
{
  "action": "unsubscribe",
  "type": "optionComposite",
  "data": [
    {
      "symbol": "SPXW250606P04200000",
      "fields": ["askSize", "bidSize"]
    }
  ]
}
Error Response
{
  "type": "equityComposite",
  "error": "error if any"
}

Request/Response Model

The Request/Response model allows clients to make REST-like HTTP calls over an active WebSocket connection. This is useful for fetching non-streaming, point-in-time data such as expiry dates or option chains without needing to open separate HTTP requests.

Key Points

  • Used for on-demand queries via WebSocket.
  • Integrates seamlessly into the same connection used for streaming quotes.
  • Response is matched to request using the unique id provided by the client.
Client Request
{
  "action": "request",
  "id": 123,
  "data": {
    "method": "get",
    "url": "/path",
    "body": {
      // JSON body if required
    }
  }
}
Server Response
{
  "action": "response",
  "id": 123,
  "data": {
    "status": 200,
    "content": {
      // JSON response body
    }
  }
}
Example – Get Expiry Dates for a symbol Request
{
  "action": "request",
  "id": "1",
  "data": {
    "method": "get",
    "url": "/options/AAPL/expiryDates"
  }
}
Response
{
  "action": "response",
  "id": "1",
  "data": {
    "status": 200,
    "content": {
      "symbol": "AAPL",
      "expiryDates": ["2026-01-16", "2026-02-16", "2026-03-16"]
    }
  }
}
Example2 – Get option symbol’s calls & puts Request
{
  "action": "request",
  "id": "123",
  "data": {
    "method": "get",
    "url": "/options/GOOG/expiryDates/2025-05-23"
  }
}
Response
{
  "action": "response",
  "id": "123",
  "data": {
    "status": 200,
    "content": {
      "calls": ["GOOG250523C00080000", "GOOG250523C00085000", "GOOG250523C00090000"],
      "puts": ["GOOG250523P00080000", "GOOG250523P00085000"]
    }z
  }
}
Example3 – Get Time and Sales for a symbol Request
{
  "action": "request",
  "id": "123",
  "data": {
    "method": "get",
    "url": "/options/tns/AAPL250626C05875000" // /equity/tns/AAPL
  }
}
Response
{
  "action": "response",
  "id": "123",
  "data": {
    "status": 200,
    "content": {
      "tns": [
        {
          "lastPrice": "123",
          "size": 1,
          "tradeTimestamp": "<value>"
        }
      ]
    }
  }
}
With above message, subscribe to lastPrice and tradeTimestamp Allowed common fields for equity and options
Field NameDescription
symbolTicker or option symbol
instrumentTypeType of instrument (e.g., equity = e, option = o)
priceCurrent price
sizeTrade size
totalVolumeTotal traded volume
tickVolumeNumber of ticks
openPriceOpening price of the session
highPriceSession high price
lowPriceSession low price
lastPriceLast traded price
netChangeNet change from previous close
tradeExchangeMPID | exchange name
tradeTimestampExchange-provided trade’s timestamp ISO8601 format - (2025-06-25T04:12:14.327-04:00)
askPriceAsk price
askChangeChange in ask price
askExchangeask exchange
askSizeAsk size
askSizeChangeChange in ask size
bidPriceBid price
bidChangeChange in bid price
bidExchangebid exchange
bidSizeBid size
bidSizeChangeChange in bid size
quoteTimestampExchange-provided quote’s timestamp ISO8601 format - (2025-06-25T04:12:14.327-04:00)
high52Weekhighest price in 52 week
low52Weeklowest price in 52 week
openInterestopen interest
dividendlatest ex dividend
*Wildcard to subscribe to all
tradeSeqtrade sequence uniquely assigned by exchange
tickTick for a particular trade