Skip to main content
WSS
/
market
/
ws
Messages
Quote Update
type:object

Real-time quote update for a subscribed symbol

Trade Update
type:object

Real-time trade/price update for a subscribed symbol

Level 2 / Order Book Update
type:object

Real-time Level 2 order book update showing market depth across exchanges

Time & Sales Update
type:object

Real-time trade execution from the time and sales feed

Error Response
type:object

Error message from the server

Auth Required Response
type:object

Server requests authentication

Refresh Auth Response
type:object

Server warns authentication expires soon

Auth Expired Response
type:object

Server notifies authentication has expired

Subscribe Request
type:object

Request to subscribe to market data for one or more symbols

Unsubscribe Request
type:object

Request to unsubscribe from market data

Ping Request
type:object

Keep-alive ping message

Get Expiry Dates Request
type:object

Request to get option expiration dates for a symbol

Get Contract Symbols Request
type:object

Request to get option contract symbols for a symbol and expiry date

Get Equity Snapshot Request
type:object

Request to get a full snapshot of equity data for a symbol

Auth Request
type:object

Request to authenticate the WebSocket connection

Key Features

Field-Level Subscriptions

Choose specific quote/trade fields or use wildcard * for all fields. Minimize bandwidth by requesting only the data you need.

Real-Time Updates

NDJSON message framing for optimal performance with millisecond-level latency.

Initial Snapshot

Get the current market state immediately upon connecting. Data is retrieved from cache with automatic fallback mechanisms.

Multi-Symbol Support

Subscribe to multiple symbols in a single request for efficient batch subscriptions.

Equities & Options

Stream real-time data for stocks and option contracts using OSI symbols.

Market Indices

Track major indices including SPX, NDX, DJI, VIX, and more in real-time.

Equities

Standard stock ticker symbols (e.g., AAPL, MSFT, GOOGL, TSLA).

Indices

Major market indices are supported: SPX (S&P 500), NDX (Nasdaq 100), DJI (Dow Jones), VIX (Volatility Index), RUT (Russell 2000), COMP (Nasdaq Composite), NYA (NYSE Composite), OEX (S&P 100), MID (S&P MidCap 400), SML (S&P SmallCap 600).
Index symbols do not have bid/ask quote data. When subscribing to indices, use trade fields (lastPrice, openPrice, highPrice, lowPrice, etc.).

Options

Option contracts use OSI (Options Symbology Initiative) symbols (e.g., AAPL240119C00150000 for AAPL Jan 19 2024 $150 Call).When subscribing to options, set symbolType: "option" in your subscription request.

Quote Data

Real-time bid/ask prices from the consolidated order book (NBBO - National Best Bid and Offer).

Trade Data

Last sale information, volume, and OHLC (Open-High-Low-Close) prices.

Level 2 / Order Book Data

Market depth showing quotes from multiple exchanges. Provides insight into supply and demand at different price levels across all market makers and exchanges.

Time & Sales Data

Real-time trade execution feed showing every trade as it happens, including price, size, timestamp, and exchange. Essential for tape reading and order flow analysis.
Level 2 data does not provide an initial snapshot - you will receive updates as they arrive from the market feed.
For performance optimization, the server may coalesce multiple messages into a single WebSocket frame, separated by newline characters (\n). This is known as Newline-Delimited JSON (NDJSON).Clients MUST handle this by splitting incoming WebSocket frames on newline characters and parsing each line as a separate JSON message.

Example

A single WebSocket frame may contain:
{"action":"snapshot","type":"quote","symbol":"MSFT",...}
{"action":"snapshot","type":"quote","symbol":"AAPL",...}
Clients should split on \n and parse each line independently.

WebSocket Client

Library that supports WSS protocol for secure WebSocket connections.

Authentication

Valid authentication token (if required by your environment).

JSON Parser

NDJSON message format handling capability for parsing streaming data.

Network Connectivity

Stable network connection to the WebSocket endpoint.

Portfolio Monitoring

Live price updates, bid/ask spreads, and intraday performance tracking for your holdings.

Trading Applications

Real-time market prices for order entry systems and trade execution platforms.

Market Dashboards

Display market trends and index movements (SPX, NDX, VIX) on your analytics dashboard.

Price Alert Systems

Trigger notifications on price thresholds, volume spikes, or custom market conditions.

Market Analysis Tools

Real-time data feeds for technical analysis and market research applications.

Subscribing to Market Data

Basic Subscription Structure

All subscription requests follow this format:
{
  "type": "subscribe",
  "id": "optional-correlation-id",
  "payload": [
    {
      "symbol": "AAPL",
      "symbolType": "equity",  // "equity" or "option"
      "quoteFields": ["bidPrice", "askPrice"],
      "tradeFields": ["lastPrice", "volume"],
      "level2": false,
      "timeAndSales": false
    }
  ]
}

Subscription Examples

Subscribe to Trade Fields Only

Get just price and size data for AAPL:
{
  "type": "subscribe",
  "id": "sub-1",
  "payload": [
    {
      "symbol": "AAPL",
      "tradeFields": ["price", "size"]
    }
  ]
}

Subscribe to Quotes with Default Fields

When you don’t specify quoteFields, you get default quote fields:
{
  "type": "subscribe",
  "id": "sub-2",
  "payload": [
    {
      "symbol": "AAPL"
    }
  ]
}

Subscribe to All Fields Using Wildcard

Use "*" to subscribe to all available fields:
{
  "type": "subscribe",
  "id": "sub-4",
  "payload": [
    {
      "symbol": "GOOGL",
      "quoteFields": ["*"],
      "tradeFields": ["*"]
    }
  ]
}

Subscribe to Specific Quote Fields for Multiple Symbols

{
  "type": "subscribe",
  "id": "sub-3",
  "payload": [
    {
      "symbol": "AAPL",
      "quoteFields": ["bidPrice", "bidSize", "askPrice", "askSize", "midPrice", "spread"]
    },
    {
      "symbol": "MSFT",
      "quoteFields": ["bidPrice", "bidSize", "askPrice", "askSize", "midPrice", "spread"]
    }
  ]
}

Subscribe to Multiple Symbols with Different Fields

Different symbols can have different field subscriptions:
{
  "type": "subscribe",
  "id": "sub-6",
  "payload": [
    {
      "symbol": "AAPL",
      "tradeFields": ["lastPrice", "size", "netChange", "tick"]
    },
    {
      "symbol": "MSFT",
      "quoteFields": ["bidPrice", "askPrice", "spread"]
    },
    {
      "symbol": "GOOGL",
      "quoteFields": ["*"],
      "tradeFields": ["*"]
    }
  ]
}

Subscribe to Level 2 Order Book Data

{
  "type": "subscribe",
  "id": "sub-l2-1",
  "payload": [
    {
      "symbol": "AAPL",
      "level2": true
    }
  ]
}

Subscribe to Time & Sales Data

{
  "type": "subscribe",
  "id": "sub-tns-1",
  "payload": [
    {
      "symbol": "AAPL",
      "timeAndSales": true
    }
  ]
}

Subscribe to Both Level 2 and Time & Sales

Perfect for tape reading and order flow analysis:
{
  "type": "subscribe",
  "id": "sub-l2-tns-1",
  "payload": [
    {
      "symbol": "AAPL",
      "level2": true,
      "timeAndSales": true
    }
  ]
}

Full Market Data Suite

Subscribe to quotes, trades, Level 2, and Time & Sales:
{
  "type": "subscribe",
  "id": "sub-full-1",
  "payload": [
    {
      "symbol": "AAPL",
      "quoteFields": ["bidPrice", "askPrice", "midPrice", "spread"],
      "tradeFields": ["lastPrice", "size", "totalVolume", "netChange"],
      "level2": true,
      "timeAndSales": true
    }
  ]
}

Subscribe to S&P 500 Index

Indices do not have bid/ask quote data. Use tradeFields only.
{
  "type": "subscribe",
  "id": "sub-7",
  "payload": [
    {
      "symbol": "SPX",
      "tradeFields": ["lastPrice", "openPrice", "highPrice", "lowPrice", "netChange", "totalVolume"]
    }
  ]
}

Subscribe to Multiple Indices

{
  "type": "subscribe",
  "id": "sub-8",
  "payload": [
    {
      "symbol": "SPX",
      "tradeFields": ["lastPrice", "netChange"]
    },
    {
      "symbol": "NDX",
      "tradeFields": ["lastPrice", "netChange"]
    },
    {
      "symbol": "VIX",
      "tradeFields": ["lastPrice", "netChange"]
    }
  ]
}

Mixed Equities and Indices

{
  "type": "subscribe",
  "id": "sub-9",
  "payload": [
    {
      "symbol": "AAPL",
      "quoteFields": ["bidPrice", "askPrice", "midPrice"],
      "tradeFields": ["lastPrice", "netChange"]
    },
    {
      "symbol": "SPX",
      "tradeFields": ["lastPrice", "openPrice", "highPrice", "lowPrice"]
    }
  ]
}

Subscribe to a Single Option Contract

Options use OSI (Options Symbology Initiative) symbols. You must set symbolType: "option".
{
  "type": "subscribe",
  "id": "sub-10",
  "payload": [
    {
      "symbol": "AAPL240119C00150000",
      "symbolType": "option",
      "quoteFields": ["bidPrice", "askPrice", "midPrice", "spread"],
      "tradeFields": ["lastPrice", "volume", "openInterest"]
    }
  ]
}

Subscribe to Multiple Option Contracts

{
  "type": "subscribe",
  "id": "sub-11",
  "payload": [
    {
      "symbol": "AAPL240119C00150000",
      "symbolType": "option",
      "quoteFields": ["bidPrice", "askPrice"],
      "tradeFields": ["lastPrice"]
    },
    {
      "symbol": "AAPL240119C00155000",
      "symbolType": "option",
      "quoteFields": ["bidPrice", "askPrice"],
      "tradeFields": ["lastPrice"]
    },
    {
      "symbol": "AAPL240119P00145000",
      "symbolType": "option",
      "quoteFields": ["bidPrice", "askPrice"],
      "tradeFields": ["lastPrice"]
    }
  ]
}

Available Fields Reference

All available fields you can subscribe to, organized by data type.

Quote Fields

Subscribe to these fields using the quoteFields array. Use ["*"] for all fields.
FieldDescription
*Wildcard - Subscribe to all available quote fields
bidPriceCurrent best bid price - the highest price a buyer is willing to pay
bidChangeChange in bid price from the previous quote update
bidSizeNumber of shares available at the bid price (typically in round lots of 100)
bidSizeChangeChange in bid size from the previous quote update
bidTimestampUnix timestamp in milliseconds when the bid was last updated
bidExchangeExchange code where the best bid originated (e.g., ‘Q’ for NASDAQ, ‘N’ for NYSE)
askPriceCurrent best ask (offer) price - the lowest price a seller is willing to accept
askChangeChange in ask price from the previous quote update
askSizeNumber of shares available at the ask price (typically in round lots of 100)
askSizeChangeChange in ask size from the previous quote update
askTimestampUnix timestamp in milliseconds when the ask was last updated
askExchangeExchange code where the best ask originated (e.g., ‘Q’ for NASDAQ, ‘N’ for NYSE)
quoteTimestampUnix timestamp in milliseconds of the consolidated/top-of-book quote time
midPriceMidpoint price calculated as (bidPrice + askPrice) / 2
spreadBid-ask spread calculated as askPrice - bidPrice
Example:
"quoteFields": ["bidPrice", "askPrice", "bidSize", "askSize", "midPrice", "spread"]
Subscribe to these fields using the tradeFields array. Use ["*"] for all fields.
FieldDescription
*Wildcard - Subscribe to all available trade fields
priceLast trade execution price (same as lastPrice in most cases)
sizeNumber of shares in the last trade execution
totalVolumeCumulative trading volume for the current session (total shares traded)
tickVolumeVolume of shares traded in the most recent tick/update
openPriceOpening price for the current trading session
highPriceHighest price reached during the current trading session
lowPriceLowest price reached during the current trading session
lastPriceMost recent trade price (last sale price)
netChangeNet price change from previous close (lastPrice - previousClosePrice)
tickTick direction indicator: ‘up’ (uptick), ‘down’ (downtick), or ‘unchanged’
tradeSeqTrade sequence number - monotonically increasing identifier for each trade
tradeTimestampUnix timestamp in milliseconds when the trade was executed
closePriceOfficial closing price (may be from current or previous session depending on market hours)
previousClosePricePrevious trading session’s official closing price, used to calculate netChange
Example:
"tradeFields": ["lastPrice", "size", "totalVolume", "netChange", "tick"]
For Indices: Use trade fields only. Indices do not have bid/ask quote data.
Subscribe to these fields using the timeAndSalesFields array when timeAndSales: true. Use ["*"] for all fields (default if not specified).
FieldDescription
*Wildcard - Subscribe to all available Time & Sales fields
symbolThe ticker symbol for the trade
priceTrade execution price
sizeNumber of shares in the trade
tickTick direction indicator: ‘up’ (uptick), ‘down’ (downtick), or ‘unchanged’
tradeSeqTrade sequence number - monotonically increasing identifier for each trade
tradeExchangeExchange code where the trade was executed (e.g., ‘Q’ for NASDAQ, ‘N’ for NYSE, ‘D’ for FINRA ADF)
tradeTimestampUnix timestamp in milliseconds when the trade was executed
Example:
{
  "symbol": "AAPL",
  "timeAndSales": true,
  "timeAndSalesFields": ["price", "size", "tick", "tradeTimestamp", "tradeExchange"]
}
Time & Sales shows every individual trade execution in real-time. Essential for tape reading and order flow analysis.
Level 2 data is enabled with level2: true. The response contains market depth across multiple exchanges in a compact format.
FieldDescription
symbolThe ticker symbol for the order book
orderBookArray of compact order book entries in format "bidSize:bidPrice:askSize"
quotesArray of exchange quotes in format "EXCHANGE:askPrice:askSize:bidPrice:bidSize"
timestampISO 8601 timestamp of the update
Order Book Format: Each entry in orderBook follows: "bidSize:bidPrice:askSize"
  • bidSize: Number of shares at bid (0 if no bid)
  • bidPrice: Bid price
  • askSize: Number of shares at ask (0 if no ask)
Quotes Format: Each entry in quotes follows: "EXCHANGE:askPrice:askSize:bidPrice:bidSize"
  • EXCHANGE: Exchange code (NSDQ, NYSE, BATS, EDGX, etc.)
  • askPrice: Ask price at this exchange
  • askSize: Number of shares at ask
  • bidPrice: Bid price at this exchange
  • bidSize: Number of shares at bid
Example Response:
Format Guide:
  • orderBook: askSize:price:bidSize (e.g., "0:250.00:100" = 0 shares ask, $250.00 price, 100 shares bid)
  • quotes: exchange:askPrice:askSize:bidPrice:bidSize (e.g., "EDGX:272.55:100:272.00:500" = EDGX exchange, 272.55askwith100shares,272.55 ask with 100 shares, 272.00 bid with 500 shares)
{
  "action": "update",
  "type": "level2nOB",
  "symbol": "AAPL",
  "data": {
    "orderBook": [
      "0:250.00:100",           // Format: askSize:price:bidSize
      "0:271.00:100",
      "0:272.00:1000",
      "45:272.49:0",
      "100:272.55:0"
    ],
    "quotes": [
      "EDGX:272.55:100:272.00:500",  // Format: exchange:askPrice:askSize:bidPrice:bidSize
      "BATS:272.58:300:271.00:100",
      "NSDQ:272.49:45:272.40:10"
    ],
    "symbol": "AAPL",
    "timestamp": "2025-12-29T05:18:33.600000-05:00"
  },
  "timestamp": 1767003513653
}
No Initial Snapshot: Level 2 data does not provide an initial snapshot. You will receive updates as they arrive from the market feed.

Unsubscribing from Market Data

The WebSocket supports three unsubscribe modes for flexible subscription management.
Remove all subscriptions for one or more symbols:
{
  "type": "unsubscribe",
  "id": "unsub-1",
  "payload": ["AAPL", "MSFT", "GOOGL"]
}
This removes all quote, trade, Level 2, and Time & Sales subscriptions for the specified symbols.

Unsubscribe Response

When you unsubscribe, the server confirms the action:
{
  "action": "unsubscribe",
  "type": "quote",
  "symbol": "AAPL",
  "id": "unsub-1",
  "timestamp": 1701450000123
}

Message Formats & Responses

Snapshot Responses

When you subscribe, you immediately receive a snapshot of current market data. The snapshot contains all requested fields.

Quote Snapshot Example

{
  "action": "snapshot",
  "type": "quote",
  "symbol": "AAPL",
  "symbolType": "equity",
  "data": {
    "bidPrice": 150.25,
    "bidSize": 500,
    "bidChange": 0.05,
    "bidSizeChange": 100,
    "bidTimestamp": 1701450000120,
    "bidExchange": "Q",
    "askPrice": 150.26,
    "askSize": 300,
    "askChange": 0.03,
    "askSizeChange": -50,
    "askTimestamp": 1701450000121,
    "askExchange": "N",
    "quoteTimestamp": 1701450000121,
    "midPrice": 150.255,
    "spread": 0.01
  },
  "id": "sub-1",
  "timestamp": 1701450000123
}
{
  "action": "snapshot",
  "type": "trade",
  "symbol": "AAPL",
  "symbolType": "equity",
  "data": {
    "price": 150.25,
    "lastPrice": 150.25,
    "size": 100,
    "totalVolume": 45678900,
    "tickVolume": 100,
    "openPrice": 149.50,
    "highPrice": 151.00,
    "lowPrice": 149.25,
    "closePrice": 149.80,
    "previousClosePrice": 149.80,
    "netChange": 0.45,
    "tick": "up",
    "tradeSeq": 123456,
    "tradeTimestamp": 1701450000123
  },
  "id": "sub-1",
  "timestamp": 1701450000125
}
Level 2 does not send an initial snapshot. You receive updates as they arrive.
Format Guide:
  • orderBook: askSize:price:bidSize
  • quotes: exchange:askPrice:askSize:bidPrice:bidSize
{
  "action": "update",
  "type": "level2nOB",
  "symbol": "AAPL",
  "data": {
    "orderBook": [
     // Format: askSize:price:bidSize
      "0:150.24:200",
      "0:150.24:300",
      "500:150.26:0",
      "300:150.26:0",
      "400:150.27:0"
    ],
    "quotes": [
    // Format: exchange:askPrice:askSize:bidPrice:bidSize
      "NSDQ:150.26:500:150.25:400",
      "NYSE:150.27:200:150.24:200",
      "PACF:150.26:300:150.24:300"
    ],
    "symbol": "AAPL",
    "timestamp": "2025-12-29T05:18:33.123000-05:00"
  },
  "timestamp": 1701450000123
}
{
  "action": "update",
  "type": "timeAndSales",
  "symbol": "AAPL",
  "data": {
    "symbol": "AAPL",
    "price": 150.26,
    "size": 250,
    "tick": "up",
    "tradeSeq": 123457,
    "tradeExchange": "Q",
    "tradeTimestamp": 1701450000456
  },
  "timestamp": 1701450000458
}
Each Time & Sales message represents a single trade execution. You may receive multiple messages per second during active trading.
{
  "action": "snapshot",
  "type": "quote",
  "symbol": "AAPL240119C00150000",
  "symbolType": "option",
  "data": {
    "bidPrice": 5.25,
    "askPrice": 5.30,
    "bidSize": 50,
    "askSize": 75,
    "midPrice": 5.275,
    "spread": 0.05
  },
  "id": "sub-opt-1",
  "timestamp": 1701450000123
}

Update Responses

After the snapshot, you receive real-time updates with only changed fields:

Quote Update

{
  "action": "update",
  "type": "quote",
  "symbol": "AAPL",
  "data": {
    "bidPrice": 150.26,     // Only changed fields
    "bidSize": 600,
    "bidChange": 0.01,
    "bidSizeChange": 100,
    "bidTimestamp": 1701450001450
  },
  "timestamp": 1701450001456
}
Bandwidth Optimization: Updates contain only fields that changed since the last message, minimizing network usage.
{
  "action": "update",
  "type": "trade",
  "symbol": "AAPL",
  "data": {
    "lastPrice": 150.27,
    "price": 150.27,
    "size": 200,
    "totalVolume": 45679100,
    "tickVolume": 200,
    "netChange": 0.47,
    "tick": "up",
    "tradeSeq": 123458,
    "tradeTimestamp": 1701450001500
  },
  "timestamp": 1701450001502
}

Response Structure

All server messages follow this structure:
FieldTypeDescription
actionstringMessage action: snapshot, update, unsubscribe, pong, or error
typestringData type: quote, trade, level2, or timeAndSales
symbolstringThe ticker symbol
symbolTypestringSymbol type: equity or option
dataobjectThe market data payload
idstringCorrelation ID (if provided in request)
timestampnumberUnix timestamp in milliseconds

Error Handling

Error Response Format

{
  "action": "error",
  "error": {
    "code": "INVALID_SYMBOL",
    "message": "Symbol 'INVALID' not found or not supported",
    "details": {
      "symbol": "INVALID",
      "symbolType": "equity"
    }
  },
  "id": "sub-1",
  "timestamp": 1701450000123
}

Common Error Codes

CodeDescriptionResolution
INVALID_SYMBOLSymbol not found or not supportedVerify the symbol ticker is correct
INVALID_FIELDRequested field name is invalidCheck field name against available fields
INVALID_SYMBOL_TYPESymbol type must be ‘equity’ or ‘option’Use correct symbolType value
SUBSCRIPTION_NOT_FOUNDAttempting to unsubscribe from non-existent subscriptionVerify you subscribed to this symbol first
RATE_LIMIT_EXCEEDEDToo many requests in a short time periodImplement exponential backoff
AUTHENTICATION_REQUIREDValid authentication token requiredInclude auth token in connection headers
INTERNAL_ERRORServer encountered an unexpected errorRetry the request after a delay
Always implement error handling in your WebSocket client to handle network issues, invalid requests, and server errors gracefully.

Connection Management

Ping/Pong Keepalive

Send periodic pings to keep the WebSocket connection alive and detect network issues: Client sends:
{
  "type": "ping",
  "id": "ping-001"
}
Server responds:
{
  "action": "pong",
  "id": "ping-001",
  "timestamp": 1701450000123
}
Recommended: Send a ping every 30-60 seconds to maintain the connection and detect disconnects quickly.

Handling Disconnects

const ws = new WebSocket('wss://api.aries.com/market/ws');

ws.onclose = (event) => {
  console.log('WebSocket closed:', event.code, event.reason);

  // Implement reconnection logic with exponential backoff
  setTimeout(() => {
    reconnect();
  }, getBackoffDelay());
};

ws.onerror = (error) => {
  console.error('WebSocket error:', error);
};
Implement exponential backoff for reconnections: start with 1 second, then 2s, 4s, 8s, up to a maximum of 60 seconds.

Request/Response Pattern

Besides streaming subscriptions, the WebSocket supports on-demand queries using a RESTful-style request/response pattern.

Get Option Expiry Dates

Query all available expiration dates for an underlying symbol: Request:
{
  "type": "request",
  "id": "req-expiry-1",
  "payload": {
    "method": "GET",
    "path": "/options/AAPL/expiry-dates"
  }
}
Response:
{
  "type": "response",
  "id": "req-expiry-1",
  "payload": {
    "status": 200,
    "data": {
      "symbol": "AAPL",
      "expiryDates": [
        "2024-01-19",
        "2024-02-16",
        "2024-03-15",
        "2024-04-19"
      ]
    }
  },
  "timestamp": 1701450000123
}
Caching: Expiry dates are cached for 24 hours for optimal performance.

Get Option Contract Symbols

Query all call and put contracts for a symbol and expiration date: Request:
{
  "type": "request",
  "id": "req-003",
  "payload": {
    "method": "GET",
    "path": "/options/AAPL/contracts/2024-01-19"
  }
}
Response:
{
  "type": "response",
  "id": "req-003",
  "payload": {
    "status": 200,
    "data": {
      "symbol": "AAPL",
      "expiryDate": "2024-01-19",
        "calls": [
          {
            "symbol": "AAPL240119C00145000",
            "strike": 145.00
          },
          {
            "symbol": "AAPL240119C00150000",
            "strike": 150.00
          }
        ],
        "puts": [
          {
            "symbol": "AAPL240119P00145000",
            "strike": 145.00
          },
          {
            "symbol": "AAPL240119P00150000",
            "strike": 150.00
          }
        ]
    }
  },
  "timestamp": 1701450000123
}
Caching: Contract symbols are cached for 1 hour for optimal performance.

Response Status Codes

StatusMeaning
200Success
400Bad Request - Invalid parameters
404Not Found - Symbol or resource not found
500Internal Server Error