Nifty 50
- Adani Ports₹1,862.90101.60 (5.77%)
- Trent₹2,875-38.90 (-1.33%)
- Adani Enterprises₹2,618.10138.30 (5.58%)
- Maruti Suzuki₹11,443-136.00 (-1.17%)
- Power Grid Corp₹262.1010.70 (4.26%)
- SBI Life Insurance ₹1,649.60-17.10 (-1.03%)
- Kotak Mahindra Bank₹458.3018.30 (4.16%)
- Bajaj Auto₹10,390-95.00 (-0.91%)
- Eternal₹337.3511.35 (3.48%)
- Hindalco Industries₹887.20-6.55 (-0.73%)
- Hindustan Unilever₹1,866.9051.10 (2.81%)
- Cipla₹1,357.80-7.80 (-0.57%)
- Bajaj Finance₹94224.75 (2.70%)
- Eicher Motors₹7,259.50-40.50 (-0.55%)
- NTPC₹311.157.40 (2.44%)
- Tech Mahindra₹1,768.90-7.70 (-0.43%)
- ITC₹265.806.30 (2.43%)
- Tata Steel₹168.98-0.29 (-0.17%)
- Titan Company₹4,437.6099.70 (2.30%)
- InterGlobe Aviation₹4,685-5.00 (-0.11%)
- Offerings
- Tools & Platforms
Tools & Calculators
- Open API
- Calculators
- SIP Calculator
- CAGR Calculator
- Compound Interest Calculator
- FD Calculator
- RD Calculator
- EPF Calculator
- Retirement Calculator
- HDFC SIP Calculator
- Mutual Fund Return Calculator
- Lumpsum Calculator
- Step Up SIP Calculator
- ETF SIP Calculator
- Brokerage Calculator
- Equity Margin Calculator
- SWP Calculator
- EMI Calculator
- MTF Calculator
- Margin Pledge Calculator
- Algo Strategy
- Markets
Stocks
F&O
Mutual Funds
- More
Fetching Market Depth (Level 2) Through the HDFC SKY API
By HDFC SKY | Published at: Oct 29, 2026 02:17 PM IST

Open Free Demat Account
Open Free Demat Account
Market prices tell only part of the story. To understand how buyers and sellers are positioned in the market, traders often rely on market depth data. The HDFC SKY WebSocket API allows applications to receive real-time market data, including up to five levels of bid and offer market depth for supported instruments, through a continuous streaming connection.
This guide explains what market depth is, why it is useful, and how to set up your application to receive Level 2 market data using the HDFC SKY API.
What Is Market Depth?
Market depth, also known as Level 2 market data, shows the pending buy and sell orders available for a security at different price levels. Instead of displaying only the latest traded price, it provides a broader view of current market activity.
This information helps users understand how much buying and selling interest exists at different prices and how market demand and supply are changing.
Why Is Market Depth Important?
Market depth provides additional information that is not available through the last traded price alone.
Here are some of its key benefits for traders:
- View multiple bid and offer price levels.
- Understand the available buying and selling interest.
- Monitor changes in market liquidity.
- Analyse order flow more effectively.
- Support real-time trading and monitoring applications.
For applications that display live market activity, Level 2 data offers a more complete market view than price updates alone.
Why Use the HDFC SKY WebSocket API?
The HDFC SKY WebSocket API is the recommended method for receiving live market data, including market depth.
Unlike request-response communication used by REST APIs, a WebSocket maintains a continuous connection with the HDFC SKY platform. As market conditions change, new data is streamed automatically to your application without repeatedly sending requests.
This approach improves efficiency and allows applications to receive live updates with minimal delay.
Also Read: HDFC SKY API Authentication and Login Flow Explained
Connect to the HDFC SKY WebSocket
Complete the authentication process so that your application can establish a WebSocket connection. The WebSocket creates a continuous communication channel between your application and the HDFC SKY platform. This allows live market updates to be delivered automatically as soon as they become available.
After the connection is established and the session is authenticated using a valid Access Token, your application becomes ready to subscribe to market data.
Subscribe to Market Depth Data
After establishing the WebSocket connection, the next step is to subscribe to the instruments for which you want to receive live market depth. Your application sends a subscription request that specifies the required instrument along with the appropriate exchange and market segment.
A typical subscription identifies:
- The exchange or market segment.
- The Scrip ID of the instrument.
- The type of market data required.
Once the subscription is successful, the WebSocket starts streaming real-time market data for the selected instrument. Depending on the subscription type, this can include market depth, Last Traded Price (LTP), OHLC values, and other supported data fields.
Understanding Level 2 Market Data
After subscribing successfully, your application starts receiving Level 2 market information. The market depth stream can include the following details.
- Bid Prices
Bid prices represent the prices at which buyers are willing to purchase a security. Multiple bid levels help users understand buying interest at different price points. - Offer Prices
Offer prices, also known as ask prices, represent the prices at which sellers are willing to sell a security. Viewing multiple offer levels helps users understand the available selling interest. - Bid and Offer Quantities
Each bid and offer level also includes the corresponding quantity available at that price. This information provides additional insight into market liquidity. - Five Levels of Market Depth
The HDFC SKY WebSocket API supports up to five levels of bid and offer market depth for supported instruments. Displaying multiple price levels provides a more detailed view of the order book than relying only on the latest traded price.
How Can Market Depth Be Used?
Market depth data supports a variety of trading and market monitoring applications.
Some common use cases include:
- Display live order book information.
- Monitor buying and selling activity.
- Analyse market liquidity.
- Build advanced trading dashboards.
- Create portfolio monitoring applications.
- Support market research and analytics.
These applications benefit from continuous market updates without repeatedly sending API requests.
Good Practices for Fetching Market Depth
Following a few simple practices can help you build a reliable market data application.
Consider the following recommendations:
- Complete authentication before opening the WebSocket connection.
- Use a valid Access Token for every authenticated session.
- Register the required Static IP address for your application.
- Subscribe only to the instruments your application needs.
- Remove subscriptions that are no longer required.
- Stay within the supported WebSocket connection and subscription limits.
- Monitor heartbeat messages to verify that the connection remains active.
Following these practices helps improve performance while maintaining a stable WebSocket connection.
Common Mistakes to Avoid
Developers new to live market data streaming often encounter a few common issues.
Avoid the following mistakes:
- Attempting to connect before completing authentication.
- Using an expired Access Token.
- Registering an incorrect Redirect URL.
- Forgetting to configure the required Static IP address.
- Exceeding the supported subscription limits.
- Opening unnecessary WebSocket connections.
- Expecting continuous market depth updates through REST APIs instead of the WebSocket service.
Avoiding these issues can help reduce connection failures and improve the overall reliability of your application.
Conclusion
The HDFC SKY WebSocket API provides an efficient way to receive real-time Level 2 market depth for supported instruments. After authentication and subscription, applications can stream bid and offer data, along with other supported market information, through a persistent WebSocket connection. By following the documented setup process and connection guidelines, developers can build responsive applications that deliver reliable live market data.
Open Free Demat Account
Open Free Demat Account
Popular Posts
- 10 Interesting Facts About NSE You Probably Didn’t KnowLast Updated: Sep 30, 2026
- 8-4-3 Rule of SIP - How Does That Work?Last Updated: Jul 30, 2025
- Let's view more exciting Post!
Popular Post from Trading Strategies
- Pulling Holdings, Positions, and Funds via HDFC SKY APILast Updated: Oct 29, 2026
- Streaming Live Market Data with HDFC SKY WebSocket: Setup GuideLast Updated: Oct 29, 2026
- Placing Your First Order via the HDFC SKY API: MARKET, LIMIT, SL, and SL-M Orders ExplainedLast Updated: Oct 29, 2026
- HDFC SKY API Rate Limits, Session Validity, and Token Management ExplainedLast Updated: Oct 29, 2026
- Getting Started with the HDFC SKY API in PythonLast Updated: Oct 22, 2026
- Let's view more exciting Post!
Popular Post from Blogs
- “Bounce Back” Theme Gains Traction in 2026Last Updated: Apr 8, 2026
- 5 Takeaways for Tax Payers from the Budget 2025Last Updated: Jan 29, 2026
- Let’s view more exciting Posts
By signing up I certify terms, conditions & privacy policy


