Introducing: 20-Depth Market Data on DhanHQ Data APIs

Hello Traders,

At Dhan, we believe in building a platform that is MadeForTrade. We have constantly, in our journey of 3 years have innovated and brought many industry-first innovations - products, features and capabilities that enhance the overall trading experience of Super Traders in India.

We delivered this experience across all our platforms and are now gearing up to bring many of these to our Trading APIs - DhanHQ. We have already stated that on an average > 3% of all orders on Dhan are placed via our Trading APIs, and in addition to this 80+ platforms have integrated DhanHQ’s API stack to enable multiple trading and investing use-cases for Dhan’s users.

Many of you may be aware, we recently introduced 20-level market depth on top of Dhan Tradingview Charts (tv.dhan.co) and power traders have loved it so far. At Dhan, we continue to invest in capabilities, and as result 20-level market depth or Level 3 data is constructed at broker’s end, which makes it infrastructure heavy but extremely fast in terms of showing market updates.

Also, when we look at a 5 level market depth, we often miss opportunities which are formed further away from the depth. But tracking all this data manually and placing orders along with managing positions becomes difficult, especially if you want to trade multiple instruments at the same time. With the speed and breadth of this data, we wanted to deliver it in a way where you can take easy rule based entry/exit and build on top of this. Not just this, while taking any position, you can refer to this data to ensure you can reap maximum opportunities.

This is why, we are today introducing 20-Level Market Depth as part of DhanHQ Data APIs.

You can now get entire Level 3 data on websockets, delivered in real-time showing a wider market picture. This is delivered real-time over websockets, making it super fast and without any limits on updates that you receive. This means all depth updates delivered to you as and when it happens.

The possibility of building systems on top of this data is wide. This along with Dhan’s order execution speed on APIs gives you the edge to build systems with the edge that large institutions have access to. You can start using 20 - Market Depth directly with the documentation here - 20 Market Depth - DhanHQ Ver 2.0 / API Document.

This will be soon available on dhanhq-py library as well, for you to plug into your Python codebase. And we are working on a lot of exciting updates to DhanHQ APIs as part of the v2.

With this, DhanHQ becomes the only platform that brings you 20-Level Market Depth not just across the Equity (Cash) segment but also on F&O (Futures and Options) - now extended to APIs as well.

Just to recall, we recently introduced our new version of API suite with v2 - now becoming the industry benchmark and the go-to choice for API based traders. These powerful APIs now also bring to you incredible features like - AutoSlicing on Iceberg, Trader’s Controls, Option Chain and now the first trading API suite with 20-Depth Market Data from NSE.

We hope API / Algo-traders using DhanHQ APIs now have another reason to cheer and also now make their trading experience - more powerful!.

Happy (API) Trading,
Hardik

7 Likes

First of all, congratulations to the Dhan team for this incredible milestone! Introducing 20-Level Market Depth through DhanHQ APIs is truly a game-changer for algo-traders and quant enthusiasts. The ability to access Level 3 data for both Equity and F&O in real-time is an innovation that will unlock a myriad of possibilities for creating advanced trading systems.

As an open-source enthusiast, this update sparks an idea: Why not leverage this new data to create an interactive Synthetic Order Book Visualizer?

2 Likes

Any plans to increase the number of allowed instrument subscriptions (like 5 * 5000 for normal depth data?)

Hello @tradernoob

Great to see you active here after a while.

Since the packet size and the speed of update is much higher than live market feed, bandwidth consumption is much higher, both on network layer and on server/client side.

We will be keeping the number of instruments limited to 50 for now to monitor performance.

Hi @Hardik, I don’t see this feature in Dhan TV as well. What settings should I select to see this one? A screen shot in the forum should have been very helpful, IMHO.


Hi @Hardik I only get Feed Response Code 41 for 20 Market data… What about the Feed Response Code 51?

Hello @ashokprajapati

Do ensure that you have mapped this correctly at your end when parsing this data. Checked it at our end and it is working as intended.

HI @Hardik

I am using Nodejs, Here have my code example for 20 Market Depth websokect extract data. I Only got responseCode:41, I am not sure why am not geting responseCode:51 too.



Hello @ashokprajapati

Just checked this at my end and this is sending both Bid & Ask data. Do make sure you are parsing the packet received entirely i.e. 332 bytes.

We will also be introducing the Python Client library for this soon.

Hi hardik,
Now your offering 20 depth market data via api

Hello @AGL

Yes. @ashokprajapati have added on python library with v2.1.0. You can refer to the same for the approach here: GitHub - dhan-oss/DhanHQ-py: The official Python client for communicating with the Dhan API.

Thanks @Hardik

Thank you for reply @Hardik👍

What are information getting from api

ex.

20 depth level of price with there qty for a both bid and ask,
total bid qty and total ask qty,
last trade qty,
volume

1 Like

Hey @AGL

You can refer to the documentation - 20 Market Depth - DhanHQ Ver 2.0 / API Document

This includes bid/ask data price, quantity and number of orders