dhanhq

dhanhq is a skill for Claude Code, Codex from dhan-oss/dhanhq-skills. It costs 124 tokens per session (3,020 once invoked), scanned A, original, MIT.

A DhanHQ skill for working with India's NSE, BSE, and MCX markets through the Dhan API, including orders, holdings, positions, market data, and option chains.

In plain words
What is it for?
Use it to build or run Dhan scripts, inspect trading data, and prepare, modify, or cancel stock, futures, options, and commodity orders with confirmation.
Why use it?
It provides the setup and safety rules needed to work with an Indian trading account without hardcoding credentials or sending unchecked live orders.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to build or run Dhan scripts, inspect trading data, and prepare, modify, or cancel stock, futures, options, and commodity orders with confirmation.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/dhan-oss/dhanhq-skills/dhanhq
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add dhan-oss/dhanhq-skills --skill dhanhq
Clone the repo
git clone --depth 1 https://github.com/dhan-oss/dhanhq-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for dhanhq

README.md
[![agentmods](https://agentmods.dev/badge/skills/dhan-oss/dhanhq-skills/dhanhq/github.svg)](https://agentmods.dev/skills/dhan-oss/dhanhq-skills/dhanhq)
Your own site
<a href="https://agentmods.dev/skills/dhan-oss/dhanhq-skills/dhanhq"><img src="https://agentmods.dev/badge/skills/dhan-oss/dhanhq-skills/dhanhq/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for dhanhq

Your own site · 80×15
<a href="https://agentmods.dev/skills/dhan-oss/dhanhq-skills/dhanhq"><img src="https://agentmods.dev/badge/skills/dhan-oss/dhanhq-skills/dhanhq.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 124 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,020 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • Socket pass 27 Apr 2026
  • Snyk warn 27 Apr 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00124 $0.03020
Opus 5 $0.00062 $0.01510
Sonnet 5 $0.00025 $0.00604
Haiku 4.5 $0.00012 $0.00302

Measured 12d ago against content hash 4c495f6868c3, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

dhanhq scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

The scan reads SKILL.md. This mod also ships 15 executable files (examples/fetch_option_chain.py, examples/gtt_forever_order.py, examples/historical_data_analysis.py, …), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/dhanhq/SKILL.md · 320 lines

How it starts

The opening of the file, as written. The whole thing — 320 lines — stays where its author put it; the contents beside it link to each section on GitHub.

DhanHQ — Indian Market Trading Skill

Setup

Stable install:

pip install dhanhq

Use the current SDK branch when you need newer v2 capabilities such as 200-level depth or the latest helper coverage:

pip install --upgrade dhanhq

Minimal initialization:

from dhanhq import DhanContext, dhanhq

dhan_context = DhanContext("YOUR_CLIENT_ID", "YOUR_ACCESS_TOKEN")
dhan = dhanhq(dhan_context)

Environment-variable setup:

import os
from dhanhq import DhanContext, dhanhq

dhan_context = DhanContext(
    os.environ["DHAN_CLIENT_ID"],
    os.environ["DHAN_ACCESS_TOKEN"],
)
dhan = dhanhq(dhan_context)

If generating scripts for this repo, prefer:

from scripts.dhan_helpers import get_client

dhan, dhan_context = get_client()

Safety Rules — Always Enforce

  1. Confirm before placing live orders.
  2. Show a readable order preview before execution.
  3. Default to LIMIT orders unless the user explicitly wants MARKET.
  4. Warn when notional exceeds Rs. 50,000.
  5. For F&O, validate lot size before placement.
  6. Never use CNC or MTF for F&O, commodity, or currency segments.
  7. Never hardcode credentials in generated code.
  8. Ask for confirmation before modify_order, cancel_order, kill_switch, or any multi-leg live execution.

Access Checks Before Live Use

Before using the account for live work, verify:

  1. Access token is valid.
  2. dhan_login.user_profile(...) or GET /profile shows the needed account setup.
  3. dataPlan is active for quote/history/feed/option-chain use.
  4. Static IP is configured for order placement, order modification, order cancellation, super orders, and forever orders.

Useful profile fields:

  • tokenValidity
  • activeSegment
  • ddpi
  • mtf
  • dataPlan
  • dataValidity

Current SDK Constants

Category Constant Value
Exchange dhanhq.NSE NSE_EQ
dhanhq.BSE BSE_EQ
dhanhq.NSE_FNO NSE_FNO
dhanhq.BSE_FNO BSE_FNO
dhanhq.MCX MCX_COMM
dhanhq.CUR NSE_CURRENCY
dhanhq.INDEX IDX_I
Transaction dhanhq.BUY BUY
dhanhq.SELL SELL
Order Type dhanhq.LIMIT LIMIT
dhanhq.MARKET MARKET
dhanhq.SL STOP_LOSS
dhanhq.SLM STOP_LOSS_MARKET
Product dhanhq.CNC CNC
dhanhq.INTRA INTRADAY
dhanhq.MARGIN MARGIN
dhanhq.MTF MTF
Validity dhanhq.DAY DAY
dhanhq.IOC IOC

Read the full file on GitHub · 320 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago First seen · 320 lines · 124 tokens per session scan A 4c495f6868c3

Subscribe to this mod's changes

dhanhq is a skill published in the GitHub repository dhan-oss/dhanhq-skills (31 stars, last pushed 2mo ago), licensed MIT. It adds 124 tokens to every session and 3,020 once invoked, about $0.0006 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

sector-rotation

An analysis framework for comparing industries in the Chinese A-share stock market, using business conditions, price momentum, valuation, and money flows. It produces rankings and higher- or lower-allocation suggestions.

HKUDS/Vibe-Trading · 39 tokens

strategy-pivot-designer

Detect backtest iteration stagnation and generate structurally different strategy pivot proposals when parameter tuning reaches a local optimum.

tradermonty/claude-trading-skills · 28 tokens

twitter-reader

Read Twitter/X for financial research using opencli (read-only). Use this skill whenever the user wants to read their Twitter feed, search for financial tweets, view bookmarks, look up user profiles, or gather market sentiment from Twitter/X. Triggers include: "check my feed", "search Twitter for", "show my…

himself65/finance-skills · 161 tokens

chenhao-limit-up

A framework for judging Chinese A-share stocks that have reached the daily price-rise limit, using market mood, sector leadership, and trading momentum.

questflowai/investorskills · 44 tokens

furusato

A Japanese hometown-tax donation manager for furusato nozei, a system where donations to municipalities can qualify for an income-tax or local-tax deduction. It reads donation receipts, stores donation records, and calculates deduction limits.

kazukinagata/shinkoku · 102 tokens

reading-receipt

An image-reading workflow for extracting structured information from receipts, invoices, and hometown-tax donation certificates. It can first extract text from PDFs and otherwise read their images.

kazukinagata/shinkoku · 64 tokens