DhanHQ Superfast Trading APIs Update: Trading APIs are now FREE for all

@Hardik @Naman @PravinJ

DhanHQ Python documentation is to be updated and enriched.
documentation is very much required for proper implementation of code.

Hello @bsjhala

Thank you for the feedback. We have already added sample code on GitHub and PyPi. Also, we are looking into adding detailed Python Client documentation soon as well.

1 Like

Why don’t you map it internally and just get the trading symbol from us. Isn’t it just a database dump, that runs every morning ?

1 Like

How do we fetch the CMP / LTP of any scrip, So that i can dynamically take SL / TGT and SquareOff my options position. I am trying to do this programattically because, there is no OCO (only for intraday) now on API.

1 Like

Hello @Mohan
First of all, welcome to Dhan Community. To answer your question, Security ID is an exchange level standard and all our systems are built on the same. However, we have duly noted and will evaluate this.

@Mohan You can create different types of order at your end using custom scrips and Dhan APIs. For SL/TGT to square off positions, you can place SL order/ Limit order respectively.

Hi,
Thanks for providing the API’s, I want to develop my own strategy in .net/ powershell using the API’s. I have a question on how to test the code which I am writing? Is there any access token for testing the features? The access token which I tried points to the live environment.

Hello @deepakrobot

Welcome to Dhan Community! It’s awesome to know that you are looking to build on Dhan APIs.
Currently, we do not provide any sandbox for API testing. However, our users do test these APIs on live environment either by placing after market orders or limit orders and later cancelling them from frontend.

Hope this helps! Feel free to reach out to @Dhan_Help if you face any issues while integrating.

1 Like

@Hardik @Naman

When will be market Feeds available .
Without Real time market feeds how can we set conditions and hecne orders.

Pls do it on priority basis.

Hey @bsjhala
We understand the need for Market Feed API and working towards it on a priority basis. I have explained our approach here.

Hi,

Can you please provide sample request which works for Bracket Order. I am trying with below request but getting 400 bad request everytime. Also if I set afterMarketOrder to true and amoTime to ‘OPEN’, then that request should work even when market is closed?

{
    "transactionType":  "BUY",
    "securityId":  "11703",
    "disclosedQuantity":  10,
    "exchangeSegment":  "NSE_EQ",
    "boProfitValue":  3317,
    "orderType":  "MARKET",
    "afterMarketOrder":  false,
    "correlationId":  "test-ALKEM",
    "validity":  "DAY",
    "tradingSymbol":  "",
    "drvExpiryDate":  "",
    "price":  0,
    "quantity":  10,
    "triggerPrice":  0,
    "dhanClientId":  "xyz",
    "drvStrikePrice":  "",
    "productType":  "BO",
    "boStopLossValue":  3060,
    "amoTime":  "",
    "drvOptionType":  ""
}

Hello @deepakrobot

In the request structure, fields “boStopLossValue” and “boProfitValue” represent change in price between Stop Loss/Target and order price. So, you only need to enter the price difference there. The same is mentioned in the documentation.

Also, in the “disclosedQuantity” field, you can enter 0 if you want to disclose all of the order quantity. On an exchange level, Disclosed Quantity needs to be more than 10% and less than 30% of the actual order quantity.

Thanks for quick response. I was referring to Dhan API and there it was just mentioned price for bracket orders, please update the documentation here.
image

Noted, will update the documentation at Dhan API.

For now, hope you were able to place the order successfully. Do reach out to @Dhan_Help at help@dhan.co if you face any issues.

Is trading API requires payment?
I read it in the first post that it will be free of cost !!

Hello @Saurabh

Yes. Trading APIs are absolutely free for all Dhan users. In fact, even Data APIs are free to use if you have made 25 F&O trades or more in the past 30 days on Dhan.

Thats strange!
Because to activate API and get the token, I had to pay INR 499 for 30 days !!!

That should be for Data APIs only. If you haven’t made 25 F&O trades in the last 30 days, you have the option to pay ₹499 to get Data API access.

Other than that, Dhan Trading APIs are free always!

@Hardik is there to provide api to trailing stop loss after target % achieved? In Zerodha we can specify upfront both profit & loss % while taking order.

Hello @raghu

You can use custom scrips to add trailing stop loss as % and combine it with our order placement API. We want to keep order execution simple. You can look into placing BO orders and other order types which allow you to add SL and target legs along with the order, however you need to add absolute values in those fields.