Guidelines on Algorithmic Trading for Retail Traders

Hello Everyone,

Algo Trading has been popular for a long time in the Indian markets, especially amongst institutions. At Dhan, we have worked from our initial days to build an ecosystem for Algo Traders, ensuring they can access the same infrastructure that the institutions access, whether that be for data or execution speeds delivered via DEXT.

While the retail trading community has been growing who have built their trading systems on top of our APIs, there was uncertainty on regulations around APIs and how algo trading will continue.

But now, with the recent SEBI circular on Safer Participation of Retail Traders in Algorithmic Trading, we have a clear directive on how this is going to be regulated soon. While the circular itself is quite extensive with all the operational modalities, there are only few pointers that a retail trader needs to ensure at his end while using APIs for trading.

Here’s a complete breakdown of the circular and what you have to ensure to continue using APIs, post the new circular implementation.

  1. Threshold for Order Placement:
    With the new regulations, all API orders are treated as algo orders. Also, if a user places less than 10 orders per second, then it does not require a registration at the exchange as an Algo.
    To ensure simplicity for all users, we are making the rate limits on Order APIs at 10 requests per second. Do note that GET APIs, which you use for getting status of orders and trades remain separate.
    We will have a separate portal in place soon for users who want to register their algos, in order to place more than 10 orders per second.

  2. Static IP whitelisting:
    As an API user, you need to provide a Static IP (you can add one as a backup IP as well), in order to continue using DhanHQ APIs. As per the regulations, this is for us as a broker to identify unique individual users who are using APIs to transact and no two users are using the same IP address at the same time in our system.
    Few points to keep in mind here: Firstly, static IP is not the same as what we get as our WiFi IP address - that is a dynamic IP and it changes every time you restart the router. Static IP is provided by ISPs or cloud service providers on request. You need to get the IP address and add it on the DhanHQ API access page. Once added, you do not need to worry about this again, until your IP changes.
    Do note that it will be allowed to change IP only once every 7 days. Also, we will only check for IP when the Order Placement APIs are used.

  3. New Authentication Mechanism:
    For simplicity and with the changing regulations, we are bringing an API Key based authentication as well. At Dhan, we have an access token module, which is simple and safe - to generate a token right from the platform for self use.
    Now, we are also adding an alternate method of authentication - which is API Key based login. API Key and Secret can now be used to create sessions to access API along with TOTP.
    This has been a request on this community as well for some time, and we are finally introducing this as an option for API authentication.

Other than these, for all users who use our partner platforms to trade manually or by automating, we are working with our ecosystem partners to ensure that you can continue using them without any blockers.

While we have just summarised the parts of the regulation which are applicable to you, wherein your algo trading journey is being altered, there’s a lot more in the regulations than this. Let’s take a look at the timeline of events and how the Algo Regulations have been shaped up:

  • Feb 04, 2025 - SEBI introduced circular on ‘Safer participation of retail investors in Algorithmic trading’ vide circular no. SEBI/HO/MIRSD/MIRSD-PoD/P/CIR/2025/0000013. This was planned to be implemented from 1st August, 2025
  • May 05, 2025 - Exchanges released circular inline with SEBI’s master circular on implementation of the guidelines.
  • July 22, 2025 - Exchanges release details for operational modalities related to implementation of circular across ecosystem
  • July 29, 2025 - SEBI released an extension for implementation of the circular to 01 October, 2025.

On the backdrop of this, we at Dhan, are also trying to make APIs more accessible for all retail traders, whether that be in respect of data or execution. We are building some unique APIs, which will make your algo trading journey much simpler and easier despite these new regulations.

Moreover, to reward our long term users of Data APIs, we are also introducing a yearly plan, where you subscribe once and enjoy using Data for the entire year. This is at a much lower rate of ₹399 per month, effectively 20% benefit. Not just this, with this same plan, we are also soon adding more data capabilities to make this deal sweeter.

As the regulations add guardrails to Algo Trading, we are sure this will act as a catalyst for algo traders and help us build this ecosystem even better. At Dhan, we are committed to ensuring compliance whilst building a seamless experience for you.

Do let us know your feedback on the new regulations, changes and how we can make all of this more seamless.

Happy Trading on APIs!
Hardik

6 Likes

@Hardik will the tradingview webhook automation continue as is ?

@Hardik could you please help with my queries below

  • Will Dhan support IPv6 static IP whitelisting?
  • When can we expect the static IP registration page to be available?
  • When can we expect the new API key mechanism?
  • Is there any end-of-support timeline for the old mechanism?
1 Like

Hello Hardik,

Thank you for the detailed update on SEBI compliance and static IP requirements for DhanHQ API access. Could you please clarify if the static IP whitelisting feature supports IPv6 addresses, or is it limited to IPv4 only? Many cloud providers and enterprise networks now offer IPv6, so support for this would be highly beneficial for some users.

1 Like

https://askfuzz.ai/ dhan AI

Hello @vivek2020 @Titamazon

We will be supporting IPv6 as well as IPv4. We are currently testing the same to ensure the compatibility.

This will be live by next week, given the regulations are going to be applicable by 1st October mandatorily.

This will be available at the same time as IP page.

The old mechanism will continue as is, which is using access token for APIs authentication. However, the maximum duration of token will soon be limited to a single trading session.

@Hardik will the tradingview webhook automation continue as is ?
Yes, the tradingview webhook automation will work as is. There is no impact of the algorithm regulations on the same.

2 Likes

Thanks.

1 Like

I strongly urge you not to reduce the token validity duration. This would make the experience unnecessarily painful for traders. One of the key reasons many of us use the Dhan API is the 30-day validity - forcing daily OTPs or frequent re-authentication defeats the very purpose of automation and is something most traders, including myself, would find unacceptable.

SEBI regulations are already making life harder for retail traders. Please don’t add to that pain with changes that will only make automation and execution more difficult.

@Hardik @PravinJ

1 Like

@Hardik correct me if I’m wrong — you’re also going to provide an alternate method where users can generate a token or log in using an API key and TOTP, which can be automated and would remove the need to log in to the Dhan website daily. I am able to see apikey option but not found any documentation how to use.

@AkshayBhatla

1 Like

Hey @AkshayBhatla @Titamazon

Yes, we are going to have an alternate method to authenticate coming up, which will solve for this.

The team is here to ensure the transition is smooth for everyone using DhanHQ APIs.

3 Likes

Yes, either using pyotp for totp or just allow mpin usage

generate a token or log in using an API key and TOTP, which can be automated and would remove the need to log in to the Dhan website daily.*

DEAR DHAN TEAM PLEASE PROVIDE DOCUMENTATION AND READY PYTHON CODE FOR AUTOLOGIN AS OTHER BROKERS…AS SSON AS POSSIBLE. THANKS IN ADVANCE

generate a token or log in using an API key and TOTP, which can be automated and would remove the need to log in to the Dhan website daily.*

DEAR DHAN TEAM PLEASE PROVIDE DOCUMENTATION AND READY PYTHON CODE FOR AUTOLOGIN AS OTHER BROKERS…AS SOON AS POSSIBLE. THANKS IN ADVANCE.

1 Like

Only doubt we have is how to use new version of API key instead of access token and TOTP can you make a video on these new product features @Hardik. Why because this new authentication is looking like openalgo version is it same as that openalgo which we have to use api key and TOTP to login for a web version. Or it is also applicable for all desktop based python env.

Hi @Hardik,

Static IP whitelisting:

For me this is more concerning part. Suppose someone is still in development phase and using internet without Static IP.
Would still be able to continue as it is?
What if someone wouldn’t be able to get Static IP?

You will havw to get one with your ISP, or purchase one elsewhere, or purchase a VPN with dedicated ip

You can set up a cloud server with oracle which will give you a static IP. All free of cost as long as you are happy with the free resource limits.

1 Like

I got you. But there are many aspect how Dhan design this system:

Like other broker or exchange IP whitelisting is majorly on production environment not on dev or sandbox. This limits developers flexibility and create hurdle. I personally switch my internet a lot based on my day availability and location.

Even on prod, they are not limiting that we can’t change static IP within in a week if added. I think this is the worst here.

What Dhan want to bear additional cost of static IP + Data APIs charges even during development? if Dhan forces static IP + data fees from day one, many retail developers may never ship.

@Hardik i had discussion with support team 2 months back. They said the regulation is for trading api not for data api and we will keep it separate.
Now you are giving access token which expires in 24 hrs for data api also. Some brokers provide data api free of cost with daily token expiry. Why should i subscribe for 499 for data api. Even i discussed with global feed and truedata they give client id and password which is valid throughout the year.
The regulation of daily token expiry and static ip is for trading api not for data api.
Let me know if you have any different plan for data api. Otherwise either i have to switch to free api by other brokers where i already have account or to truedata.
I run my python script using options chain data api on cloud and place order through algotest.

Hey @Dharmender

I understand the point you are making. Happy to clear the confusion for you. Dhan is the only broker with a sandbox environment where you can fetch sample data and even place order along with all other endpoints, so that you do not need to pay any charges or even open an account with us in order to interact with our APIs.

Not sure how other brokers have this implementation, but this is actually a requirement from the exchanges.

@Shahid_Shahid yes, you are right on this and this is why we have introduced the API key based login. You can use the same to simplify daily authentication at your end.