Dhan: Understanding Order Execution Performance, Speeds and Response Times on DEXT

Hi All,

Few days back I noticed few threads on Twitter (now X) about speed of order execution and API response times of various Stock Trading platforms.

I also tweeted a video about Order Execution speeds on Dhan where I mentioned that we now execute 90% of all orders placed on Dhan below 50 ms; this post is an extension to the same and an attempt at a simpler explanation how things work behind the scenes for order execution on Stock Trading platforms. My views and notes about Dhan here are backed by data, and being a related party I’m sure readers will take my views outside of Dhan with a pinch of salt :slight_smile:

Firstly, it is important to understand and know that it is practically very difficult to benchmark performance of order execution APIs. The reasons could be many, I will list a simple reason - for everything being the same, it is not possible to replicate the same demand/supply, bids/ask and liquidity on exchange for all APIs if they were to be tested at once, or even to replicate the same demand and liquidity conditions on exchanges for testing the performance individually.

Outside of this, the following factors determine the response times and execution speeds of a stock trading platform

  • Underlying OMS (Order Management System) used by the Stock Broker
  • Underlying Network and Technology Infrastructure
  • Connectivity & Bandwidth of direct connections between Exchanges and the Broker’s Trading systems
  • Integrations with Front End systems (Mobile App, Websites or via APIs)
  • Multiple Check and Validations in place (beyond the ones directly handled by Order & Risk Management Systems)
  • APIs: Directly linked to the OMS or via an API Wrapper
  • Self-Managed Technology via Dedicated Infrastructure v/s Managed Infrastructure via Third Party Vendors
  • and more factors…

Beyond this, there are other factors that will also determine speed of execution:

  • Available liquidity on the exchange at that time (bids and asks)
  • Queuing of Orders at Broker end - do they have multiple instances of Order Management Systems running at same time
  • Queuing of Orders at Infra end - does broker have multiple direct connections to exchanges + utilisation of orders / bandwidth at that time.

Most stock trading platforms in India use third-party Order Management Systems (OMS); which essentially means that the expected speeds of Order Execution across these brokers with same OMS will more or less have the same performance.

Tell more about Dhan’s Technology Stack

Let me start with this post, few months back I wrote a detailed post about us scaling up our Technology Stack, Network and Infrastructure which you can read here - Dhan: Update on scaling up our Technology Stack, Network and Infrastructure

Here are some of the important aspects about Dhan with respect to Order Execution and Performance:

  • Dhan has built its own in-house trading system on the latest technology stack that we now internally call DEXTS (Dhan Exchange Trading System).
  • Dhan is one of the very few Stock Trading platforms that owns and manages its entire technology infrastructure including core trading systems.
  • 100% of all Exchange Orders on Dhan go through our own trading system - DEXTS
  • This gives us flexibility to build, iterate and scale faster - let me demonstrate this with details below.

What is the performance of Dhan (DEXT) on how has it improved?

As of today (May 2024), Dhan’s trading system DEXT processes > 85% of all trades in under 25 ms (yes - under 25 milli seconds). This is about 4 to 5 times faster than the typical industry averages of 80-120 ms.

How did we get to these execution speeds - in the same post (Dhan: Update on scaling up our Technology Stack, Network and Infrastructure), I mentioned that Dhan (in December 2023) was processing 80% of our trades in under 100 ms and more than 50% of these we did under 50ms… this has now improved dramatically!

We deployed some changes in January earlier this year on DEXTS, and this is how our performance looked in February 2024.

DEXT Performance in Feb 2024:

Note: While we moved to DEXT in November 2022, it took us while to have continued optimisation of performance. Here we benchmarked with the usual industry average of 80ms - 100ms that we had earlier optimised in December 2023.

DEXT Performance in March 2024:

We continued with our performance optimisations on DEXT, and further were able to speed of order execution as below for March 2024:

By end of March 2024, we were able to achieve 3X faster processing times for our orders compared to earlier industry benchmark of 80-120ms. Over 80% of all orders were processed in under 50ms.

DEXT Performance this month May 2024:

We push our latest update on DEXT by the end of April 2024, and here is how our order performance looks like for May 2024:

As of today, Dhan processes over 97% of all our orders in under 50 ms on DEXT. Compared to our earlier speed / response times in Feb & March, Dhan is 2X faster; and in comparison with our earlier benchmarks for the industry - Dhan is now 5X times faster in order processing and execution!

How are Orders handled? What happen’s behind the scenes at a Stock Trading Platform

Beyond just speeds, there is more to understand Order Processing on Dhan’s DEXT or any OMS Management System. Typically when you send an order to exchange via any stock trading platform - there are three most important legs in any transaction:

  1. Order Submit Flow
  2. Order & Risk Validation
  3. Final Updated Status of the Order

Let’s also understand what happen’s in each of the legs.

When you submit an Order to Exchange via a Stock Broker - many of the Stock Trading platforms (including Dhan) will try to do few or more validations on the front-end applications (web or mobile apps) itself - simpler ones like if the Trader has enough margins. Once you hit the ‘Submit Order or Trade or Buy / Sell’ button on any Stock Broking platform - they instantly generate an Order ID in their system and submit the same to the exchange. This operation usually takes anywhere between 10 to 30 ms depending on the factors that I have mentioned above, large part of this being how the OMS (Order Management System) handles this.

Second leg, which is the most important part of any transaction is all the validations for the Order - which are multiple parameters including but not limited to Margin Available, Type of Scrip or Security, Leverage Provided, if any Open Position, Hegde Benefit to be given or not, and so on… these could depend on Order Type and could have anywhere from 50 to 150 parameters to be checked before the Order is finally sent to the exchange. If there is a queuing on the stock broker end - which is say too many orders or heavy utilisation of processes by the OMS, you will see messages like Validation Pending or similar. These Order and Risk verification operations usually take anywhere between 20 ms to 150 ms, once again it largely depends on which OMS handles this for the Stock Trading platform.

Third leg, is is fastest of all usually - where post the order is submitted to the exchange, the exchange will return to the Stock Trading platform the final status of the order, which the broking platform will update to the trader’s app or web that get’s done in about 5 ms.

Now depending on the Stock Broker, its OMS and its implementation - the above three legs of the transaction can be either done serially or in parallel. Earlier, Dhan use to process these transactions in a serial order, and from many months we do it in parallel.

This is how the impact of same is, below are older performance numbers:

These are latest performance numbers on DEXT for May 2024:

Please note the following when you consider the numbers:

  • Dhan has its own exchange trading systems (DEXT) that makes all of this possible.
  • These numbers are peak performance numbers for the entire day on a volatile day in markets, which includes high trading volumes across exchanges - NSE, BSE and MCX and across all segments.
  • When it comes to APIs, consider additional 2-3 ms that gets added to the performance as result of rate limiting on DhanHQ trading APIs to avoid misuse.
  • This performance includes large Iceberg orders, something that is very popular with large traders on Dhan
  • Quick question - which orders take more time compared to others? The answer is advanced order types like Bracket, Cover and Trailing Stop-Loss that requires a few milli-seconds more than usual orders.

What is usually skipped in measuring Order / Trade Performance:

  • We have noticed few threads and posts where usually only the first leg of the trade (Order Submitted to Exchange) is considered as a performance measure where the response comes via APIs that the order is submitted, however the next and most important leg of trade - Risk and Order Validation is skipped, which is technically incorrect way to measure the end to end performance.
  • Additionally, we have also noticed that Trading Platforms that having similar underlying OMS platforms have been shown to have very different speeds of execution. This is likely for many reasons, however this wouldn’t be very high differences in any cases.
  • When it comes to APIs, few broking platforms may use wrappers around the front-end applications to process the trades and these do not connect directly to the core OMS. In such cases, there is an impact on the performance of order execution speeds.
  • The underlying network and technology architecture is one of most important factors in deciding - peak user volumes, high trade volumes, and likes. These vary from broker to broker, and usually not considered in third party measures of performance.

Yes, so this is what goes under the hood when you place an order for execution on an Stock Trading platform. Hope this helps, and also makes anyone understand how complex trading systems are and what it takes to run a technology-led stock trading platform.

Specifically for Dhan - as of today, our orders 98% today are executed under 25-30 ms (end to end performance) for any day.

Best Regards,
pj

26 Likes

Thanks @PravinJ. Insightful post. Appreciate it very much.

3 Likes

This is amazing to know. The order exceution in that ms is great !.

2 Likes

Excellent post. Thanks for quenching our thirst. I just love this type of posts from you. Waiting for more!

1 Like

:ok_hand::ok_hand: @PravinJ , @Dhan :rocket::rocket::rocket::rocket:

Very detailed post, first time some broker mentioning its performance publicly. Dhan does feel faster and definitely more reliable than many out there. I moved here from kotak neo.

Great. I can consider switching to Dhan, If it is faster. But one main issue for me is API Limit.

I need ability to place 200+ orders per second and 1000+ orders per minute. Can Dhan increase the API Limit for my account? My capital is in 9 figures.

I am happy with 5000 order per day limit. No change needed there.

hi @keshardev You can place upto 25 orders / sec on our APIs. Believe these are very adequate limits and they work for most of the use-cases that we are aware of.

If there are specific use-cases, do drop a note to our team on api@dhan.co and we will review.

Wow. Thanks @PravinJ for posting such in-depth behind the stage insight. I feel proud to be part of such and innovative broker :green_heart:

Hi, How long did it take for Dhan Tech Team to build the in-house trading-platform? I am interested to know the time it took to develop the trading-platform and its peripherals, time the app ran in beta/testing mode?

We have been building things from April 2021… and continue to build and make things better.

2 Likes

Thank you for the informative post and the performance improvement . Please continue the innovation (without breaking things) and hope you prioritize the user requests which matter /move the needle.

yes the team have show us in the pune meet that they have achieved the trade execution speed 18ms to 20 MS

But somehow on frontend, it ‘looks like’ the execution is slow. I think changing front end using different options could do a lot for changing that perception.

Cue: how Zerodha’s frontend handles it.

Hi @paekut These speeds are end to end response times of the trade execution. Tweaking arround front-ends and showing just response time of that request will be anyway much faster - but then, it is better to have facts stated as it is and represented correctly :slight_smile:

1 Like

Trade Execution Speed Update:

Zer**** - “most” of the orders are processed within 40ms.
Fy*** - “most” of the orders are processed within 70ms.
** how much is “most” is not quantified by anybody till now. **

Source: From their respective forums.

Update #1:
HD** S** - 110ms.

1 Like

Dhan app and web frontend is slow. All though orders get executed it doesn’t get reflected instantly on the front end. In certain cases, we need to refresh or go from one tab to another and back to the positions page to see the updated position list.

3 Likes

Exactly the point I’m trying to make.

Just because of how things happen on frontend here, I wasn’t comfortable deploying large capital and continued with Z.

Looks like Dhan guys don’t Dogfood.