Skip to main content

Market Data Feed V3โ€‹

The Market Stream Feed V3 provides real-time market updates, including the latest trading price, close price, open price, and more, through a WebSocket connection. The feed utilizes Protobuf encoding, which requires decoding messages using the provided Market Data V3 Proto file.

With the V3 version, significant enhancements have been introduced, offering improved stability, performance, and reliability for uninterrupted data delivery. This version also includes limitations on connections and subscriptions to ensure a stable and efficient data transmission process. These limitations are designed to optimize performance and maintain consistent feed quality.

To connect to the WebSocket endpoint, use the wss: protocol. Ensure that your WebSocket client is configured to handle automatic redirection to the authorized endpoint after authentication. For example, in a Node.js client, enabling the followRedirects setting facilitates seamless handling of redirection.

Once connected, you can subscribe to the required instrumentKeys by specifying the method and mode based on your needs. Ensure that the subscription request adheres to the V3 format. Incoming data from the feed must be decoded using Protobuf and the provided .proto file, properly adapted to your programming language for compatibility. The following table lists the defined limits for the feeder, which must be adhered to for uninterrupted data streaming.


Connection and Subscription Limitsโ€‹

Limit TypeCategoryIndividual LimitCombined Limit
Connection1 connection per app-user combinationN/A
SubscriptionLTPC5000 instrument keys2000 instrument keys
Option Greeks3000 instrument keys2000 instrument keys
Full2000 instrument keys1500 instrument keys

The Individual Limit refers to the maximum number of instrument keys allowed when a user subscribes to a single category. For instance, if a user subscribes only to 'LTPC', they can access up to 5000 instrument keys.

The Combined Limit applies when subscriptions cover multiple categories. For example, if the same user subscribes to both 'LTPC' and 'Option Greeks', the limit for each category is set to 2000 instrument keys. This structure ensures users can efficiently manage multiple data streams within system capacity constraints.


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 */*.

Request structureโ€‹

{
"guid": "13syxu852ztodyqncwt0",
"method": "sub",
"data": {
"mode": "full",
"instrumentKeys": ["NSE_INDEX|Nifty Bank"]
}
}
NOTE

The WebSocket request message should be sent in binary format, not as a text message.

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
ltpcContains only the latest trading price (LTP) and close price (CP) changes.
option_greeksContains only option greeks.
fullIncludes LTPC, 5 market level quotes, extended feed metadata, and option greeks.
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.

The feeds are structured to ensure seamless data flow and synchronization.

  • The first tick provides the market status, giving the current state of various market segments to ensure synchronization.
  • The second tick delivers a snapshot of the current market data, offering the latest available information.
  • Subsequent ticks stream live, real-time updates, ensuring clients stay updated with the latest market activity.

Market Statusโ€‹

The market_info is the first message sent for all feeds. It provides the real-time status of various market segments, ensuring the client is aware of the current trading conditions before streaming data. This helps synchronize the client with active segments and prevents unnecessary data processing for inactive or closed segments.

{
"type": "market_info",
"currentTs": "1732775008661",
"marketInfo": {
"segmentStatus": {
"NSE_COM": "NORMAL_OPEN",
"NCD_FO": "NORMAL_OPEN",
"NSE_FO": "NORMAL_OPEN",
"BSE_EQ": "NORMAL_OPEN",
"BCD_FO": "NORMAL_OPEN",
"BSE_FO": "NORMAL_OPEN",
"NSE_EQ": "NORMAL_OPEN",
"MCX_FO": "NORMAL_OPEN",
"MCX_INDEX": "NORMAL_OPEN",
"NSE_INDEX": "NORMAL_OPEN",
"BSE_INDEX": "NORMAL_OPEN"
}
}
}
NameTypeDescription
typestringIdentifies the message type as market_info.
currentTsstringTimestamp indicating when the message was generated.
marketInfoobjectContains details about the status of various market segments.
marketInfo.segmentStatusobjectKey-value pairs where the key is the market segment and the value is its current status (e.g., NORMAL_OPEN). Valid statuses are listed in the Market Status Appendix

Market Data Snapshotโ€‹

The second tick provides a snapshot of the current market data, presenting the latest state of the market at the time of connection. This ensures the client starts with an accurate and up-to-date view of market conditions. The following is a sample object for LTPC.

{
"feeds": {
"NSE_FO|53023": {
"ltpc": {
"ltp": 60.15,
"ltt": "1732774771650",
"cp": 105.55
}
}
},
"currentTs": "1732774772179"
}

Live Feedโ€‹


{
"type": "live_feed",
"feeds": {
"NSE_FO|53023": {
"ltpc": {
"ltp": 60.05,
"ltt": "1732774772481",
"cp": 105.55
}
}
},
"currentTs": "1732774772584"
}
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.cpnumberClosed price
feeds.currentTsnumberTimestamp of the received tick
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...