> ## Documentation Index
> Fetch the complete documentation index at: https://finance.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Charting WebSocket

> Real-time WebSocket API for TradingView chart data. Stream live quotes and trades for equities and options. Connect, authenticate, then subscribe to symbols.

<Note>
  **What this stream is for.** This WebSocket is a charting-specific feed designed to plug straight into the [TradingView Charting Library](https://www.tradingview.com/charting-library-docs/) or any chart widget that follows the TradingView data shape. If you're rendering candlestick or line charts in your app and need them to update in real time, use this feed. If you need full market depth, Greeks, or T\&S, use the [Market Data WebSocket](/websockets/market-data) instead.
</Note>

<AccordionGroup>
  <Accordion title="Key Features" icon="chart-candlestick" defaultOpen>
    <CardGroup cols={2}>
      <Card title="Connect Then Authenticate" icon="plug">
        Open a WebSocket to the endpoint, then send a **request** to **POST /auth** with your token. Subscribe only after **authSuccess**.
      </Card>

      <Card title="Real-Time Quotes" icon="chart-line">
        Stream live bid/ask, last price, OHLC, volume, and change for charting.
      </Card>

      <Card title="Real-Time Trades" icon="arrow-right-arrow-left">
        Receive last-trade updates (price, size, timestamp) for tape and chart integration.
      </Card>

      <Card title="Subscribed Quotes" icon="quotes">
        Subscribe to one or more symbols; receive **event** messages with quote and trade data for each subscribed symbol.
      </Card>

      <Card title="TradingView Format" icon="chart-mixed">
        Quote and trade payloads use TradingView-friendly field names for easy integration.
      </Card>

      <Card title="Equities & Options" icon="building">
        Support for stock tickers and OSI option symbols.
      </Card>

      <Card title="Keep-Alive" icon="heart-pulse">
        Ping/pong for connection health; optional correlation ID for pong.
      </Card>
    </CardGroup>
  </Accordion>

  <Accordion title="Connection Details" icon="plug">
    ### Endpoint

    Connect to the WebSocket at **`/v1/charts/ws`**.

    **Production:** `wss://api.aries.com/v1/charts/ws`\
    **Staging:** `wss://api.aries.com/v1/charts/ws`

    **Health check:** `GET /tv/health` (HTTP)

    ### Authentication

    **Authentication is required.** Use an OAuth2 access token (e.g. from `POST /v1/oauth2/token`). After the connection is open, send a **request** message with **method** `POST`, **path** `/auth`, and **body** `{ "token": "<your_access_token>" }`. Wait for a **response** with **action** `authSuccess` before sending subscribe messages. If the server returns **authRequired** or **error**, authentication failed (e.g. invalid or expired token).

    <Note>
      This WebSocket follows a TradingView-compatible message format. All request/response messages use the shared envelope: `type`, `id`, `payload` (with `method`, `path`, `body` for requests).
    </Note>
  </Accordion>

  <Accordion title="Supported Symbols" icon="tags">
    ### Equities

    Standard stock ticker symbols (e.g., `AAPL`, `MSFT`, `GOOGL`, `TSLA`). Use them exactly as a brokerage screen would display them.

    ### Options

    Option contracts use **OSI** (Options Symbology Initiative) symbols. Format: `ROOT + YYMMDD + C/P + strike-in-cents` (e.g., `AAPL240119C00150000` is the AAPL Jan-19-2024 \$150 Call).
  </Accordion>

  <Accordion title="Message Envelope" icon="envelope">
    Every message you send or receive uses the same outer JSON shape:

    | Field       | Type   | Required | What to put here                                                                                                                                                                                                                             |
    | ----------- | ------ | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
    | `type`      | string | Yes      | What kind of message this is. **Sent by you:** `request` (RPC-style call, e.g. auth), `subscribe`, `unsubscribe`, `ping`. **Sent by the server:** `event` (streaming push), `response` (reply to your request), `pong` (reply to your ping). |
    | `id`        | string | No       | A correlation ID you choose, like `"sub-aapl-1"`. The server echoes it back in the matching response/event so you can pair them up.                                                                                                          |
    | `timestamp` | string | No       | RFC3339 timestamp (e.g. `2026-05-13T10:30:00Z`). Optional on client messages; the server fills it in on outbound messages.                                                                                                                   |
    | `payload`   | object | Yes      | The actual body of the message. Shape depends on `type` — see the sections below.                                                                                                                                                            |
  </Accordion>

  <Accordion title="Data Types" icon="database">
    The subscription `payload.type` controls what kind of data the server streams back:

    * **`quotes`** (default) — Bid/ask, last price, OHLC, volume, change, change percent, exchange, and description. This is what most chart widgets need for the price/quote display.
    * **`bars`** — Time-series bar/candle data. Use `type: "bars"` in the subscribe payload when this is supported, primarily for incremental chart updates.
  </Accordion>

  <Accordion title="Use Cases" icon="lightbulb">
    <CardGroup cols={2}>
      <Card title="Live Chart Updates" icon="chart-candlestick">
        Display real-time price movements on interactive charts.
      </Card>

      <Card title="TradingView Widgets" icon="chart-line">
        Feed real-time data into TradingView charting library or embedded widgets.
      </Card>

      <Card title="Quote Displays" icon="quotes">
        Show last price, bid/ask, and volume in chart widgets (after authenticating).
      </Card>

      <Card title="Technical Analysis" icon="chart-line-up">
        Provide data for indicators and overlays in charting tools.
      </Card>
    </CardGroup>
  </Accordion>
</AccordionGroup>

***

## Connection

Connect to the Charting WebSocket the same way you would the Market Data WebSocket: **establish the connection**, then **authenticate**, then **subscribe** to symbols to receive real-time quotes and trades.

### Connect to the endpoint

Open a secure WebSocket connection to:

```
wss://api.aries.com/v1/charts/ws
```

### Authenticate

Immediately after the connection is open, send one **request** message to authenticate. Do **not** send subscribe messages until you receive a successful auth response.

Send the following auth message:

```json theme={null}
{
  "type": "request",
  "id": "auth-001",
  "payload": {
    "method": "POST",
    "path": "/auth",
    "body": {
      "token": "YOUR_ACCESS_TOKEN"
    }
  }
}
```

**Server responds (success):** `type: "response"`, with `payload.action: "authSuccess"`, optional `payload.id` (echoed from request), `payload.timestamp` (Unix milliseconds), and `payload.data.expiresIn` (session expiry in milliseconds).

**Server responds (failure):** `payload.action: "authRequired"` or `payload.action: "error"` with `payload.error` (e.g. "token is required", "authentication failed"). Reconnect or send a new auth request with a valid token.

### Subscribe to symbols

After **authSuccess**, send **subscribe** messages to start receiving quote and trade **event** messages for the requested symbols. See [Subscribing to Chart Data](#subscribing-to-chart-data) below.

***

## Subscribing to Chart Data

After you have connected and authenticated, you can subscribe to real-time quotes (and trades) for one or more symbols. Each subscription uses a **subscribe** message; the server then sends **event** messages containing quote/trade data for those symbols.

### Basic subscription structure

Send a **subscribe** message with `type` fixed as `"subscribe"`, any `id` you want (used to correlate the server's responses), and a `payload` describing what you want to receive:

| Payload field | Type   | Required | What to enter                                                                                                   |
| ------------- | ------ | -------- | --------------------------------------------------------------------------------------------------------------- |
| `type`        | string | Yes      | `"quotes"` for real-time price ticks (the common case), or `"bars"` for time-series candle/bar data.            |
| `symbol`      | string | Yes      | The instrument identifier — a stock ticker like `"AAPL"`, or an OSI option symbol like `"AAPL240119C00150000"`. |
| `symbolType`  | string | No       | `"symbol"` (default — for equities/indices) or `"option"` when subscribing to an option contract.               |

**Full message to send:**

```json theme={null}
{
  "type": "subscribe",
  "id": "sub-1",
  "payload": {
    "type": "quotes",
    "symbol": "AAPL"
  }
}
```

### Subscription examples

<AccordionGroup>
  <Accordion title="Single symbol (quotes)" icon="play" defaultOpen>
    Subscribe to real-time quotes for one equity:

    ```json theme={null}
    {
      "type": "subscribe",
      "id": "sub-1",
      "payload": { "type": "quotes", "symbol": "AAPL" }
    }
    ```

    You will receive **event** messages with `payload.type: "quotes"` and `payload.symbol: "AAPL"` containing `payload.data.quote` and `payload.data.trade`.
  </Accordion>

  <Accordion title="Multiple symbols (quotes)" icon="layer-group">
    Subscribe to quotes for several symbols by sending one subscribe message per symbol (each with its own `id` if needed):

    **First symbol:**

    ```json theme={null}
    {
      "type": "subscribe",
      "id": "sub-aapl",
      "payload": { "type": "quotes", "symbol": "AAPL" }
    }
    ```

    **Second symbol:**

    ```json theme={null}
    {
      "type": "subscribe",
      "id": "sub-msft",
      "payload": { "type": "quotes", "symbol": "MSFT" }
    }
    ```

    **Third symbol:**

    ```json theme={null}
    {
      "type": "subscribe",
      "id": "sub-googl",
      "payload": { "type": "quotes", "symbol": "GOOGL" }
    }
    ```

    The server sends **event** messages for each subscribed symbol; use `payload.symbol` to route updates.
  </Accordion>

  <Accordion title="Option contract (quotes)" icon="option">
    For option contracts, use the OSI symbol:

    ```json theme={null}
    {
      "type": "subscribe",
      "id": "sub-opt-1",
      "payload": { "type": "quotes", "symbol": "AAPL240119C00150000" }
    }
    ```
  </Accordion>

  <Accordion title="Another equity (quotes)" icon="quotes">
    ```json theme={null}
    {
      "type": "subscribe",
      "id": "sub-2",
      "payload": { "type": "quotes", "symbol": "TSLA" }
    }
    ```
  </Accordion>
</AccordionGroup>

***

## Connection Flow

<Steps>
  <Step title="Connect">
    Open a WebSocket connection to `wss://api.aries.com/v1/charts/ws`
  </Step>

  <Step title="Authenticate">
    Send a **request** message: `type: "request"`, `payload: { "method": "POST", "path": "/auth", "body": { "token": "<access_token>" } }`. Wait for a **response** with `payload.action: "authSuccess"`.
  </Step>

  <Step title="Subscribe">
    Send **subscribe** messages with `payload.type` and `payload.symbol` for each symbol you want.
  </Step>

  <Step title="Receive events">
    Process **event** messages containing quote and trade data for your subscribed symbols.
  </Step>

  <Step title="Unsubscribe (optional)">
    Send **unsubscribe** with the same symbol to stop updates.
  </Step>

  <Step title="Keep-Alive (optional)">
    Send **ping** periodically; server responds with **pong**.
  </Step>
</Steps>

***

## Client → Server Messages

### Subscribe

Provide `payload.type` and `payload.symbol`; the full message is built as:

```json theme={null}
{
  "type": "subscribe",
  "id": "sub-1",
  "payload": {
    "type": "quotes",
    "symbol": "AAPL"
  }
}
```

### Unsubscribe

Stop receiving updates for a symbol. Provide `payload.type` and `payload.symbol` (must match the subscription).

```json theme={null}
{
  "type": "unsubscribe",
  "id": "unsub-1",
  "payload": {
    "type": "quotes",
    "symbol": "AAPL"
  }
}
```

### Ping

Keep-alive; server responds with **pong**. Optional `id` is echoed in the pong.

```json theme={null}
{ "type": "ping", "id": "ping-1" }
```

***

## Server → Client Messages

### Event (quote/trade update)

Server pushes quote and/or trade data for subscribed symbols.

```json theme={null}
{
  "type": "event",
  "timestamp": "2026-02-23T18:36:59Z",
  "payload": {
    "type": "quotes",
    "symbol": "AAPL",
    "data": {
      "isDelayed": false,
      "quote": {
        "s": "ok",
        "n": "AAPL",
        "v": {
          "ch": 4.77,
          "chp": 1.80,
          "short_name": "AAPL",
          "exchange": "NASDAQ",
          "description": "Apple Inc.",
          "lp": 269.35,
          "ask": 269.36,
          "bid": 269.34,
          "open_price": 263.48,
          "high_price": 269.43,
          "low_price": 263.38,
          "prev_close_price": 264.58,
          "volume": 48234100.00
        }
      },
      "trade": {
        "s": "ok",
        "t": 1771871819,
        "lp": 269.35,
        "v": 100
      }
    },
    "timestamp": 1771871819072
  }
}
```

<Note>
  The field names below (`ch`, `chp`, `lp`, `n`, `v`, etc.) are TradingView's short-form keys. They look cryptic but they're standardized — the TradingView Charting Library expects exactly these names. **Do not rename them in your handler if you're piping data into a TradingView widget.**
</Note>

**Event `payload` fields:**

| Field       | Type    | Description                                                                            |
| ----------- | ------- | -------------------------------------------------------------------------------------- |
| `type`      | string  | Always `"quotes"` for quote/trade events.                                              |
| `symbol`    | string  | The symbol this event is about (e.g. `AAPL`). Match against your active subscriptions. |
| `data`      | object  | The quote and trade payload (see below).                                               |
| `timestamp` | integer | When the event was emitted, in Unix milliseconds.                                      |

**`payload.data` fields:**

| Field       | Type    | Description                                                                                                                         |
| ----------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| `quote`     | object  | Quote data. Contains `s` (status string, usually `"ok"`), `n` (the symbol), and `v` (the actual quote values — see next table).     |
| `trade`     | object  | Trade data (see below). Omitted if there's no recent trade to report.                                                               |
| `isDelayed` | boolean | `false` = real-time market data, `true` = the feed is delayed (typically 15 min). Show users a "delayed" badge when this is `true`. |

**`payload.data.quote.v` fields** — these are the values the chart actually plots. All numbers and all optional (only changed fields may be present in an update):

| Field              | Type   | What it represents                                                                                                               |
| ------------------ | ------ | -------------------------------------------------------------------------------------------------------------------------------- |
| `ch`               | number | **Change** — net price change from previous close (today's last price − yesterday's close). Drives the +/− indicator on a chart. |
| `chp`              | number | **Change percent** — `ch` expressed as a percent of previous close.                                                              |
| `short_name`       | string | Display ticker, e.g. `"AAPL"`.                                                                                                   |
| `exchange`         | string | Primary listing exchange, e.g. `"NASDAQ"`.                                                                                       |
| `description`      | string | Human-readable name, e.g. `"Apple Inc."` — what to show as the chart title.                                                      |
| `lp`               | number | **Last price** — most recent trade price. The number on the big "current price" label.                                           |
| `ask`              | number | Best ask (the lowest price someone is willing to sell at).                                                                       |
| `bid`              | number | Best bid (the highest price someone is willing to pay).                                                                          |
| `open_price`       | number | Today's opening price (first trade of the session).                                                                              |
| `high_price`       | number | Today's highest price so far.                                                                                                    |
| `low_price`        | number | Today's lowest price so far.                                                                                                     |
| `prev_close_price` | number | Yesterday's closing price — the baseline for calculating today's change.                                                         |
| `volume`           | number | Cumulative number of shares traded today.                                                                                        |

**`payload.data.trade` fields** — emitted whenever a new print appears on the tape:

| Field | Type    | What it represents                                                                                                   |
| ----- | ------- | -------------------------------------------------------------------------------------------------------------------- |
| `s`   | string  | Status — `"ok"` when the trade is valid.                                                                             |
| `t`   | integer | Trade timestamp in **Unix seconds** (note: trade `t` is seconds, but the outer `payload.timestamp` is milliseconds). |
| `lp`  | number  | Last trade price — the price the trade printed at.                                                                   |
| `v`   | integer | Trade size (number of shares/contracts).                                                                             |

### Response (auth or error)

Auth success: `type: "response"`, `payload.action: "authSuccess"`, optional `payload.id` (echoed request ID), `payload.timestamp` (Unix milliseconds), `payload.data.expiresIn` (session expiry in milliseconds).

Error (e.g. invalid subscribe): `type: "response"`, `payload.error` with message.

```json theme={null}
{
  "type": "response",
  "id": "sub-1",
  "payload": {
    "error": "symbol is required in payload",
    "timestamp": 1736946600123
  }
}
```

### Pong

Reply to **ping**.

```json theme={null}
{
  "type": "pong",
  "id": "ping-1",
  "timestamp": "2025-01-15T14:30:00Z"
}
```

***

## Quick Start Example

Connect, authenticate, then subscribe to quotes (same pattern as the Market Data WebSocket):

```javascript theme={null}
const ws = new WebSocket('wss://api.aries.com/v1/charts/ws');

ws.onopen = () => {
  // 1. Authenticate first
  ws.send(JSON.stringify({
    type: 'request',
    id: 'auth-001',
    payload: {
      method: 'POST',
      path: '/auth',
      body: { token: 'YOUR_OAUTH2_ACCESS_TOKEN' }
    }
  }));
};

ws.onmessage = (event) => {
  const msg = JSON.parse(event.data);

  if (msg.type === 'response' && msg.payload?.action === 'authSuccess') {
    // 2. After auth success, subscribe to quotes
    ws.send(JSON.stringify({
      type: 'subscribe',
      id: 'sub-1',
      payload: { type: 'quotes', symbol: 'AAPL' }
    }));
  } else if (msg.type === 'event' && msg.payload?.data) {
    const { quote, trade } = msg.payload.data;
    if (quote?.v) console.log('Quote:', quote.v.lp, quote.v.ch, quote.v.volume);
    if (trade) console.log('Trade:', trade.lp, trade.v, trade.t);
  } else if (msg.type === 'response' && msg.payload?.error) {
    console.error('Error:', msg.payload.error);
  } else if (msg.type === 'pong') {
    console.log('Pong received');
  }
};

// Optional keep-alive
const pingInterval = setInterval(() => {
  if (ws.readyState === WebSocket.OPEN) {
    ws.send(JSON.stringify({ type: 'ping', id: 'ping-1' }));
  }
}, 30000);

ws.onclose = () => clearInterval(pingInterval);
```

***

## Support

Need help with the Charting WebSocket?

<CardGroup cols={2}>
  <Card title="Email Support" icon="envelope">
    [dev@aries.com](mailto:dev@aries.com)
  </Card>

  <Card title="API Status" icon="activity">
    [status.aries.com](https://status.aries.com)
  </Card>
</CardGroup>


## AsyncAPI

````yaml asyncapi-specs/tradingview-chart.json chartDataStream
id: chartDataStream
title: Chart data stream
description: >-
  TradingView-compatible chart WebSocket. Authentication required: send request
  POST /auth with body { token: "<access_token>" } after connect, then subscribe
  to symbols for real-time quote and trade events.
servers:
  - id: production
    protocol: wss
    host: api.aries.com
    bindings: []
    variables: []
address: /v1/charts/ws
parameters: []
bindings: []
operations:
  - &ref_1
    id: authenticate
    title: Authenticate
    description: Sign in to the WebSocket
    type: receive
    messages:
      - &ref_10
        id: authRequest
        contentType: application/json
        payload:
          - name: Sign-in Request
            description: Sign in with access token
            type: object
            properties:
              - name: type
                type: string
                description: Set this to `request` when you authenticate.
                enumValues:
                  - request
                required: true
              - name: id
                type: string
                description: >-
                  Optional. Add your own request ID here if you want it returned
                  in the auth reply.
                required: false
              - name: timestamp
                type: string
                description: >-
                  Optional time when your client created this message, in
                  RFC3339 format.
                required: false
              - name: payload
                type: object
                description: Put the auth request details here.
                required: true
                properties:
                  - name: method
                    type: string
                    description: Use `POST` to send the token for authentication.
                    enumValues:
                      - POST
                    required: true
                  - name: path
                    type: string
                    description: Auth endpoint path. Always `/auth`.
                    enumValues:
                      - /auth
                    required: true
                  - name: body
                    type: object
                    description: >-
                      Request body for `/auth`. Put the token directly at
                      `body.token`.
                    required: true
                    properties:
                      - name: token
                        type: string
                        description: Access token for this WebSocket connection.
                        required: true
        headers: []
        jsonPayloadSchema:
          type: object
          description: Sign-in message. Send this first so the server can check your token.
          required:
            - type
            - payload
          properties:
            type:
              type: string
              enum:
                - request
              description: Set this to `request` when you authenticate.
              example: request
              x-parser-schema-id: <anonymous-schema-61>
            id:
              type: string
              description: >-
                Optional. Add your own request ID here if you want it returned
                in the auth reply.
              example: auth-001
              x-parser-schema-id: <anonymous-schema-62>
            timestamp:
              type: string
              format: date-time
              description: >-
                Optional time when your client created this message, in RFC3339
                format.
              x-parser-schema-id: <anonymous-schema-63>
            payload:
              type: object
              description: Put the auth request details here.
              required:
                - method
                - path
                - body
              properties:
                method:
                  type: string
                  enum:
                    - POST
                  description: Use `POST` to send the token for authentication.
                  example: POST
                  x-parser-schema-id: <anonymous-schema-65>
                path:
                  type: string
                  enum:
                    - /auth
                  description: Auth endpoint path. Always `/auth`.
                  example: /auth
                  x-parser-schema-id: <anonymous-schema-66>
                body:
                  type: object
                  required:
                    - token
                  description: >-
                    Request body for `/auth`. Put the token directly at
                    `body.token`.
                  properties:
                    token:
                      type: string
                      description: Access token for this WebSocket connection.
                      example: '{{user_access_token}}'
                      x-parser-schema-id: <anonymous-schema-68>
                  example:
                    token: '{{user_access_token}}'
                  x-parser-schema-id: <anonymous-schema-67>
              example:
                method: POST
                path: /auth
                body:
                  token: '{{user_access_token}}'
              x-parser-schema-id: <anonymous-schema-64>
          x-parser-schema-id: <anonymous-schema-60>
        title: Sign-in Request
        description: Sign in with access token
        example: |-
          {
            "type": "request",
            "id": "auth-001",
            "payload": {
              "method": "POST",
              "path": "/auth",
              "body": {
                "token": "{{user_access_token}}"
              }
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: authRequest
    bindings: []
    extensions: &ref_0
      - id: x-parser-unique-object-id
        value: chartDataStream
  - &ref_2
    id: subscribe
    title: Subscribe to symbol
    description: Subscribe to real-time quotes and/or trades for a symbol
    type: receive
    messages:
      - &ref_11
        id: subscribeRequest
        contentType: application/json
        payload:
          - name: Subscribe Request
            description: Subscribe to quotes/trades for a symbol
            type: object
            properties:
              - name: type
                type: string
                description: Set this to `subscribe` to start live updates.
                enumValues:
                  - subscribe
                required: true
              - name: id
                type: string
                description: >-
                  Optional. Add your own request ID here if you want the server
                  to send it back in related replies.
                required: false
              - name: payload
                type: object
                description: The symbol you want to start receiving updates for.
                required: true
                properties:
                  - name: type
                    type: string
                    description: >-
                      Optional data mode. Leave this empty to use the default
                      `quotes` mode. Use `bars` only when your client needs
                      chart bars.
                    enumValues:
                      - quotes
                      - bars
                    required: false
                  - name: symbol
                    type: string
                    description: >-
                      Stock or option symbol to stream. Examples: `AAPL`,
                      `MSFT`, or `AAPL240119C00150000`.
                    required: true
                  - name: symbolType
                    type: string
                    description: >-
                      Optional hint. You can usually leave this empty. Use
                      `option` if the symbol is an option.
                    enumValues:
                      - symbol
                      - option
                    required: false
        headers: []
        jsonPayloadSchema:
          type: object
          required:
            - type
            - payload
          properties:
            type:
              type: string
              enum:
                - subscribe
              description: Set this to `subscribe` to start live updates.
              example: subscribe
              x-parser-schema-id: <anonymous-schema-2>
            id:
              type: string
              description: >-
                Optional. Add your own request ID here if you want the server to
                send it back in related replies.
              example: sub-1
              x-parser-schema-id: <anonymous-schema-3>
            payload:
              type: object
              required:
                - symbol
              properties:
                type:
                  type: string
                  enum:
                    - quotes
                    - bars
                  description: >-
                    Optional data mode. Leave this empty to use the default
                    `quotes` mode. Use `bars` only when your client needs chart
                    bars.
                  default: quotes
                  example: quotes
                  x-parser-schema-id: <anonymous-schema-5>
                symbol:
                  type: string
                  description: >-
                    Stock or option symbol to stream. Examples: `AAPL`, `MSFT`,
                    or `AAPL240119C00150000`.
                  example: AAPL
                  x-parser-schema-id: <anonymous-schema-6>
                symbolType:
                  type: string
                  enum:
                    - symbol
                    - option
                  description: >-
                    Optional hint. You can usually leave this empty. Use
                    `option` if the symbol is an option.
                  example: option
                  x-parser-schema-id: <anonymous-schema-7>
              description: The symbol you want to start receiving updates for.
              example:
                type: quotes
                symbol: AAPL
              x-parser-schema-id: <anonymous-schema-4>
          description: Use this message to start live chart updates for one symbol.
          x-parser-schema-id: <anonymous-schema-1>
        title: Subscribe Request
        description: Subscribe to quotes/trades for a symbol
        example: |-
          {
            "type": "subscribe",
            "id": "sub-1",
            "payload": {
              "type": "quotes",
              "symbol": "AAPL"
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: subscribeRequest
    bindings: []
    extensions: *ref_0
  - &ref_3
    id: unsubscribe
    title: Unsubscribe from symbol
    description: Stop receiving updates for a symbol
    type: receive
    messages:
      - &ref_12
        id: unsubscribeRequest
        contentType: application/json
        payload:
          - name: Unsubscribe Request
            description: Unsubscribe from a symbol
            type: object
            properties:
              - name: type
                type: string
                description: Set this to `unsubscribe` to stop live updates.
                enumValues:
                  - unsubscribe
                required: true
              - name: id
                type: string
                description: >-
                  Optional. Add your own request ID here if you want the server
                  to send it back in related replies.
                required: false
              - name: payload
                type: object
                description: The symbol you want to stop receiving updates for.
                required: true
                properties:
                  - name: type
                    type: string
                    description: >-
                      Optional chart data mode. If you send it, use the same
                      value you used when subscribing. The current handler
                      unsubscribes by symbol either way.
                    enumValues:
                      - quotes
                      - bars
                    required: false
                  - name: symbol
                    type: string
                    description: Stock or option symbol to stop.
                    required: true
        headers: []
        jsonPayloadSchema:
          type: object
          required:
            - type
            - payload
          properties:
            type:
              type: string
              enum:
                - unsubscribe
              description: Set this to `unsubscribe` to stop live updates.
              example: unsubscribe
              x-parser-schema-id: <anonymous-schema-9>
            id:
              type: string
              description: >-
                Optional. Add your own request ID here if you want the server to
                send it back in related replies.
              example: unsub-1
              x-parser-schema-id: <anonymous-schema-10>
            payload:
              type: object
              required:
                - symbol
              properties:
                type:
                  type: string
                  enum:
                    - quotes
                    - bars
                  description: >-
                    Optional chart data mode. If you send it, use the same value
                    you used when subscribing. The current handler unsubscribes
                    by symbol either way.
                  example: quotes
                  x-parser-schema-id: <anonymous-schema-12>
                symbol:
                  type: string
                  description: Stock or option symbol to stop.
                  example: AAPL
                  x-parser-schema-id: <anonymous-schema-13>
              description: The symbol you want to stop receiving updates for.
              example:
                symbol: AAPL
              x-parser-schema-id: <anonymous-schema-11>
          description: Use this message to stop live chart updates for one symbol.
          x-parser-schema-id: <anonymous-schema-8>
        title: Unsubscribe Request
        description: Unsubscribe from a symbol
        example: |-
          {
            "type": "unsubscribe",
            "id": "unsub-1",
            "payload": {
              "type": "quotes",
              "symbol": "AAPL"
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: unsubscribeRequest
    bindings: []
    extensions: *ref_0
  - &ref_4
    id: ping
    title: Ping
    description: Keep-alive ping
    type: receive
    messages:
      - &ref_13
        id: pingRequest
        contentType: application/json
        payload:
          - name: Ping Request
            description: Keep-alive ping
            type: object
            properties:
              - name: type
                type: string
                description: >-
                  Set this to `ping` to check that the connection is still
                  alive.
                enumValues:
                  - ping
                required: true
              - name: id
                type: string
                description: >-
                  Optional. Add your own request ID here if you want it returned
                  in the `pong` reply.
                required: false
        headers: []
        jsonPayloadSchema:
          type: object
          required:
            - type
          properties:
            type:
              type: string
              enum:
                - ping
              description: Set this to `ping` to check that the connection is still alive.
              example: ping
              x-parser-schema-id: <anonymous-schema-15>
            id:
              type: string
              description: >-
                Optional. Add your own request ID here if you want it returned
                in the `pong` reply.
              example: ping-001
              x-parser-schema-id: <anonymous-schema-16>
          description: Use this message to check that the chart WebSocket is still alive.
          x-parser-schema-id: <anonymous-schema-14>
        title: Ping Request
        description: Keep-alive ping
        example: |-
          {
            "type": "<string>",
            "id": "<string>"
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: pingRequest
    bindings: []
    extensions: *ref_0
  - &ref_5
    id: receiveEvents
    title: Receive quote/trade events
    description: Receive real-time quote and trade data for subscribed symbols
    type: send
    messages:
      - &ref_14
        id: quoteTradeEvent
        contentType: application/json
        payload:
          - name: Quote/Trade Event
            description: Server-pushed quote and/or trade update
            type: object
            properties:
              - name: type
                type: string
                description: The server sets this to `event` for live updates.
                enumValues:
                  - event
                required: false
              - name: timestamp
                type: string
                description: Time when the server sent this message, in RFC3339 format.
                required: false
              - name: payload
                type: object
                description: 'Inner fields: data type, symbol, nested quote/trade objects.'
                required: false
                properties:
                  - name: type
                    type: string
                    description: Data type for this update.
                    enumValues:
                      - quotes
                    required: false
                  - name: symbol
                    type: string
                    description: Symbol this update is for.
                    required: false
                  - name: data
                    type: object
                    description: >-
                      Quote and/or trade objects (TradingView-style fields
                      inside `quote` / `trade`).
                    required: false
                    properties:
                      - name: quote
                        type: object
                        description: TradingView-format quote snapshot.
                        required: false
                        properties:
                          - name: s
                            type: string
                            description: Status (e.g. `ok`).
                            required: false
                          - name: 'n'
                            type: string
                            description: Symbol name.
                            required: false
                          - name: v
                            type: object
                            description: Quote values.
                            required: false
                            properties:
                              - name: ch
                                type: number
                                description: Price change.
                                required: false
                              - name: chp
                                type: number
                                description: Change percent.
                                required: false
                              - name: short_name
                                type: string
                                description: Symbol short name.
                                required: false
                              - name: exchange
                                type: string
                                description: Exchange.
                                required: false
                              - name: description
                                type: string
                                description: Instrument description.
                                required: false
                              - name: lp
                                type: number
                                description: Last price.
                                required: false
                              - name: ask
                                type: number
                                description: Ask price.
                                required: false
                              - name: bid
                                type: number
                                description: Bid price.
                                required: false
                              - name: open_price
                                type: number
                                description: Open price.
                                required: false
                              - name: high_price
                                type: number
                                description: High price.
                                required: false
                              - name: low_price
                                type: number
                                description: Low price.
                                required: false
                              - name: prev_close_price
                                type: number
                                description: Previous close price.
                                required: false
                              - name: volume
                                type: number
                                description: Cumulative volume.
                                required: false
                      - name: trade
                        type: object
                        description: >-
                          Last trade data. Omitted if no recent trade is
                          available.
                        required: false
                        properties:
                          - name: s
                            type: string
                            description: Status (e.g. `ok`).
                            required: false
                          - name: t
                            type: integer
                            description: Trade timestamp (Unix seconds).
                            required: false
                          - name: lp
                            type: number
                            description: Last trade price.
                            required: false
                          - name: v
                            type: integer
                            description: Trade size.
                            required: false
                      - name: isDelayed
                        type: boolean
                        description: '`true` if the data is delayed.'
                        required: false
                  - name: error
                    type: string
                    description: >-
                      Present when the server reports an error for this
                      symbol/update.
                    required: false
                  - name: timestamp
                    type: integer
                    description: Event time in Unix milliseconds.
                    required: false
        headers: []
        jsonPayloadSchema:
          type: object
          description: >-
            Server event with the latest chart quote and trade data for one
            symbol.
          properties:
            type:
              type: string
              enum:
                - event
              description: The server sets this to `event` for live updates.
              x-parser-schema-id: <anonymous-schema-18>
            timestamp:
              type: string
              format: date-time
              description: Time when the server sent this message, in RFC3339 format.
              x-parser-schema-id: <anonymous-schema-19>
            payload:
              type: object
              description: 'Inner fields: data type, symbol, nested quote/trade objects.'
              properties:
                type:
                  type: string
                  enum:
                    - quotes
                  description: Data type for this update.
                  x-parser-schema-id: <anonymous-schema-21>
                symbol:
                  type: string
                  description: Symbol this update is for.
                  x-parser-schema-id: <anonymous-schema-22>
                data:
                  type: object
                  description: >-
                    Quote and/or trade objects (TradingView-style fields inside
                    `quote` / `trade`).
                  properties:
                    quote:
                      type: object
                      description: TradingView-format quote snapshot.
                      properties:
                        s:
                          type: string
                          description: Status (e.g. `ok`).
                          x-parser-schema-id: <anonymous-schema-25>
                        'n':
                          type: string
                          description: Symbol name.
                          x-parser-schema-id: <anonymous-schema-26>
                        v:
                          type: object
                          description: Quote values.
                          properties:
                            ch:
                              type: number
                              description: Price change.
                              x-parser-schema-id: <anonymous-schema-28>
                            chp:
                              type: number
                              description: Change percent.
                              x-parser-schema-id: <anonymous-schema-29>
                            short_name:
                              type: string
                              description: Symbol short name.
                              x-parser-schema-id: <anonymous-schema-30>
                            exchange:
                              type: string
                              description: Exchange.
                              x-parser-schema-id: <anonymous-schema-31>
                            description:
                              type: string
                              description: Instrument description.
                              x-parser-schema-id: <anonymous-schema-32>
                            lp:
                              type: number
                              description: Last price.
                              x-parser-schema-id: <anonymous-schema-33>
                            ask:
                              type: number
                              description: Ask price.
                              x-parser-schema-id: <anonymous-schema-34>
                            bid:
                              type: number
                              description: Bid price.
                              x-parser-schema-id: <anonymous-schema-35>
                            open_price:
                              type: number
                              description: Open price.
                              x-parser-schema-id: <anonymous-schema-36>
                            high_price:
                              type: number
                              description: High price.
                              x-parser-schema-id: <anonymous-schema-37>
                            low_price:
                              type: number
                              description: Low price.
                              x-parser-schema-id: <anonymous-schema-38>
                            prev_close_price:
                              type: number
                              description: Previous close price.
                              x-parser-schema-id: <anonymous-schema-39>
                            volume:
                              type: number
                              description: Cumulative volume.
                              x-parser-schema-id: <anonymous-schema-40>
                          x-parser-schema-id: <anonymous-schema-27>
                      x-parser-schema-id: <anonymous-schema-24>
                    trade:
                      type: object
                      description: >-
                        Last trade data. Omitted if no recent trade is
                        available.
                      properties:
                        s:
                          type: string
                          description: Status (e.g. `ok`).
                          x-parser-schema-id: <anonymous-schema-42>
                        t:
                          type: integer
                          description: Trade timestamp (Unix seconds).
                          x-parser-schema-id: <anonymous-schema-43>
                        lp:
                          type: number
                          description: Last trade price.
                          x-parser-schema-id: <anonymous-schema-44>
                        v:
                          type: integer
                          description: Trade size.
                          x-parser-schema-id: <anonymous-schema-45>
                      x-parser-schema-id: <anonymous-schema-41>
                    isDelayed:
                      type: boolean
                      description: '`true` if the data is delayed.'
                      x-parser-schema-id: <anonymous-schema-46>
                  x-parser-schema-id: <anonymous-schema-23>
                error:
                  type: string
                  description: >-
                    Present when the server reports an error for this
                    symbol/update.
                  x-parser-schema-id: <anonymous-schema-47>
                timestamp:
                  type: integer
                  description: Event time in Unix milliseconds.
                  x-parser-schema-id: <anonymous-schema-48>
              x-parser-schema-id: <anonymous-schema-20>
          x-parser-schema-id: <anonymous-schema-17>
        title: Quote/Trade Event
        description: Server-pushed quote and/or trade update
        example: |-
          {
            "type": "event",
            "timestamp": "2026-02-23T18:36:59Z",
            "payload": {
              "type": "quotes",
              "symbol": "AAPL",
              "data": {
                "isDelayed": false,
                "quote": {
                  "s": "ok",
                  "n": "AAPL",
                  "v": {
                    "ch": 4.77,
                    "chp": 1.8,
                    "short_name": "AAPL",
                    "exchange": "NASDAQ",
                    "description": "Apple Inc.",
                    "lp": 269.35,
                    "ask": 269.36,
                    "bid": 269.34,
                    "open_price": 263.48,
                    "high_price": 269.43,
                    "low_price": 263.38,
                    "prev_close_price": 264.58,
                    "volume": 48234100
                  }
                },
                "trade": {
                  "s": "ok",
                  "t": 1771871819,
                  "lp": 269.35,
                  "v": 100
                }
              },
              "timestamp": 1771871819072
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: quoteTradeEvent
    bindings: []
    extensions: *ref_0
  - &ref_6
    id: receiveError
    title: Error Response
    description: Receive error messages from the server
    type: send
    messages:
      - &ref_15
        id: errorResponse
        contentType: application/json
        payload:
          - name: Error Response
            description: Error response for subscribe/unsubscribe or auth
            type: object
            properties:
              - name: type
                type: string
                description: The server sets this to `response` in the reply.
                enumValues:
                  - response
                required: false
              - name: id
                type: string
                description: >-
                  Request ID from the message that caused this error, if there
                  was one.
                required: false
              - name: payload
                type: object
                description: Error details from the server.
                required: false
                properties:
                  - name: action
                    type: string
                    description: >-
                      Present only for auth errors (`error` or `authRequired`).
                      Not included in subscribe/unsubscribe errors.
                    required: false
                  - name: error
                    type: string
                    description: Human-readable error message.
                    required: false
                  - name: timestamp
                    type: integer
                    description: Server time in Unix milliseconds.
                    required: false
        headers: []
        jsonPayloadSchema:
          type: object
          description: Error or failure response (subscribe/unsubscribe/auth).
          properties:
            type:
              type: string
              enum:
                - response
              description: The server sets this to `response` in the reply.
              x-parser-schema-id: <anonymous-schema-50>
            id:
              type: string
              description: >-
                Request ID from the message that caused this error, if there was
                one.
              x-parser-schema-id: <anonymous-schema-51>
            payload:
              type: object
              description: Error details from the server.
              properties:
                action:
                  type: string
                  description: >-
                    Present only for auth errors (`error` or `authRequired`).
                    Not included in subscribe/unsubscribe errors.
                  x-parser-schema-id: <anonymous-schema-53>
                error:
                  type: string
                  description: Human-readable error message.
                  x-parser-schema-id: <anonymous-schema-54>
                timestamp:
                  type: integer
                  description: Server time in Unix milliseconds.
                  x-parser-schema-id: <anonymous-schema-55>
              x-parser-schema-id: <anonymous-schema-52>
          x-parser-schema-id: <anonymous-schema-49>
        title: Error Response
        description: Error response for subscribe/unsubscribe or auth
        example: |-
          {
            "type": "<string>",
            "id": "<string>",
            "payload": {
              "action": "<string>",
              "error": "<string>",
              "timestamp": 123
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: errorResponse
    bindings: []
    extensions: *ref_0
  - &ref_7
    id: receiveAuthRequired
    title: Receive Auth Required
    description: Server requests authentication from the client
    type: send
    messages:
      - &ref_16
        id: authRequiredResponse
        contentType: application/json
        payload:
          - name: Auth Required Response
            description: Server requests authentication
            type: object
            properties:
              - name: type
                type: string
                description: Top-level message type. Always `response`.
                enumValues:
                  - response
                required: false
              - name: id
                type: string
                description: Request ID from the related client message, if there was one.
                required: false
              - name: payload
                type: object
                description: Auth-required details.
                required: false
                properties:
                  - name: action
                    type: string
                    description: Always `authRequired` for this message.
                    enumValues:
                      - authRequired
                    required: false
                  - name: id
                    type: string
                    description: Request ID from your auth message, if you sent one.
                    required: false
                  - name: error
                    type: string
                    description: Human-readable reason (e.g. missing token, timeout).
                    required: false
                  - name: timestamp
                    type: integer
                    description: Server time in Unix milliseconds.
                    required: false
        headers: []
        jsonPayloadSchema:
          type: object
          description: Server indicates the client must authenticate or re-authenticate.
          properties:
            type:
              type: string
              enum:
                - response
              description: Top-level message type. Always `response`.
              x-parser-schema-id: <anonymous-schema-79>
            id:
              type: string
              description: Request ID from the related client message, if there was one.
              x-parser-schema-id: <anonymous-schema-80>
            payload:
              type: object
              description: Auth-required details.
              properties:
                action:
                  type: string
                  enum:
                    - authRequired
                  description: Always `authRequired` for this message.
                  x-parser-schema-id: <anonymous-schema-82>
                id:
                  type: string
                  description: Request ID from your auth message, if you sent one.
                  x-parser-schema-id: <anonymous-schema-83>
                error:
                  type: string
                  description: Human-readable reason (e.g. missing token, timeout).
                  x-parser-schema-id: <anonymous-schema-84>
                timestamp:
                  type: integer
                  description: Server time in Unix milliseconds.
                  x-parser-schema-id: <anonymous-schema-85>
              x-parser-schema-id: <anonymous-schema-81>
          x-parser-schema-id: <anonymous-schema-78>
        title: Auth Required Response
        description: Server requests authentication
        example: |-
          {
            "type": "response",
            "payload": {
              "action": "authRequired",
              "error": "authentication required",
              "timestamp": 1701450000123
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: authRequiredResponse
    bindings: []
    extensions: *ref_0
  - &ref_8
    id: receiveAuthSuccess
    title: Receive auth success
    description: Successful authentication response
    type: send
    messages:
      - &ref_17
        id: authSuccessResponse
        contentType: application/json
        payload:
          - name: Auth Success Response
            description: Successful authentication response
            type: object
            properties:
              - name: type
                type: string
                description: Top-level message type. Always `response` for this message.
                enumValues:
                  - response
                required: false
              - name: id
                type: string
                description: >-
                  Echo of the client `id` from the auth request, if one was
                  sent.
                required: false
              - name: payload
                type: object
                description: Sign-in result, optional sign-in details, and server time.
                required: false
                properties:
                  - name: action
                    type: string
                    description: >-
                      Outcome of authentication. Always `authSuccess` for this
                      message.
                    enumValues:
                      - authSuccess
                    required: false
                  - name: id
                    type: string
                    description: Request ID from your auth message, if you sent one.
                    required: false
                  - name: data
                    type: object
                    description: Session details when provided by the server.
                    required: false
                    properties:
                      - name: expiresIn
                        type: integer
                        description: Suggested sign-in lifetime in milliseconds.
                        required: false
                  - name: timestamp
                    type: integer
                    description: Server time in Unix milliseconds.
                    required: false
        headers: []
        jsonPayloadSchema:
          type: object
          description: Server reply sent when authentication succeeds.
          properties:
            type:
              type: string
              enum:
                - response
              description: Top-level message type. Always `response` for this message.
              x-parser-schema-id: <anonymous-schema-70>
            id:
              type: string
              description: Echo of the client `id` from the auth request, if one was sent.
              x-parser-schema-id: <anonymous-schema-71>
            payload:
              type: object
              description: Sign-in result, optional sign-in details, and server time.
              properties:
                action:
                  type: string
                  enum:
                    - authSuccess
                  description: >-
                    Outcome of authentication. Always `authSuccess` for this
                    message.
                  x-parser-schema-id: <anonymous-schema-73>
                id:
                  type: string
                  description: Request ID from your auth message, if you sent one.
                  x-parser-schema-id: <anonymous-schema-74>
                data:
                  type: object
                  description: Session details when provided by the server.
                  properties:
                    expiresIn:
                      type: integer
                      description: Suggested sign-in lifetime in milliseconds.
                      x-parser-schema-id: <anonymous-schema-76>
                  x-parser-schema-id: <anonymous-schema-75>
                timestamp:
                  type: integer
                  description: Server time in Unix milliseconds.
                  x-parser-schema-id: <anonymous-schema-77>
              x-parser-schema-id: <anonymous-schema-72>
          x-parser-schema-id: <anonymous-schema-69>
        title: Auth Success Response
        description: Successful authentication response
        example: |-
          {
            "type": "response",
            "id": "auth-001",
            "payload": {
              "action": "authSuccess",
              "id": "auth-001",
              "data": {
                "expiresIn": 2700000
              },
              "timestamp": 1701450000123
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: authSuccessResponse
    bindings: []
    extensions: *ref_0
  - &ref_9
    id: receivePong
    title: Receive pong
    description: Keep-alive pong response to ping
    type: send
    messages:
      - &ref_18
        id: pongResponse
        contentType: application/json
        payload:
          - name: Pong Response
            description: Pong reply to ping
            type: object
            properties:
              - name: type
                type: string
                description: Message type. Always `pong` in reply to `ping`.
                enumValues:
                  - pong
                required: false
              - name: id
                type: string
                description: Echo of the `id` from the client ping, if provided.
                required: false
              - name: timestamp
                type: string
                description: Time when the server sent this `pong`, in RFC3339 format.
                required: false
        headers: []
        jsonPayloadSchema:
          type: object
          description: >-
            Reply to a `ping`. This message is flat and does not contain a
            nested `payload` object.
          properties:
            type:
              type: string
              enum:
                - pong
              description: Message type. Always `pong` in reply to `ping`.
              x-parser-schema-id: <anonymous-schema-57>
            id:
              type: string
              description: Echo of the `id` from the client ping, if provided.
              x-parser-schema-id: <anonymous-schema-58>
            timestamp:
              type: string
              format: date-time
              description: Time when the server sent this `pong`, in RFC3339 format.
              x-parser-schema-id: <anonymous-schema-59>
          x-parser-schema-id: <anonymous-schema-56>
        title: Pong Response
        description: Pong reply to ping
        example: |-
          {
            "type": "<string>",
            "id": "<string>",
            "timestamp": "<string>"
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: pongResponse
    bindings: []
    extensions: *ref_0
sendOperations:
  - *ref_1
  - *ref_2
  - *ref_3
  - *ref_4
receiveOperations:
  - *ref_5
  - *ref_6
  - *ref_7
  - *ref_8
  - *ref_9
sendMessages:
  - *ref_10
  - *ref_11
  - *ref_12
  - *ref_13
receiveMessages:
  - *ref_14
  - *ref_15
  - *ref_16
  - *ref_17
  - *ref_18
extensions:
  - id: x-parser-unique-object-id
    value: chartDataStream
securitySchemes: []

````