Skip to main content
DhanHQ Developer Documentation

Everything you need to
build on Superfast APIs.

Trade with algorithms, connect with apps, build services - all with free of cost Trading API.

Explore APIs
Trading + Data APIAgent NativeLow Latency
first_order.pyPython
$ 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,
)
MCP

A native Model Context Protocol server connects your live Dhan account to any MCP-compatible client — trade, manage your portfolio, fetch market data, set alerts and calculate margins through natural language.

Also in this section
Explore Dhan MCP

Native MCP server

A first-party Model Context Protocol server so any MCP-aware client can call DhanHQ tools directly — trade, manage your portfolio, fetch market data and calculate margins through natural language.

Tool surface
Read & trade capabilities mapped to MCP tools.
Scopes & auth
Per-session permission model with explicit consent.

Supported clients

Works with any MCP-compatible client — Claude Desktop, Cursor, Kiro, VS Code and anything built on an MCP SDK.

Claude Desktop
Anthropic's desktop app
Cursor
Connect inside your IDE
Custom MCP client
BYO client over stdio or HTTP
Dhan Cloud

Cloud infrastructure purpose-built for algorithmic trading — deploy, run and scale strategies on reliable, low-latency infra without managing servers.

Project

Projects

Create, version and deploy strategies on the Dhan Cloud runtime — no servers to babysit.

3 of 5 slots· Learn more →
Runtime24h histogram

Runs & Deployments

Scheduled, event-driven and on-demand runs with full logs and one-click replay.