Weâre glad to share that all API-related regulatory changes are now live on DhanHQ APIs.
Whether youâre an individual running your own strategies or using a third-party platform, you can continue trading seamlessly on Dhan. Throughout this transition, our focus has been clear - to stay compliant while ensuring your trading experience remains smooth and uninterrupted.
Market Price Protection (MPP) on APIs - Live
All market orders placed through APIs are now automatically converted to limit orders with MPP applied. Please ensure your systems are checking order execution status accordingly.
Updated Order Rate Limits - Live
The order rate limit via APIs is now 10 orders per second. If you havenât already, review your strategy logic to stay within the updated limits.
Static IP Whitelisting - Live
As of today Static IP registration is now mandatory for all API-based trading. Orders originating from unregistered IP addresses will not be accepted.
We hope your trading setup continues to operate seamlessly under these changes. In case you want to check and verify the IP you are placing order from is same as whitelisted IP, you can use the Get Static IP endpoint to check your current configuration.
If you have any questions, feel free to drop them in this thread or reach out to us at apihelp@dhan.co.
For partners and third-party platforms, please write to api@dhan.co - our team will assist you with the required setup and ensure full compliance.
Weâre here to make this transition as smooth as possible for everyone.
Can you explain more here. Is it because of orders getting converted to limit or other reason? Any particular instrument that you faced this issue with?
As you know, when MPP is applied, we convert it with a limit price lower than the LTP for sell orders (for buy orders, it is opposite - limit price is higher than LTP). This is to ensure that the order is executed immediately.
Do note, this price is not the actual execution price. And this will be executed only at the best available bid/ask itself. If you do not want to take this gap, you can always put limit orders yourself.
Hey @Hardik , Iâm placing an order with my API. First, I updated my primary IP. For some reason, I changed my static IP, generated a new one, and added it to the secondary IP. But when placing the order, the dhan shows âIP invalidâ. Why isnât it taking the secondary IP, and why is it showing invalid?
@Hardik with this logic there is no guarantee that order will be placed. I see my orders are always stuck with the buy limit line. They are never executed because most of the time stock price has already moved up compared to where the last LTP was during the order execution.
Hi @Hardik, I am not sure if this is logically correct. Most of the orders will be in PENDING status if you try to place the order at best matching bid/ask price due to volatile nature of market.
I think the correct logic should be placing the LIMIT order at the boundary of MPP range based on orderType (BUY/SELL). Lets assume this as the MPP range:
Now let me take my own example of todayâs orderId: 23126040134908. The MARKET order was placed at 12:25:01pm today to sell the 80 qty of LIQUIDCASE, your DHAN system has set the LIMIT price of 113.43 (best bid & ask price or whatever the logic you have now) and itâs been more than two hours the LTP of this ETF is hovering around the same price 113.43, but due to LIMIT order condition the execution is queued with exchange, it will be probably CANCELLED if I do not manually convert to MARKET.
Instead if you have used the MPP Price Range (1% in my case) to set the LIMIT SELL order price as 112.2957 (i.e. 113.43 - 1% MPP), the order would have executed immediately with MPP protection.
Like I mentioned your current logic to convert the MARKET order to LIMIT order is flawed. I hope you can rectify it so the execution is smooth/immediate without breaking with SEBI guidelines.
Let me know if you have any question. I might convert the my Pending order to MARKET from Dhan UI by EOD.
Converting the order from LIMIT to MARKET was being REJECTED, I had to cancel that particular order and place a new SELL order in the from the Dhan UI.
But this time I have manually placed LIMIT sell order with LIMIT Price of 112.29 and it got executed immediately at a avg. price of 113.42, which is as good as MARKET price.
@Hardik MPP implementation is posing several hurdles. even from API Market orders did not need additional margin, now they sit as limit orders demanding more margin in your account, secondarily , market orders from API convert into limit orders at ridiculously poor levels and in a fast market like what we have now, they end up sitting idle soaking up margin, while a real limit order for another trade can convert, it gets rejected because of multiple limit orders sitting idle. Why did you not push back to the regulator? this market order getting filled at wrong prices was an edge case that barely affected a few people, now it is in danger of destroying a fledgling algo community
i had sold option with hedge when my algo placed market order for the sold option A buy market order was placed above LTP approx 20 points and it got executed fine
But when my algo placed sell market order for the 8rs option i had bought for hedge it was placed at 10rs limit and not belov 8rs??
Our regulators are always coming up with policies that make it difficult for traders to operate in the Indian stock market, all in the name of protecting retail investors and reducing speculation. But they donât take any steps toward reducing costs like STT, stamp duty, GST, or exchange charges
I respect the regulatory changes but for who still developing something like POC put extra cost and bottleneck due to static IP compliance. I think either there should be flexibility to setup it daily like API token, else there must be sandbox environment (like Delta Exchange where we have everything to develop and test app in real market including reloadable dummy account to to order execution). We are expecting same type of environment from Dhan not just sandbox API hosted without sandbox account. This gives more flexibility to develop something without risking real money and avoiding compliance issues like static ip etc. @Hardik@PravinJ
@Hardik Hey Hardik, I tried to modify my primary IP from API. The message showed âsuccessfulâ, but when checking, itâs not showing the modified IP. In the dashboard, it still shows able to modify. But when I try saving after changing the IP, it shows âyou can reset your IP after 6 daysâ. If this is the case, why is it able to edit or not saving my new IP?
Iâm facing the same issueâIâm unable to modify my primary IP address. The system allows me to paste the new primary IP, but when I try to save it, I get a message saying that the IP address can only be reset after six days.
I also have a related question: what is the purpose of a secondary IP address? I have purchased a static IPv4 address from my ISP and set it as my secondary IP, while my primary IP is IPv6.
However, when I try to place an order using the API, it fails with a âprimary IP address mismatchâ error. This happens even though websites like whatismyipaddress.com show my IPv4 address (which is set as the secondary IP).
For reference, Iâve included the response from the âGet IP Addressâ API below.
Note I have masked the value of the primary IP address and secondary IP address but the response from Dhan shows the dedicated IP address as my primary. What is the use of the secondary IP address if I canât use that for placing the order?
what I understood from this response is my primary IP address can be modified today or after today and my secondary IP address can only be modified after 13th April 2026, which I think is correct because I already modified my secondary IP today. I could not modify my primary IP address because of this error.
Can you raise this with your client ID and details on apihelp@dhan.co, we will check the logs for the same. This shouldnât have happened given we validate on the basis of primary or secondary IP, either of these.