Skip to Content

Data Socket - Market Depth Update

This WebSocket allows you to stream live five-level market depth for a symbol.

USE CASE

Build a live order book showing the best five bids and asks as they change.

Details

  • The WebSocket API for receiving stock data is a real-time communication protocol designed to provide seamless and low-latency access to live stock market data. This API allows developers and traders to establish a persistent, bidirectional connection with the server, enabling them to receive continuous updates on stock prices, trading volumes, and other relevant market information.
  • To quickly get started with the WebSocket API and start receiving real-time stock data, you can explore our sample scripts and code examples in our GitHub repository:
    Data WebSocket Sample Scripts
  • Depth covers 5 levels on each side, for example bid_price1 to bid_price5. For 50 levels use the Tick-by-Tick (TBT) Socket.
  • Subscribe with data_type set to DepthUpdate in Python. In Node, pass true as the second argument of subscribe.
  • Depth messages have type set to dp.
  • Each level has a price, a size and an order count, for example bid_price1, bid_size1 and bid_order1.
  • In the sample response, levels with no quantity show 0.

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.

Response Attributes (Depth Update)

AttributeData TypeDescription
symbolstringThe symbol in fyers symbology format whose data is received on socket.
bid_price1-bid_price5floatThe bid price key represents the highest price at which buyers are willing to purchase a particular security or asset.
ask_price1-ask_price5floatThe ask price key represents the lowest price at which sellers are willing to sell a particular security or asset.
bid_size1-bid_size5intThe bid size key represents the quantity or volume of the security or asset that buyers are willing to purchase at a specific bid price level.
ask_size1-ask_size5intThe ask size key represents the quantity or volume of the security or asset that sellers are willing to sell at a specific ask price level.
bid_order1-bid_order5intThe number of bid order.
ask_order1-ask_order5intThe number of ask order.
typestring
  • cn - connection message
  • sub - subscribe message
  • if - index data message
  • dp - market depth data message
  • sf - Equity and option data message
Last updated on