dhanhq
БесплатноЗапускает вложенные скриптыНе проверенUse when the user mentions DhanHQ, Dhan API, or wants to trade on Indian exchanges (NSE, BSE, MCX). Triggers for: place, modify, or cancel stock/F&O/commodity…
от dhan-oss★ 45 звёзд на 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
- Confirm before placing live orders.
- Show a readable order preview before execution.
- Default to
LIMITorders unless the user explicitly wantsMARKET. - Warn when notional exceeds
Rs. 50,000. - For F&O, validate lot size before placement.
- Never use
CNCorMTFfor F&O, commodity, or currency segments. - Never hardcode credentials in generated code.
- 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:
- Access token is valid.
dhan_login.user_profile(...)orGET /profileshows the needed account setup.dataPlanis active for quote/history/feed/option-chain use.- Static IP is configured for order placement, order modification, order cancellation, super orders, and forever orders.
Useful profile fields:
tokenValidityactiveSegmentddpimtfdataPlandataValidity
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 |
Current SDK Methods To Prefer
| Task | Method |
|---|---|
| Place order | dhan.place_order() |
| Slice large order | dhan.place_slice_order() |
| Modify order | dhan.modify_order() |
| Cancel order | dhan.cancel_order() |
| Order book | dhan.get_order_list() |
| Order by ID | dhan.get_order_by_id() |
| Order by correlation ID | dhan.get_order_by_correlationID() |
| Trade book | dhan.get_trade_book() |
| Trade history | dhan.get_trade_history() |
| Ledger | dhan.ledger_report() |
| Super orders | place_super_order(), modify_super_order(), cancel_super_order(), get_super_order_list() |
| Forever orders | place_forever(), modify_forever(), cancel_forever(), get_forever() |
| Holdings | dhan.get_holdings() |
| Positions | dhan.get_positions() |
| Convert position | dhan.convert_position() |
| eDIS | dhan.generate_tpin(), dhan.open_browser_for_tpin(), dhan.edis_inquiry() |
| Fund limits | dhan.get_fund_limits() |
| Margin calculator | dhan.margin_calculator() |
| Daily history | dhan.historical_daily_data() |
| Minute history | dhan.intraday_minute_data() |
| Expired options data | dhan.expired_options_data() |
| Market quote snapshot | dhan.ticker_data(), dhan.ohlc_data(), dhan.quote_data() |
| Expiry list | dhan.expiry_list() |
| Option chain | dhan.option_chain() |
| Security master | dhanhq.fetch_security_list() |
| Live market feed | MarketFeed |
| Live order updates | OrderUpdate |
| Full market depth | FullDepth |
| Kill switch | dhan.kill_switch(), dhan.status_kill_switch() |
High-Value Gotchas
- The SDK wraps HTTP responses as
{"status": "success"|"failure", "remarks": ..., "data": ...}. Response shapes vary by endpoint — success payloads differ significantly (arrays, flat objects, nested dicts) depending on the API. - Repo helpers add a normalization layer. Fields like
ce_ltp,ce_oi,ce_ivare repo-defined names — not raw Dhan field names. intraday_minute_data(...)is the current SDK method. Do not referencehistorical_minute_data().- Historical timestamps are epoch values. Convert them explicitly.
- The SDK currently validates
expiry_codewith[0, 1, 2, 3], but Dhan's v2 annexure documents0,1,2. Prefer the documented values unless Dhan updates the API docs. - Quote APIs are rate-limited to
1 request/sec. - Option-chain REST data is keyed by strike string under
data["oc"]. Use repo
Установить dhanhq в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл dhanhq?
Use when the user mentions DhanHQ, Dhan API, or wants to trade on Indian exchanges (NSE, BSE, MCX). Triggers for: place, modify, or cancel stock/F&O/commodity orders on Dhan; fetch portfolio holdings or positions; get live or historical market data; access option chains with Greeks; check fund limits or margin; build any trading automation for Indian markets; resolve NSE/BSE instrument IDs; stream live WebSocket market feeds or order updates. Also trigger for general questions about programmatic trading on Indian exchanges if Dhan is the user's broker.
Как установить скилл dhanhq?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл dhanhq запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic