Introducing DhanHQ: SuperFast Trading & Investing API for Traders and Investors

Hello everyone,

Technology has changed the way all of us invest in markets. We have moved from exchange terminals at stock brokers to desktop based clients to web applications to now mobile based apps. The future of investing & trading will be more tech driven than today, and will evolve further.

We today have trading geeks, as well as tech geeks - many of them know what they want. The need for stock trading APIs is now more prominent than ever, for retail traders and other partners. Trading platforms want to develop their own strategies and businesses are looking forward to providing more customised offerings to their clientele. APIs enable you to build a platform of your own without having to reinvent the wheel. On the other hand, there are large fintechs and banks who want to offer investment and trading products to their customers, and do that quickly!

Since Dhan’s public launch, we have constantly been praised for incorporating our user requests, fast debugging and shipping new releases and features in record time. This has been possible only because of the strong API & infrastructure underneath that has powered our apps and integrations.

Our other flagship products web.dhan.co & tradingview.dhan.co have been built on top of this API too. Now we are thrilled to say that the same API will be available for Dhan users and partners for Free.

Introducing DhanHQ : Superfast Trading & Investing API for Traders and Investors

DhanHQ API is built on a scalable architecture capable of handling massive amounts of execution orders with a low latency. We have specifically designed DhanHQ API for Traders, Algo Platforms, Fintechs, Banks, Portfolio Managers and Stock Brokers and allows them to connect with Dhan’s platform for execution of trades. The platform enables partners to start building their investment & trading products for their users within days, and for large fintechs & banks to offer its users investing & trading in Stock Markets in a few weeks.

“With DhanHQ, we are extending the lightning fast experience we provide to Dhan’s users to our partners via APIs. We are very excited with the opportunity as it is a step in the direction of helping trading platforms integrate with Dhan and for fintech platforms and banks to offer investing & trading in Stock Markets to their users in just a few weeks.” said Pravin Jadhav, Founder of Dhan.

Our APIs have best in industry specifications, and we aim to improve this further:

  • Order Placement: 25 / sec upto 250 / min
  • OHLC: 10 requests / sec
  • Quotes: 10 / sec
  • Max Orders: 5000 / day
  • Modifications: 25 / order

DhanHQ APIs available for you :

DhanHQ is specifically designed for Traders, Algo Platforms, Fintechs, Banks, Portfolio Managers and Stock Brokers and allows them to connect with Dhan’s platform for execution of trades via APIs. The platform enables partners to start building their investment & trading products for their users within days, and for large fintechs & banks to offer its users investing & trading in Stock Markets in a few weeks.

And many more features will be coming soon.

Use Cases & Available for Everyone :

  • Traders and Tech Geeks
  • Algo Platforms
  • Fintechs
  • Bank
  • Brokers
  • Portfolio Managers

Few companies have been already associated with us and are loving our DhanHQ’s Superfast Trading Experience. We have integrated DhanHQ APIs with early partners like TradingView, TradeTron, Algoji, Stratzy, Algomojo, GoCharting, SquareOff, StockAnts and are in the process of integrating with 25+ more partners.

We will also assist all our partners to get required exchange approvals and certifications before your product & application goes live for their users.

For a seamless integration, we have ensured comprehensive documentation is in place, and from the beginning you focus on building strategies and platforms. Some of our partners have been able to onboard our APIs within 5 minutes. And we want to go much faster than this.

From the last 3 months, the Dhan app has been growing at a significant speed, and one of the reasons why we have grown is because of our highly customer centric approach towards building products. Many of the features have been built by strong feedback from our users, and with DhanHQ API as well we will be having the same momentum.

We are sure that with the DhanHQ API we will be able to unlock many trading capabilities for our users and enable them to explore new strategies and services.

For more info visit : https://dhanhq.co/

Regards,
Naman
Product - Dhan

4 Likes

Please provide Option chain by right clicking on charts in trading view version … Also in the mobile app , provide Option chain button on Nifty and banknifty index symbol

1 Like

You mentioned about Algo products. Can u clear things about Algo Trading since Sebi has issued some guidelines recently about the orders to be executed through Brokers terminal only. I didn’t read the complete guidelines about it, but need to understand more specifically. Can u explain in simple language about it.

Hi @ameethwasckar ,

We launch all our products as per the guidelines of SEBI.

Few months ago, @PravinJ had shared our view on the SEBI’s consultation paper on Algorithmic Trading by Retail Investors. Please find the link here : Link.

Also, please find the link for the original consultation paper here.

Hello,

I am a noob to these API’s and tech kinds of stuff… Can you plz help me in answering in a layman’s language about the below points?

  1. Can I place basket orders using API? meaning I am a user of Dhan and I have the API in the user setting. and there is a JSON file generator option. that doesn’t show me how to punch multiple leg orders in one. nor help me update my SL or target. How can I achieve that?

  2. post getting those codes can I trigger the alert (using the step 1 code) from TV and does this change or modification happen in dhan for the orders placed?

  3. In order to place this kind of request should i get API access? if so should i create a website or company or any other to make this happen? will there be any support from Dhan to setup on the website? as i see that time to integrate is 15 days. looks like we should hire some external developers and time taken by them is too huge…

which is better desktop trading platform between the two : wisdom capital “XTS” OR finvasia “shoonya” ?

@Naman what is the API to get current price of any stock? Also where to find the security id?
Also tried to integrate dhanhq python lib getting getting module not found error when class is instantiated.

Hello @raghu,

As of now, market feeds API is not available. We are in the process of evaluating this to provide open access for all.

For security ID, it is added in Dhan HQ API documentation as hyperlink under respective parameters. Adding link for your reference here.

In case of facing issues while integrating with Python Library, kindly share the error message along with screenshots and write to us at api@dhan.co.

1 Like

Thank you @Hardik . I overlooked and looked only at curl request :grinning: I will share the python library issue on api@dhan.co.
Waiting for realtime price for stock/option price api.

2 Likes
  • When can we expect basket order support via API?

  • Will iceberg orders support be available for order placement api?

Hello @stanly_thomas

We are coming up with a range of Special Order APIs including Basket orders and Slice orders very soon. We will be announcing here first, so stay tuned!

1 Like

@Naman @Hardik
Hi I am using Dhan API to place an order for nifty option CALL 18600 for December expiry. I am getting error.

This is json request. * {

“dhanClientId”: “11000000”,

“correlationId”: “string”,

“transactionType”: “BUY”,

“exchangeSegment”: “NSE_FNO”,

“productType”: “MARGIN”,

“orderType”: “MARKET”,

“validity”: “DAY”,

“tradingSymbol”: “NIFTY22D1518500CE”,

“securityId”: “13”,

“quantity”: 1800,

“disclosedQuantity”: 1800,

“price”: 0,

“triggerPrice”: 0,

“afterMarketOrder”: true,

“amoTime”: “OPEN”,

“boProfitValue”: 0,

“boStopLossValue”: 0,

“drvExpiryDate”: “2022-12-15”,

“drvOptionType”: “CALL”,

“drvStrikePrice”: 18600

}

And i am getting error

  • {

“errorCode”: “BAD_REQUEST_ERROR”,

“httpStatus”: “BAD_REQUEST”,

“internalErrorCode”: “RS-9005”,

“internalErrorMessage”: “Error Id Not Specified”

}

Can you give sample JSON request for placing order for Nifty 18600 CALL for 15th December expiry?

Hey @9916314203

Welcome to Dhan Community. It’s great to see so many people interacting on community for integrating APIs.

Adding the desired request structure here for your reference:

{
  "dhanClientId": "1000000000",
  "correlationId": "",
  "transactionType": "BUY",
  "exchangeSegment": "NSE_FNO",
  "productType": "INTRADAY",
  "orderType": "MARKET",
  "validity": "DAY",
  "tradingSymbol": "",
  "securityId": "47301",
  "quantity": 50,
  "disclosedQuantity": 0,
  "price": 0,
  "triggerPrice": 0,
  "afterMarketOrder": false,
  "amoTime": "OPEN",
  "boProfitValue": 0,
  "boStopLossValue": 0
}

Hope this helps. Also, always make sure to add correct security ID, especially in case of FNO as it gets updated frequently.