Skip to main content

Market Data Feed

The Market stream feed communicates market updates(latest trading price, close price, open price, etc.) when connected over the websocket. The market data feed response requires decoding using protobuf, utilizing the provided proto file. You'll need to translate the Market Data Proto File into the appropriate format compatible with your specific programming language.

Integration involves connecting to the provided endpoint using the wss: protocol through a WebSocket client, which is configured to automatically redirect to the authorized WebSocket endpoint upon authentication. Therefore, the client's configuration must be adjusted to support this automatic redirection. For example, in a Node.js client, you should enable the followRedirects setting to facilitate seamless handling of redirection.

After establishing a connection, proceed by subscribing to the necessary instrumentKeys, selecting the method and mode according to your preference. Ensure that the request structure aligns with the format outlined here.

Header Parameters

NameRequiredTypeDescription
AuthorizationtruestringRequires the format Bearer access_token where access_token is obtained from the Token API.
AccepttruestringDefines the content format the client expects, which should be set to */*.
NOTE

Over the socket, you have the capacity to subscribe to up to 100 instrumentKeys.

Request structure

{
"guid": "someguid",
"method": "sub",
"data": {
"mode": "full",
"instrumentKeys": ["NSE_INDEX|Nifty Bank"]
}
}
FieldDescription
guidGlobally unique identifier for the request.
methodThe method for the request. (Refer to the table below for possible values.)
modeThe mode for the request. (Refer to the table below for possible values.)
instrumentKeysInstrument keys for which you want updates.

Method field values

ValueDescription
subDefault mode is ltpc unless specified by user.
change_modeInstrument key is mandatory.
unsubUnsubscribe instrument key/s with further updates.

Mode field values

ValueDescription
ltpcProvides information solely about the most recent trade, encompassing details such as the last trade price, time of the last trade, quantity traded, and the closing price from the previous day.
option_chainProvides specific information about a given option contract, covering LTPC, BID and ASK data at D0 Depth, as well as information on option greeks.
fullOffers comprehensive information, including the latest trade prices, D5 depth, 1-minute, 30-minute, and daily candlestick data, along with some additional details.
Responses

This API does not provide a typical JSON response. Instead, upon successful authentication, it automatically redirects the client to the appropriate websocket endpoint where market updates can be received in real-time. Users are expected to handle data streams as per the websocket protocol once the redirection is complete.

NOTE

For the 1d interval, a single candle representing the previous day is returned. In the case of I1 and I30 intervals, two candles, one for the current and the one preceding it are provided.

Message Structure


Response received with mode ltpc

{
"feeds": {
"NSE_FO|154351": {
// Requested Instrument key
"ltpc": {
"ltp": 57.95,
"ltt": "1698400799168",
"ltq": "250",
"cp": 45.95
}
}
}
}
NameTypeDescription
typestringPresent in live feed, indicating the nature of the data.
feedsobjectIncludes updates for instrumentKeys requested.
ltpcobjectDetails of LTP information
ltpc.ltpnumberLast traded price
ltpc.lttstringLast traded time (Timestamp)
ltpc.ltqstringLast traded quantity
ltpc.cpnumberClosed price

Response received with mode option_chain

{
"feeds": {
"NSE_FO|154351": {
"oc": {
"ltpc": {
"ltt": "315513000000",
"cp": 173.95
},
"bidAskQuote": {
"bq": 300,
"bp": 2.4,
"bno": 1,
"aq": 300,
"ap": 18.4,
"ano": 1
},
"optionGreeks": {
"up": 2345.55,
"iv": 0.11490265529355076,
"delta": 0.000030379652501744125,
"theta": -0.00017456652224425185,
"gamma": 0.0000017544229494268402,
"vega": 0.0008204043189665998,
"rho": 0.00005234387191063523
},
"eFeedDetails": {
"cp": 173.95,
"tbq": 22500,
"tsq": 11400,
"lc": 0.05,
"uc": 26.65
}
}
}
}
}
NameTypeDescription
typestringPresent in live feed, indicating the nature of the data.
feedsobjectIncludes updates for instrumentKeys requested.
ocobjectDetails of Option Chain
ltpcobjectDetails of LTP information
ltpc.ltpnumberLast traded price
ltpc.lttstringLast traded time (Timestamp)
ltpc.ltqstringLast traded quantity
ltpc.cpnumberClosed price
bidAskQuote.bqnumberBid quantity
bidAskQuote.bpnumberBid price
bidAskQuote.bnonumberBid number of orders
bidAskQuote.aqnumberAsk quantity
bidAskQuote.apnumberAsk price
bidAskQuote.anonumberAsk number of orders
optionGreeks.upnumberUnderlier Price
optionGreeks.ivnumberImplied Volatility
optionGreeks.deltanumberMeasures the rate of change of options premium based on the directional movement of the underlying
optionGreeks.thetanumberMeasures the impact on premium based on time left for expiry
optionGreeks.gammanumberRate of change of delta itself
optionGreeks.veganumberRate of change of premium based on change in volatility
optionGreeks.rhonumberMeasures an option's sensitivity to changes in the risk-free rate of interest
eFeedDetails.cpnumberClose price
eFeedDetails.tbqnumberTotal buy quantity
eFeedDetails.tsqnumberTotal sell quantity
eFeedDetails.lcnumberLower circuit
eFeedDetails.ucnumberUpper circuit

Response received with mode full

{
"feeds": {
"NSE_FO|154351": {
// Requested Instrument key
"ff": {
"marketFF": {
"ltpc": {
"ltp": 57.95,
"ltt": "1698400799168",
"ltq": "250",
"cp": 45.95
},
"marketLevel": {
"bidAskQuote": [
{
"bq": 250,
"bp": 57.95,
"bno": 1,
"aq": 500,
"ap": 58.4,
"ano": 1
},
{
"bq": 250,
"bp": 57.9,
"bno": 1,
"aq": 250,
"ap": 58.45,
"ano": 1
},
{
"bq": 250,
"bp": 57.75,
"bno": 1,
"aq": 500,
"ap": 58.5,
"ano": 2
},
{
"bq": 250,
"bp": 57.7,
"bno": 1,
"aq": 250,
"ap": 58.8,
"ano": 1
},
{
"bq": 750,
"bp": 57.6,
"bno": 3,
"aq": 250,
"ap": 58.9,
"ano": 1
}
]
},
"optionGreeks": {
"iv": 0.18298505246639252,
"delta": 0.5558558106422424,
"theta": -0.73783940076828,
"gamma": 0.0031101196072995663,
"vega": 2.7419402599334717
},
"marketOHLC": {
"ohlc": [
{
"interval": "1d",
"open": 51.0,
"high": 64.4,
"low": 48.35,
"close": 57.95,
"volume": 3882000,
"ts": "1698345000000"
},
{
"interval": "I1",
"open": 57.2,
"high": 57.7,
"low": 57.1,
"close": 57.5,
"volume": 11250,
"ts": "1698400680000"
},
{
"interval": "I1",
"open": 57.5,
"high": 58.5,
"low": 57.45,
"close": 57.95,
"volume": 20500,
"ts": "1698400740000"
},
{
"interval": "I30",
"open": 61.5,
"high": 61.5,
"low": 57.45,
"close": 57.45,
"volume": 277750,
"ts": "1698398100000"
},
{
"interval": "I30",
"open": 57.7,
"high": 58.5,
"low": 56.5,
"close": 57.95,
"volume": 188500,
"ts": "1698399900000"
}
]
},
"eFeedDetails": {
"atp": 57.73,
"cp": 45.95,
"vtt": "3882000",
"oi": 999500.0,
"tbq": 578000.0,
"tsq": 115250.0,
"lc": 0.05,
"uc": 127.1,
"fp": 57.95,
"fv": 250,
"dhoi": 1014500.0,
"dloi": 882250.0,
"poi": 882250.0
}
}
}
}
}
}
NameTypeDescription
typestringPresent in live feed, indicating the nature of the data.
feedsobjectIncludes updates for instrumentKeys requested.
ltpc.ltpnumberLast traded price
ltpc.lttstringLast traded time (Timestamp)
ltpc.ltqstringLast traded quantity
ltpc.cpnumberClosed price
marketLevel.bidAskQuote[].bqnumberBid quantity
marketLevel.bidAskQuote[].bpnumberBid price
marketLevel.bidAskQuote[].bnonumberBid number of orders
marketLevel.bidAskQuote[].aqnumberAsk quantity
marketLevel.bidAskQuote[].apnumberAsk price
marketLevel.bidAskQuote[].anonumberAsk number of orders
optionGreeks.ivnumberImplied Volatality
optionGreeks.deltanumberMeasures the rate of change of options premium based on the directional movement of the underlying
optionGreeks.thetanumberMeasures the impact on premium based on time left for expiry
optionGreeks.gammanumberRate of change of delta itself
optionGreeks.veganumberRate of change of premium based on change in volatility
marketOHLC.ohlc[].intervalstringPossible values: 1d, I1, I30
marketOHLC.ohlc[].openstringOpen
marketOHLC.ohlc[].highstringHigh price
marketOHLC.ohlc[].lowstringLow price
marketOHLC.ohlc[].closestringClose price
marketOHLC.ohlc[].tsstringTimestamp
eFeedDetails.atpnumberAverage traded price
eFeedDetails.cpnumberClose price
eFeedDetails.vttstringVolume traded today
eFeedDetails.oinumberOpen interest
eFeedDetails.tbqnumberTotal buy quantity
eFeedDetails.tsqnumberTotal sell quantity
eFeedDetails.lcnumberLower circuit
eFeedDetails.ucnumberUpper circuit
eFeedDetails.fpnumberFill price
eFeedDetails.fvnumberFill volume
eFeedDetails.dhoinumberDay high open interest
eFeedDetails.dloinumberDay low open interest
eFeedDetails.poinumberPrevious open interest
Heartbeat

If there is no data to stream over an open WebSocket connection, the API automatically sends a standard ping frame periodically to maintain the connection's aliveness. Most standard WebSocket client libraries across various programming languages handle this automatically by responding with a pong frame, requiring no manual intervention.

Loading...