How to Use DhanHQ API: Complete Guide to Trading, Market Data & Integration
If you want to automate trading, build your own strategy platform, connect Excel or Amibroker, or stream live market data — DhanHQ APIs give you everything you need.
From order placement to live market WebSocket feeds, historical OHLC, and portfolio access, DhanHQ offers one of the most complete API stacks for Indian markets.
In this post, you’ll learn:
What DhanHQ API includes
How to access API keys
How to place orders (with example)
How historical data works
Limits, charges & restrictions
How to check subscription status
Whether corporate action adjustments exist
Rate limits, order caps & Data API usage
How to connect Excel, MT, Amibroker
How to track instruments & LTP
Full FAQ section
👉 Start Using DhanHQ API (Sign in to Generate Your Access Token)
What is DhanHQ API?
DhanHQ is Dhan’s official trading & market data API suite designed for:
Algo traders
Professional traders
Fintech platforms
Data visualization tools
Quant developers
Excel/Google Sheets users
Amibroker, MetaTrader & TradingView bridge users
Dhan provides:
✔ Trading APIs
Place, modify, cancel orders
Check positions, holdings, margins, orderbook, and trades.
✔ Data APIs
Historical OHLC
Live market feed via WebSocket
Quotes, LTP, depth, and tick updates
✔ Integration APIs
Connect external platforms to Dhan using REST & WebSocket endpoints.
Step-by-Step: How to Access DhanHQ API
Here’s the exact onboarding flow:
Step 1: Log in to your Dhan Account
Go to Dhan Web → Log in → Profile.
Step 2: Navigate to “DhanHQ Trading APIs”
Inside profile settings, locate the API Access section.
Step 3: Generate Access Token
Click Generate Token → copy:
Access Token
Client ID
Step 4: Subscribe to Data API (Optional)
If you need live market feed or historical data at scale, enable DhanHQ Data API Subscription.
Step 5: Start integrating
Use REST endpoints or WebSocket to build:
Algos
Dashboards
Execution engines
Excel sheets
Amibroker/MT systems
What You Can Do With DhanHQ API
1. Place Orders Programmatically
Supported order types:
Market / Limit
Stop-Loss / Stop-Loss-Market
Intraday, CNC, MTF
Futures & Options
Order Slicing (Large Orders)
Order Placement Example (API)
2. Modify or Cancel Orders
Dhan allows:
Modify order (up to 25 times per order)
Cancel order
Modify/cancel bulk via your script
This is ideal for scalping, HFT-style algos, and dynamic strategies.
3. Access Historical Data via API
Available Timeframes
1 min
5 min
15 min
30 min
60 min
Daily OHLC
Data Range
Intraday minute data: last 5 trading days
Daily OHLC: extended date ranges
Corporate Action Adjustments?
Dhan has not explicitly confirmed whether OHLC is adjusted for splits/bonuses.
If adjusted data is needed → verify endpoint response.
4. Live Market Feed (WebSocket)
Track:
LTP
Depth
Tick updates
Quotes
OHLC
Multiple instruments at once
Example (Python SDK):
You can track hundreds to thousands of instruments depending on your subscription.
5. Connect to Excel, MetaTrader, Amibroker
DhanHQ supports integration with:
Excel
Pull real-time quotes & place orders via macro/API calls.Amibroker
Use a custom AFL bridge via REST/WebSocket.MetaTrader (MT4/MT5)
Use an EA/bridge plugin to route MT orders to DhanHQ.
Any app that supports HTTP or WebSocket can connect.
6. Check API Subscription & Usage
You can verify:
Data API subscription
Expiry
Access token validity
Usage limits
Rate limits
From DhanHQ dashboard > Developer/API section.
7. Supported Languages
DhanHQ can be used with:
Python (official SDK)
JavaScript / Node.js
Java
Go
C#
C++
Rust
Ruby
Any language that supports REST + WebSocket
8. Rate Limits (Important)
API Type | Per Sec | Per Min | Per Day |
|---|---|---|---|
Order API | 25 | 250 | 7,000 |
Data API | 5 | — | 100,000 |
Quotes API | 1 | — | Unlimited |
Non-Trading API | 20 | Unlimited | Unlimited |
If your algo exceeds these, your requests may be throttled.
9. Order Placement Limit
Technically DhanHQ supports high throughput:
25 order requests per second
250 per minute
Your account balance, margins, and risk checks still apply.
10. Basket Orders?
There is no dedicated “basket order” API, but you can:
Script multi-order execution
Run parallel REST calls
Use order slicing for large trades
11. Statement Retrieval via API
At present, there is no direct endpoint for:
P&L statement PDF
Tax statement
Ledger PDF
But you can fetch portfolio, positions, fund limits via API.
DhanHQ Data API Subscription — How It Works
Enable Data API via subscription panel
Access LTP, quotes, depth, OHLC, live feed
Use REST or WebSocket
Check usage in dashboard
Cancel anytime from subscription panel
Deactivation, Cancellation & Support
Deactivate F&O Segment
This is not done via API.
Go to Dhan App → Profile → Segments or contact support.
Cancel Data API Subscription
Go to Profile → Data Subscription → Cancel.
Token Validity
Dhan has not publicly disclosed maximum validity; token remains valid until expired or manually regenerated.
FAQs
1. Are APIs available for all exchanges?
Yes — NSE & BSE equity, equity derivatives, and more depending on your segment activation.
2. How many instruments can I track?
Hundreds to thousands depending on subscription & WebSocket bandwidth.
3. Is live market data free?
Live feed requires Data API subscription.
4. Are corporate actions adjusted?
Not officially confirmed — verify data points.
Conclusion — Should You Use DhanHQ API?
If you’re a trader, quant, developer, or fintech builder who needs:
High-speed execution
Reliable market data
Scalable WebSocket feeds
Strong Python SDK
Easy integration with Excel/Amibroker/MT
Modern rate limits & slicing orders
Then DhanHQ API is one of the best in India.
It’s fast, stable, well-documented, and ideal for both professional traders and developers.
🌟 Why Dhan Leads the Way?
Dhan’s focus has always been innovation with transparency.
They’ve built powerful features that make trading and investing seamless:
DEXT – Their proprietary trading platform (recognized by Amazon AWS)
Instant Pledge & Unpledge
Super Orders
Instant Withdrawals
Mutual Funds in Demat Format
Portfolio Tracking (across banks, stocks & mutual funds)
Dhan Brokerage & Charges
₹0 on equity delivery
₹20 or 0.03% (whichever lower) per executed order for intraday, F&O, commodity, and currency.
No hidden charges, no minimum balance.
Other Fees:
Service | Charges |
|---|---|
Account Opening | ₹0 |
Annual Maintenance (AMC) | ₹0 |
Pledge/Unpledge | ₹12.5 per request |
Auto-square off | ₹20 per order |
Verdict: ✅ Transparent, simple, and competitive.
Dhan Trading Platforms (Web + App + Dedicated Options App)
1. Dhan Web
Full-fledged professional interface
Real-time charts powered by TradingView
Fast execution & 20-depth market view
Multi-tab workspace for multiple scripts
2. Dhan Mobile App
Clean, intuitive UI
Live option chain data
Pre-built strategies for beginners
Advanced indicators & pattern recognition
3. Dhan Options Trader App
Specifically designed for options traders
Built-in strategy builder (free)
Live Greeks (Delta, Theta, Gamma, Vega)
IV, PCR, Max Pain analytics
“Payoff” graph for visual risk/reward analysis
Advanced Features That Make Dhan Stand Out
🧩 1. Native TradingView Integration
Direct chart trading from TradingView.
Place, modify, or cancel orders from the chart — no toggling screens.
⚡ 2. Scalper Mode
For high-frequency intraday traders.
Execute orders instantly with one tap.
💡 3. Iceberg & Super Orders
Split large trades automatically for better execution.
Set entry, SL, and target in one click.
🔍 4. ScanX Screener
Technical + fundamental screener with live trends.
Detect breakouts, momentum shifts, and candlestick patterns.
🔔 5. Trader Controls
Smart alerts to prevent over-trading or margin exhaustion.
Ideal for disciplined trading.
🤖 6. API & Algo Trading
Free API access for all users.
Compatible with Python, TradingView alerts, or third-party platforms.
Margin & Leverage (MTF)
Dhan offers up to 4× leverage (75% funding) for equity delivery under Margin Trading Facility (MTF).
You can buy delivery shares by paying only 25% upfront.
Pledge existing holdings for additional leverage.
Intraday Margin:
Equity: Up to 5x
Index Options: 1x to 2x (based on liquidity)
Futures: Full margin applicable as per SEBI norms
Charting, Technical Analysis & Tools
TradingView & ChartIQ both supported.
Multiple indicators (200+ built-in).
Multi-timeframe charts.
Advanced drawing tools.
Auto-detection of candlestick patterns.
Pro Tip:
Dhan’s native TradingView integration is unique — you can trade directly from your chart, not just analyze. Perfect for scalpers and short-term traders.
Order Types & Execution
Market, Limit, SL, SL-M orders
Cover Orders (CO), Bracket Orders (BO)
Forever Orders (GTT equivalent)
Iceberg, Super Orders, and Basket Orders
Average order execution speed: <20 milliseconds
That’s faster than almost every other Indian broker.
Dhan for Options Trading
If you trade Nifty, Bank Nifty, or FINNIFTY options — Dhan’s Options Trader App is one of the most advanced in India.
Key Highlights:
Full options chain with Greeks
Built-in Strategy Builder
IV, OI, PCR, Max Pain, and Intrinsic Value analytics
Ready-made & customizable strategies
Instant margin calculator
Payoff chart visualizer
Verdict:
Dhan is currently the #1 options trading app in India (2025) — combining speed, analytics, and zero additional charges for strategy tools.
Dhan for Intraday Trading
For active intraday traders, Dhan delivers:
Super-fast execution (20ms latency)
Scalper Mode for one-tap trading
Advanced chart-based orders
Real-time depth (20 levels)
Smart order types like Iceberg
In a 3-month real test (2025 Q1):
No major downtime
Execution accuracy >99.8%
Average slippage <0.03%
Verdict:
Perfect for scalpers, day traders, and short-term positional setups.
If you’re looking for a modern, feature-rich, and trader-friendly platform, Dhan is easily one of the best choices available today. From zero account opening charges to advanced tools like native TradingView, options strategy builder, and free API access, Dhan is clearly built with the modern Indian trader in mind.
Whether you’re an intraday trader, an options strategist, or a long-term investor, Dhan offers the perfect blend of speed, simplicity, and smart technology — without burning a hole in your pocket.
Why wait? Open your Dhan account now and take control of your trading journey with confidence.
👉 Click here to get started with Dhan
Open a Free Dhan Trading & Demat Account
Dhan offers cutting-edge tools for fast, powerful, and informed trading:
- ✅ Zero brokerage on delivery trades
- ✅ Auto-detection of candlestick patterns on charts
- ✅ Advanced Option Chain with Greeks, Max Pain, PCR & more
- ✅ Pre-built & custom Option Strategy Builder (Free)
- ✅ 20 Depth Market Data and Flash Trade execution
- ✅ Margin Trading Facility (MTF) with 4X leverage (75%)
- ✅ 3 Platforms: Mobile App, Web App & Dedicated Options App
- ✅ ScanX Screener: stock insights, trends & news
- ✅ Advanced orders: Trailing SL, Iceberg, Forever Orders
- ✅ Instantly pledge 1,500+ stocks for options margin
- ✅ Trade commodities: Gold, Silver, Crude, Natural Gas
- ✅ Fundamental + Technical analysis across all platforms
No paperwork. Zero account opening charges. Setup in minutes.
Customer Support & Reliability
24×7 email and chat support
Dedicated trading desk for active traders
Fast response via Telegram and Twitter
User Ratings:
| Platform | Rating | Reviews |
|---|---|---|
| Play Store | ⭐4.6 | 200K+ |
| App Store | ⭐4.5 | 70K+ |
| Web App | Highly rated for speed & UI |
Dhan vs Competitors (Quick Comparison)
Feature | Dhan | Upstox | Zerodha | Fyers | Groww |
|---|---|---|---|---|---|
Brokerage | ₹20/order | ₹20 | ₹20 | ₹20 | ₹20 or 0.05% |
Account Opening | Free | Free | Paid (₹200) | Free | Free |
TradingView Integration | ✅ Native | ⚙️ Partial | ❌ | ✅ Built-in | ❌ |
API Access | ✅ Free | Paid | Paid | Free | ❌ |
Options Strategy Builder | ✅ Advanced | Limited | ❌ | ✅ Basic | ❌ |
Speed | ⚡ Ultra-fast | Fast | Moderate | Fast | Average |
Margin (MTF) | ✅ 4× | ✅ 4× | ❌ | ✅ 4× | ❌ |
Verdict:
Dhan beats most brokers on speed, tech, and trader tools — especially for intraday and options trading.
How to Open a Dhan Account?
Visit https://dhan.co
Click “Open Free Account”
Upload PAN, Aadhaar & bank details
Complete eSign using Aadhaar OTP
Start trading instantly (no paperwork)
💥: Open Free Dhan Account Now – 100% online in under 5 minutes.
If you’re serious about trading, don’t compromise on tools or speed.
🔥 Open Your Free Dhan Account Today & Start Trading Smarter →
If you’re a trader or want more control over execution, charts, and speed.
Dhan is not just another discount broker — it’s genuinely innovating, especially for the next-gen Indian trader.
If you’re tired of clunky trading platforms and want modern, high-speed trading with transparent fees — Dhan is one of the best stockbrokers in India today.
According to the latest NSE reports there are about 200+ stock brokers in India, however what makes Dhan a leading and strong contender in the stock broking industry is the tools and resources they have in their trading platform.
Moreover there are no hidden charges and the brokerages are very minimal if we do the industry comparison. They are also backed by cash enriched investors so nothing to fear.
If I have to rate Dhan app after looking at there breakthrough pricing model for brokerages as well as other charges and experiencing there simple yet great user interface for trading platform I would give it 9.6 out of 10.
There’s never been a better time to take control of your financial future and with Dhan, you get the fastest, most reliable, and feature-packed stock broker app in India for 2025.
Whether you’re a beginner eager to start investing or an experienced trader seeking advanced tools and zero brokerage on delivery trades, Dhan has everything you need to succeed.
Don’t settle for less. Join over 2 million + satisfied users who trust Dhan to power their trading journey every day. With zero account opening fees, free access to multiple platforms, and dedicated customer support, the path to smarter trading has never been easier.
🚀 Ready to Elevate Your Trading Game?
Start your journey with Dhan — India’s fastest, most reliable, and user-friendly stock broker app trusted by over 1 million users.
No hidden fees. No complicated processes. Just smart, seamless trading.
It takes less than 5 minutes to sign up and start trading.
If, you have liked the content please do share it with your friends or on social media, as sharing do bring the good karma. If you have any questions or feedback you can leave them in comment box below.
Note: Please do your own research and make investment. Moneycontain will not be responsible for any of your losses at all. The point made is for educational purpose only and intended to give information. All investments are subject to risks, which should be considered prior to making any investments.
