Data Socket - Connect and Subscribe
This WebSocket allows you to connect to the Data Socket and subscribe to live updates for your symbols.
USE CASE
Subscribe to the stocks on your watchlist and receive every price update in your callback.
Details
- The Data Socket provides real-time market data with low latency over a persistent, bidirectional connection, such as symbol updates and depth updates.
- Subscription limits and best practices (single instance, thread handling, updating symbols, callbacks, auto-reconnect, reconnect retry and logging) are on the Data Socket Overview.
- The higher symbol limit applies from Python v3.1.0, Node v1.1.1 and Web JS v1.1.0, so use these versions or later. See the Change Log.
- Pass the access token in the format
appid:accesstoken. - Subscribe from the on-connect callback so symbols are requested as soon as the connection opens. In Python, call
keep_running()afterwards to keep receiving data. - Use FYERS symbology, for example
NSE:SBIN-EQfor a stock orNSE:NIFTY50-INDEXfor an index. In Python,data_typeisSymbolUpdatefor prices and indices, orDepthUpdatefor market depth. - Each message has a
type:cnconnection,subsubscribe,sfequity and option data,ifindex data,dpmarket depth. - To receive only the last traded price, set
litemode=Truewhen you create the socket in Python, or callmode(LiteMode)in Node and Web JS. See Lite Mode. - With auto-reconnect on, previous symbols are resubscribed automatically after a reconnect.
Plan limits
Standard plan
- Up to 100 symbols, counted per user across all connections
Prime plan
- Up to 5,000 symbols, counted per user across all connections
For rate limits and all other plan details, see Plans & rate limits.
Last updated on