Trade with algorithms, connect with apps, build services - all with free of cost Trading API.
$ pip install dhanhq
...
from dhanhq import DhanContext, dhanhq
ctx = DhanContext(client_id, access_token)
dhan = dhanhq(ctx)
# place your first order
dhan.place_order(
security_id="1333",
exchange_segment="NSE_EQ",
quantity=10,
)One platform for orders, portfolio, market data and live feeds across NSE, BSE and MCX - covering super orders, conditional triggers, option chain with Greeks and historical OHLC.
Place, modify and cancel orders. Super orders, forever orders, conditional triggers, position conversion, slicing — plus funds and margin endpoints.
Live quotes, full market depth, option chain with Greeks and historical OHLC. REST for snapshots, WebSocket for live streams.
A native Model Context Protocol server is on the roadmap so any MCP-aware client can call DhanHQ directly. For AI coding agents today, use Agent Skills.
Open SKILL.md skills that give your AI coding agent deep knowledge of DhanHQ APIs — from order placement to live market feeds. Works with Claude Code, Codex and any SKILL.md-compatible agent.
One skill pack with 12 categories — orders, portfolio, market data, option chain, instruments, funds, live feed, error codes, common workflows, options analysis, backtesting and ScanX.
Order confirmation required before every place / modify / cancel. LIMIT-by-default. Lot-size validation for F&O. Your agent stays a knowledgeable assistant, not an autonomous trader.
Cloud infrastructure purpose-built for algorithmic trading — deploy, run and scale strategies on reliable, low-latency infra without managing servers.
Create, version and deploy strategies on the Dhan Cloud runtime — no servers to babysit.
Scheduled, event-driven and on-demand runs with full logs and one-click replay.