Tick-by-Tick (TBT) Socket Overview
This WebSocket allows you to stream 50 levels of market depth for NSE equity and NFO symbols.
USE CASE
Track order flow or run high-frequency strategies on full 50-level market depth.
Introduction
Tick-by-tick data is the most detailed market data, recording every trade and order book update in real-time. Each tick includes the price, volume, and timestamp of individual trades, as well as changes to buy and sell orders. This granular data is crucial for analyzing market microstructure, tracking order flow, and developing high-frequency trading strategies.
Key Points
Details
- The only feature on this socket today is TBT 50 Market Depth, requested with mode
depth. - Connect to
wss://rtsocket-api.fyers.in/versovawith the headerAuthorization: appId:accessToken. See TBT WebSocket Connection. - See Ratelimits for connection and channel limits.
- Subscribing to symbols on a channel does not start the stream. Resume the channel to receive data. See Concept of channels.
- Send the string
pingto keep the connection alive. - Requests are JSON strings. Responses are protobuf, defined by the .proto file.
- SDK support: TBT 50 depth was added in the Python SDK
v3.1.7(04 Mar 2025) and the Node SDKv1.4.1(26 Mar 2025). NSE equity support was added on 23 Jun 2025. See the Change Log.
Plan limits
Standard plan
- 1 symbol, counted per user across all connections
- 1 active connection
Prime plan
- 15 symbols, counted per user across all connections
- Up to 3 active connections with 5 symbols each
For rate limits and all other plan details, see Plans & rate limits.
Connection
Connect to wss://rtsocket-api.fyers.in/versova with the header Authorization: appId:accessToken, subscribe with mode depth and a channel number, then resume that channel to start the stream.
Full reference and samples: Tick-by-Tick (TBT) Socket - Connection (50 Market Depth).
Channels and message types
With the Tick-by-Tick (TBT) WebSocket, we are introducing the concept of channels. A channel acts as a logical grouping for different subscribed symbols, making it easier to manage data streams efficiently.
How Channels Work
- When subscribing to market data, you need to specify both the symbols and a channel number.
- Simply subscribing to a channel does not start the data stream—you must also resume the channel to begin receiving updates.
Example Usage
Let's say you organize your subscriptions as follows:
- Channel 1: All Nifty-related symbols
- Channel 2: All BankNifty-related symbols
Now, depending on what data you need, you can control the channels dynamically:
- Receive only Nifty data → Pause Channel 2 and Resume Channel 1
- Receive only BankNifty data → Pause Channel 1 and Resume Channel 2
- Receive both Nifty and BankNifty data → Resume both channels
This approach provides greater flexibility and control over market data streaming, allowing you to filter and manage real-time data efficiently.
Details
- Every subscribe and unsubscribe request carries a channel number. A connection supports 50 channels (1 to 50). See Rate limits for symbol and connection limits by plan.
- Subscribing to a channel does not start the stream. Send a switch-channel request (
type2) with the channel inresumeChannelsto start it. - Use
pauseChannelsandresumeChannelsin the same request to switch between groups. Both lists hold channel numbers as strings; the sample sends an emptypauseChannelslist. - Subscribe uses
subs1 and unsubscribe usessubs-1, both withtype1 andmodedepth. - Responses are protobuf.
snapshotis true for the first full packet and false for diff packets. Whenerroris true,feedsis empty. - Each depth level has
price,qty,nordandnum. For 50 levels,numruns from 0 to 49.
Request Message Types
| Type | Purpose | Encoding Format | Data Format |
|---|---|---|---|
Ping | Ping message to keep connection alive | String | "ping" |
Subscribe | Subscribe to the symbols for which data is required | Json string | {
"type": 1,
"data": {
"subs": 1,
"symbols": [
"NSE:IOC25FEBFUT",
"NSE:NIFTY25FEBFUT",
"NSE:BANKNIFTY25FEBFUT",
"NSE:FINNIFTY25FEBFUT",
"NSE:TCS25FEBFUT"
],
"mode": "depth",
"channel": "1"
}
} |
Unsubscribe | Unsubscribe to the symbols for which data is NOT required | Json string | {
"type": 1,
"data": {
"subs": -1,
"symbols": [
"NSE:IOC25FEBFUT",
"NSE:NIFTY25FEBFUT",
"NSE:BANKNIFTY25FEBFUT",
"NSE:FINNIFTY25FEBFUT",
"NSE:TCS25FEBFUT"
],
"mode": "depth",
"channel": "1"
}
} |
Switch Channel | Switch between active and paused channels | Json string | {
"type": 2,
"data": {
"resumeChannels": ["1"],
"pauseChannels": []
}
} |
Response Message Types
We use Protocol Buffers (protobuf) as the response format for all market data. The .proto file, which defines the data structure, is available at:
Protobuf is a widely used data format, and compilers are available to generate code in different programming languages.
How to install and use Protobuf
- Protobuf Compiler Installation: https://protobuf.dev/getting-started/
- Using Protobuf with Python: https://protobuf.dev/reference/python/python-generated/
- Using Protobuf with Node.js: https://www.npmjs.com/package/protobufjs
We have uploaded the compiled files also for python, nodejs, and golang. Download from: https://public.fyers.in/tbtproto/1.0.0/protogencode.zip
Copy the required file directly in your project and use it.
Proto versions & links
| Proto Version | Proto URL | Compiled files URL | Updated on |
|---|---|---|---|
1.0.0 | https://public.fyers.in/tbtproto/1.0.0/msg.proto | https://public.fyers.in/tbtproto/1.0.0/protogencode.zip | 20-02-2025 |
Response structures
| Type | Data Format | Field Explanation |
|---|---|---|
SocketMessage |
| message SocketMessage {
MessageType type = 1;
map<string, MarketFeed> feeds = 2;
bool snapshot = 3;
string msg = 4;
bool error = 5;
} |
MarketFeed |
| message MarketFeed {
Quote quote = 1;
ExtendedQuote eq = 2;
DailyQuote dq = 3;
OHLCV ohlcv = 4;
Depth depth = 5;
google.protobuf.UInt64Value feed_time = 6;
google.protobuf.UInt64Value send_time = 7;
string token = 8;
uint64 sequence_no = 9;
bool snapshot = 10;
string ticker = 11;
SymDetail symdetail = 12;
} |
Depth |
| message Depth {
google.protobuf.UInt64Value tbq = 1;
google.protobuf.UInt64Value tsq = 2;
repeated MarketLevel asks = 3;
repeated MarketLevel bids = 4;
} |
MarketLevel |
| message MarketLevel {
google.protobuf.Int64Value price = 1;
google.protobuf.UInt32Value qty = 2;
google.protobuf.UInt32Value nord = 3;
google.protobuf.UInt32Value num = 4;
} |
Rate limits
Following ratelimits apply for TBT Websocket. The symbol limit is per user, across all connections: Standard allows 1 symbol and Prime allows 15 symbols, which is up to 3 connections with 5 symbols each. See Plans & rate limits.
| Description | Standard plan | Prime plan |
|---|---|---|
| Symbols per user, across all connections [Market Depth] | 1 | 15 |
| Active Connections Per App Per User | 1 | 3 |
| Symbols per connection [Market Depth] | 1 | 5 |
| Channels per connection | 50 (1-50) | 50 (1-50) |
Full reference and samples: Tick-by-Tick (TBT) Socket - Channels and Message Types.
In this section
| Endpoint | Method | Description |
|---|---|---|
| Connection (50 Market Depth) | WSS | |
| Channels and Message Types | WSS |