Skip to content

WebSocket Streaming

Our WebSocket API provides a fast, efficient, and low-latency way to receive real-time data, including market quotes and order status updates. This is the preferred method for streaming high-frequency data.

We offer two distinct WebSocket endpoints for different types of real-time data:

  • Price Feed WebSocket - For live market data including LTP (Last Traded Price) and real-time quotes
  • Order Updates WebSocket - For real-time updates on your order statuses and trade confirmations

Authentication for both endpoints is handled via an Authorization header passed during the initial connection handshake.

Text Only
Authorization: YOUR_ACCESS_TOKEN

Price Feed

Use this endpoint to stream live market data for instruments.

Endpoint: wss://ws-prices.indstocks.com/api/v1/ws/prices

Subscription

Once connected, you send JSON messages to subscribe to or unsubscribe from instrument feeds.

Request Structure A subscription message consists of an action, a mode, and an array of instruments.

Parameter Type Description
action string The action to perform. Enum: "subscribe", "unsubscribe"
mode string The data mode. Enum: "ltp", "quote"
instruments array An array of instrument tokens to subscribe to.

Instrument Format Instrument tokens are strings that identify a specific security or index, formatted as SEGMENT:TOKEN.

Type Prefix Example
NSE Equity NSE: "NSE:2885"
BSE Equity BSE: "BSE:500325"
NSE Derivatives (F&O) NFO: "NFO:51011"
BSE Derivatives (F&O) BFO: "BFO:12345"
NSE Index NIDX: "NIDX:26000"
BSE Index BIDX: "BIDX:1"

Subscription Examples

  • To subscribe to LTP mode for an instrument:

    JSON
    {
        "action":"subscribe",
        "mode": "ltp",
        "instruments": ["NSE:2885"]
    }
    

  • To subscribe to Quote mode:

    JSON
    {
        "action":"subscribe",
        "mode": "quote",
        "instruments": ["NSE:2885"]
    }
    

Data Response

The data from the server will be a JSON string. You will need to parse this string to get the JSON object.

  • LTP Response Format:
    JSON
    {
        "mode": "ltp",
        "instrument": "2885",
        "timestamp": 1750138351089,
        "data": {
            "ltp": 1426
        }
    }
    

Order Updates Feed

This endpoint streams all real-time updates for your orders.

Endpoint: wss://ws-order-updates.indstocks.com

Subscription

To start receiving order updates, send a single subscription message after connecting.

  • Subscription Message:
    JSON
    {
        "action": "subscribe",
        "mode": "order_updates"
    }
    
    Once subscribed, all updates for your orders (e.g., placement, execution, cancellation) will be pushed to you automatically.

Order Update Response

The server will push a JSON message for any change in an order's state.

  • Example Order Update:
    JSON
    {
      "type": "order",
      "order_id": "INDM20250512ABC123",
      "order_status": "PARTIALLY_EXECUTED",
      "filled_quantity": 5,
      "remaining_quantity": 5,
      "average_price": 2500.40,
      "timestamp": 1678886530456
    }
    

Heartbeats

The server may send periodic heartbeat messages to keep the connection alive. Your client should be configured to handle these, typically by ignoring them.