How to Create Your Dhan API Key
Once you’ve figured out the meaning of an API and how it functions The next step is to figure out how to create your own personal Dhan API Key. This key serves as a safe access pass that allows your trading software or program direct into Dhan. Dhan platform.
Consider it your own personal way to gain access to automated trading using DhanHQ. Once you’ve got your password access, you can create trading bots, collect market information.
Step-by-Step: Getting Your API Access Token
Here’s the exact procedure to create you your Dhan API token:
Go to web.dhan.co and sign in into the account you have created with your Dhan account.
Click on your profile photo in the upper right hand corner.
Choose”Accept DhanHQ APIs.” “Access DhanHQ APIs.”
If you are prompted to pay to pay, you must make payment of the small fee for activation to activate API access.
Click on Generate Token.
Copy the token generated and secure it. The token is your unique code to connect your system to Dhan.
That’s it! It’s now time to get your Dhan API code that is vital to run automated strategies and connecting to trading tools.
Understanding Dhan API Rate Limits
When you utilize the Dhan API your system connects to Dhan’s servers to make orders, retrieve information, or look over your portfolio. Just like limitations on the speed of roadways, they have limit on rates to ensure that everything is running smoothly and efficiently.
Here’s the information you need to be aware of:
Order Speed Limits (Placing Trades)
25 orders per second. 25 orders per second.
250 orders per minute. 250 orders per minute.
As high as 1,000 order per hour
As high as 7700 orders a day
If your bot is trying to go over these limits the bot could be temporarily blocked. This will ensure fair use of all users.
Market Data Requests (Historical Prices & Charts)
You can retrieve five bits of chart data each second
A maximum of 100000 requests per day
Live Price Quotes (Real-Time Prices)
You can make an inquiry for one live price for the stock per second.
There is no daily limit, however it must be only one limit per second to ensure security
Why These Limits Exist
To provide an equal access to all users
To safeguard servers from overloaded servers
To ensure your trade is secure and steady
Logging in to Dhan Using Python
Once you have received your API token Once you have your API token, you are able to link your Python program to the Dhan account. This is similar to declaring: “Hey Dhan, it’s me–let’s trade!”
To speed up the process to make it easier, we employ the Tradehull SDK as a tool that facilitates seamless integration.
Step 1: Install the SDK
Start the terminal (or command prompt) and then type:
pip install Dhan-Tradehull
You can also find it here: Dhan-Tradehull on PyPI
Step 2: Link to Your Token
Here’s a simple Python example:
from Dhan_Tradehull import Tradehull
client_code = "your_client_code"
token_id = "your_token_id"
tsl = Tradehull(client_code, token_id)
This code informs the computer that “Here’s my Dhan API key–please log me in.” If it’s successful it will verify your Dhan profile and you’re all set to go.
What Can You Do After Logging In?
When connected, the system will be able to be able to perform a range of trading automation tasks:
Fetch live stock prices
You can access historic charts as well as market information
Make changes, place or cancel orders immediately
Keep track of Your portfolio and investments
Use options information as well as Greeks (Delta, Theta, etc. )
Recognize ATM and ITM and OTM strike options
Utilize advanced features such as automated stop-losses
With Dhan-Tradehull’s help, you don’t need to code all of the features from scratch. The majority of features are already in place and ready for utilize, making your transition into trading with algorithms more efficient and less time-consuming.
Try It Yourself
To learn more about all the capabilities, look into Dhan-Tradehull, the package that is officially available:
Dhan-Tradehull on PyPI
It comes with codes that can be copied, modified and test. Even when you’re only beginning your journey you’ll find it easy to use and useful.
Final Thoughts
Making the Dhan API Key is the initial step to unlocking the possibilities in automated trading. Once you have the key you can join your strategies, create bots and unlock the full power of algorithmic trading.
At TradeHull we strive to help traders to comprehend and utilize APIs such as DhanHQ to use them to learn, creating custom algorithms, or playing with automated.