{
  "markdown": "# DhanHQ Agent Skills\n\nUse DhanHQ APIs inside AI agents like Claude Code, Codex or any other agent of your choice.\n\n**Dhan-native agent skill for NSE/BSE equities, F&O, and commodity trading.**\n\nGive your AI agent the ability to place live orders, read real portfolio data, stream market feeds, and access the full instrument universe of Indian exchanges — all through [DhanHQ's APIs](https://api.dhan.co/v2/#/).\n\nBuilt for the [Agent Skills open standard](https://agentskills.io) and compatible with Claude Code, Codex, and any agent that supports SKILL.md.\n\n---\n\n## Installation\n\n**You don’t need to clone the repository. Install the skill directly with `npx`.**\n\n### Global install\n\n```bash\nnpm install -g skills\nskills add dhan-oss/dhanhq-skills --skill dhanhq\n```\n\n### Claude Code or Codex\n\n```bash\nnpx skills add dhan-oss/dhanhq-skills --skill dhanhq\n```\n\nOR \n\n```bash\nnpx @dhan-oss/dhanhq-skill\n```\n\n---\n## After Installation\n\nOnce installed, your AI agent can automatically use the `dhanhq` skill when your prompt involves DhanHQ APIs, Indian market data, portfolio, orders, funds, or trading workflows.\n\nExample prompts:\n\n- Show my holdings\n- Get daily OHLC for RELIANCE for the last 6 months\n- Show Nifty option chain for nearest expiry\n- Check margin required to sell 1 lot of Nifty\n\n## Requirements\n\n- Python 3.8+ and `pip install dhanhq`\n- **Order APIs**: static IP whitelisting on Dhan required\n- **Data APIs**: active Dhan Data Plan required\n- Credentials via environment variables: `DHAN_CLIENT_ID` and `DHAN_ACCESS_TOKEN`\n\n---\n\n## What's Included\n\n```\nskills/\n└── dhanhq/\n    ├── SKILL.md                          # Entry point — setup, safety rules, core patterns\n    │\n    ├── references/                       # Deep-dive docs loaded on demand\n    │   ├── orders.md                     # Order lifecycle (regular, super, forever, AMO)\n    │   ├── portfolio.md                  # Holdings, positions, convert position, eDIS\n    │   ├── market-data.md                # Historical OHLC, intraday, quotes\n    │   ├── option-chain.md               # Option chain with Greeks, expiry list\n    │   ├── instruments.md                # Security master, symbol resolution\n    │   ├── funds.md                      # Fund limits and margin calculator\n    │   ├── live-feed.md                  # WebSocket: MarketFeed, OrderUpdate, FullDepth\n    │   ├── error-codes.md                # Error codes, rate limits, retry patterns\n    │   ├── scanx-data.md                 # ScanX real-time scanner data\n    │   ├── common-workflows.md           # Multi-step patterns (rebalance, iron condor, P&L)\n    │   ├── options-analysis-patterns.md  # PCR, max pain, payoff diagrams, IV skew\n    │   └── backtesting-with-dhan.md      # Equity + F&O backtest patterns with cost model\n    │\n    ├── scripts/\n    │   ├── dhan_helpers.py               # Composable helper library\n    │   ├── resolve_security.py           # Human name → security_id resolver\n    │   ├── validate_order.py             # Pre-flight order validation with guardrails\n    │   └── trade_logger.py               # Persistent trade journal\n    │\n    └── examples/\n        ├── place_equity_order.py         # Simple equity delivery order\n        ├── place_fno_order.py            # F&O option order with lot-size validation\n        ├── fetch_option_chain.py         # Nifty option chain with ATM analysis\n        ├── iron_condor.py                # Multi-leg strategy: build + analyze + place\n        ├── super_order_with_sl.py        # Entry + target + trailing SL in one order\n        ├── gtt_forever_order.py          # GTT single trigger and OCO orders\n        ├── order_management.py           # Full lifecycle: place, modify, cancel, book\n        ├── portfolio_summary.py          # Holdings + positions + funds dashboard\n        ├── margin_check.py               # Pre-order margin validation\n        ├── historical_data_analysis.py   # Fetch OHLCV + moving averages + stats\n        └── live_feed_setup.py            # WebSocket market data streaming\n```\n\n---\n\n## How It Works\n\nThe skill follows **progressive disclosure** to minimize context usage:\n\n1. **SKILL.md** (~300 lines) gives the agent setup, safety rules, constants, and core code patterns — enough for 80% of tasks.\n2. **references/*.md** are loaded only when a task needs deeper detail (e.g., full order parameter tables, WebSocket setup).\n3. **scripts/** provide reusable utilities the agent can call directly.\n4. **examples/** are complete, runnable scripts the agent can reference or adapt.\n\n---\n\n## When Agents Use This Skill\n\nThe skill activates when the user:\n\n- Wants to **place, modify, or cancel** stock or F&O orders\n- Asks about **portfolio holdings or positions**\n- Needs **live or historical market data** (OHLC, quotes, depth)\n- Wants to work with **option chains** (Greeks, OI, IV)\n- Asks about **fund limits or margin requirements**\n- Mentions **DhanHQ**, **Dhan API**, or Indian stock market trading\n- Wants to **build trading automation** for NSE/BSE/MCX\n- Needs to **backtest a strategy** using historical data\n\n---\n\n## Built-In Safety Guardrails\n\n| Rule | What it does |\n|------|-------------|\n| **Confirmation required** | Always shows order preview and asks for user confirmation before placing |\n| **Default to LIMIT** | Never places MARKET orders unless user explicitly requests |\n| **Default to 1 lot** | Defaults to 1 share (equity) or 1 lot (F&O) when quantity is unspecified |\n| **Lot size validation** | Rejects F&O orders where quantity isn't a lot-size multiple |\n| **Product type guardrails** | Blocks CNC/MTF for F&O segments; blocks invalid product-segment combos |\n| **Notional value warning** | Warns when order value exceeds ₹50,000 |\n| **Freeze quantity check** | Warns when F&O quantity exceeds exchange freeze limits |\n| **Market hours check** | Warns when market is closed, suggests AMO |\n| **No hardcoded tokens** | Always uses environment variables for credentials |\n\n---\n\n## API Coverage\n\n| Category | Reference |\n|----------|-----------|\n| Orders (regular, super, forever/GTT, AMO, slice) | [references/orders.md](skills/dhanhq/references/orders.md) |\n| Portfolio (holdings, positions, convert, eDIS) | [references/portfolio.md](skills/dhanhq/references/portfolio.md) |\n| Market Data (historical OHLC, quotes, depth) | [references/market-data.md](skills/dhanhq/references/market-data.md) |\n| Option Chain (Greeks, OI, expiry list) | [references/option-chain.md](skills/dhanhq/references/option-chain.md) |\n| Instruments (security master, symbol resolution) | [references/instruments.md](skills/dhanhq/references/instruments.md) |\n| Funds & Margin | [references/funds.md](skills/dhanhq/references/funds.md) |\n| Live Feed (MarketFeed, OrderUpdate, FullDepth) | [references/live-feed.md](skills/dhanhq/references/live-feed.md) |\n| ScanX real-time scanner | [references/scanx-data.md](skills/dhanhq/references/scanx-data.md) |\n| Error codes, rate limits, retry patterns | [references/error-codes.md](skills/dhanhq/references/error-codes.md) |\n\n---\n\n## Example Prompts\n\n**Orders**\n- \"Buy 10 shares of Reliance at market\"\n- \"Place a limit order for HDFC Bank at 1650\"\n- \"Buy 1 lot of Nifty 24000 CE expiry this week\"\n- \"Place a super order on TCS with target 4200 and SL 3900\"\n- \"Set a GTT to buy Infosys if it drops to 1400\"\n\n**Portfolio**\n- \"Show me my holdings\"\n- \"What's my total portfolio value?\"\n- \"Show my open F&O positions\"\n- \"Convert my INFY position from intraday to delivery\"\n\n**Market Data**\n- \"Get daily OHLC for Reliance for the last 6 months\"\n- \"What's the current LTP of HDFC Bank?\"\n- \"Show me 5-minute candles for TCS today\"\n\n**Options**\n- \"Show me the Nifty option chain for nearest expiry\"\n- \"What's the PCR for Bank Nifty?\"\n- \"Build me a Nifty iron condor\"\n\n**Funds & Margin**\n- \"What's my available margin?\"\n- \"How much margin do I need to sell 1 lot of Nifty?\"\n\n---\n\n## SDK Reference\n\n- **Package**: `dhanhq` ([PyPI](https://pypi.org/project/dhanhq/))\n- **Version**: 2.2.0+\n- **Base URL**: `https://api.dhan.co/v2`\n- **Docs**: [dhanhq.co/docs/v2](https://dhanhq.co/docs/v2/)\n- **GitHub**: [github.com/dhan-oss/DhanHQ-py](https://github.com/dhan-oss/DhanHQ-py)\n\n---\n\n## Contributing\n\nThis skill is built for the [Agent Skills](https://agentskills.io) open standard. To contribute:\n\n1. Fork this repository\n2. Make changes in `skills/dhanhq/`\n3. Verify against the DhanHQ SDK (`pip install dhanhq`)\n4. Submit a pull request\n\n---\n\n## License\n\nMIT\n",
  "bytes": 8440,
  "sha": "79dc2c95bd76bdf9d592cc0f29a564f310724271ebd853d91ee7517b7198b609",
  "repo_slug": "dhan-oss/dhanhq-skills",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/skl_dhan_oss_dhanhq_skills_dhanhq_157b4bac/readme"
}