Skip to main content

Broadcast

Live market data over WebSocket. Connect to wss://livefeed.blinkx.in and receive real-time ticks for subscribed instruments.


Connection Flow

  1. Obtain api_key and access_token from BlinkX
  2. GET https://api.blinkx.in/instruments — get token + exchange for each instrument
  3. Connect to wss://livefeed.blinkx.in/ws?api_key=<key>&access_token=<token>
  4. Send subscribe message with instrument keys
  5. Receive live ticks as long as connected
  6. Change mode or unsubscribe at any time

Step 1 — Get Instruments

Fetch available instruments to get the token and exchange values needed for subscription.

curl --location 'https://api.blinkx.in/instruments' \
--header 'Authorization: token <your_api_key>:<your_access_token>'

Each instrument has a token and exchange field. Combine them as {token}_{exchange} to form the instrument key used in all WebSocket messages.


Step 2 — Connect

wss://livefeed.blinkx.in/ws?api_key=<your_api_key>&access_token=<your_access_token>

If credentials are invalid the connection is rejected immediately:

{ "code": 401, "error": "No Session found for this api key." }
{ "code": 401, "error": "Please login again." }

Step 3 — Subscribe

All WebSocket messages use the format {"a": "<action>", "p": <payload>}.

Send a list of instrument keys to subscribe:

{
"a": "s",
"p": ["1234_NSE", "5678_BSE", "9999_NFO"]
}

Supported exchanges: NSE, BSE, NFO, BFO, NCD, MFO

On subscribe, the server immediately sends a full snapshot of current market data, then continuously pushes live updates.

Response:

{
"a": "Subscribe",
"p": {
"Status": [
"Client myApp session abc123 successfully subscribed 1234_NSE",
"Stock not present in Stock Store 9999_NFO"
]
}
}

Step 4 — Receive Live Data

The server pushes only changed fields on every tick. The ik field (instrument key) is always present.

There are 3 modes:

Mode: ALL (default)

Full OHLC, volumes, OI, upper/lower circuits, and 5-level bid/ask market depth.

Use for: trading terminals, order placement screens, full market watch.

{
"ik": "1234_NSE",
"ltp": 2345.50,
"t": 1712500000000,
"o": 2300.00,
"h": 2360.00,
"l": 2290.00,
"c": 2310.00,
"v": 1500000,
"ltq": 10,
"ltt": 1712499990000,
"atp": 2340.00,
"tbq": 50000,
"tsq": 45000,
"tt": 32000,
"52h": 2800.00,
"52l": 1900.00,
"uc": 2530.00,
"lc": 2115.00,
"oi": 120000,
"oih": 130000,
"oil": 110000,
"poi": 115000,
"bq1": 500, "bp1": 2345.00, "bo1": 3,
"bq2": 800, "bp2": 2344.50, "bo2": 5,
"bq3": 1200, "bp3": 2344.00, "bo3": 8,
"bq4": 300, "bp4": 2343.50, "bo4": 2,
"bq5": 600, "bp5": 2343.00, "bo5": 4,
"aq1": 400, "ap1": 2345.50, "ao1": 2,
"aq2": 700, "ap2": 2346.00, "ao2": 6,
"aq3": 900, "ap3": 2346.50, "ao3": 7,
"aq4": 200, "ap4": 2347.00, "ao4": 1,
"aq5": 500, "ap5": 2347.50, "ao5": 3
}

Mode: QUOTE (q)

OHLC, volume, and buy/sell totals. No market depth.

Use for: portfolio screens, watchlists, charts.

{
"ik": "1234_NSE",
"ltp": 2345.50,
"o": 2300.00,
"h": 2360.00,
"l": 2290.00,
"c": 2310.00,
"v": 1500000,
"ltq": 10,
"atp": 2340.00,
"tbq": 50000,
"tsq": 45000
}

Mode: LTP (l)

Only the last traded price. Lowest bandwidth.

Use for: price alerts, dashboards, large watchlists where depth is not needed.

{
"ik": "1234_NSE",
"ltp": 2345.50
}

Step 5 — Change Mode

Switch mode for already-subscribed instruments at any time — no need to unsubscribe first.

{
"a": "m",
"p": ["l", ["1234_NSE", "5678_BSE"]]
}
ValueMode
"l"LTP only
"q"Quote (OHLC + volumes, no depth)
anything elseALL (full depth)

Response:

{
"a": "Mode",
"p": {
"Status": ["Client myApp new mode is LTP subscribed 1234_NSE"]
}
}

Step 6 — Unsubscribe

{
"a": "u",
"p": ["1234_NSE", "5678_BSE"]
}

Response:

{
"a": "UnSubscribe",
"p": {
"Status": ["Client myApp successfully unsubscribed for 1234_NSE"]
}
}

Step 7 — Heartbeat

The server sends a heartbeat every 10 seconds:

{
"a": "HeartBeat",
"p": { "timestamp": "1712500000000" }
}

If heartbeats stop arriving, treat the connection as dead and reconnect.


Field Reference

All Modes

FieldDescription
ikInstrument key ({token}_{exchange})
ltpLast traded price

Quote + ALL Mode

FieldDescription
tTick timestamp (epoch ms)
oOpen price
hHigh price
lLow price
cPrevious day close price
vVolume traded today
ltqLast trade quantity
lttLast trade time (epoch ms)
atpAverage traded price
tbqTotal buy quantity
tsqTotal sell quantity
ttTotal trades
52h52-week high
52l52-week low
ucUpper circuit
lcLower circuit
btBook type
tsTrading status

ALL Mode Only

FieldDescription
bq1bq5Bid quantities (level 1–5)
bp1bp5Bid prices (level 1–5)
bo1bo5Bid order count (level 1–5)
aq1aq5Ask (offer) quantities (level 1–5)
ap1ap5Ask (offer) prices (level 1–5)
ao1ao5Ask (offer) order count (level 1–5)
oiOpen interest
oihDay high OI
oilDay low OI
poiPrevious day OI
mcMarket capitalisation

Instrument Info (initial snapshot only)

FieldDescription
sSymbol
bsBase symbol
dsDisplay symbol
ssStream symbol
eExchange
toToken
tsiTick size
lsLot size

Action Reference

a valueDirectionPurpose
sClient → ServerSubscribe to instruments
uClient → ServerUnsubscribe from instruments
mClient → ServerChange feed mode
HeartBeatServer → ClientKeepalive ping (every 10s)
SubscribeServer → ClientSubscription confirmation
UnSubscribeServer → ClientUnsubscription confirmation
ModeServer → ClientMode change confirmation
(tick update)Server → ClientLive price update (contains ik)

Error Codes

CodeMeaning
401Invalid api_key, incorrect access_token, or session not found
500Server configuration error