dhan instruments
Download and search the Dhan instrument master. The downloaded segment CSV is cached as both
.csv and a parsed .json next to it; search reads the JSON.
Commands
Section titled “Commands”| Subcommand | Dhan endpoint | Purpose | Flags |
|---|---|---|---|
dhan instruments download --segment <seg> |
GET instrument/{segment} |
Download + cache the segment CSV. | --segment (req) |
dhan instruments search <text> [--segment <seg>] |
(no API call) | Search the cached JSON for matches. Limit 25. | — |
Cache location
Section titled “Cache location”%AppData%\dhan-cli\instruments\<segment>.csv%AppData%\dhan-cli\instruments\<segment>.jsonOn macOS / Linux this resolves to the platform application-data folder.
CSV parser tolerance
Section titled “CSV parser tolerance”The CSV parser is column-name tolerant — it accepts multiple header spellings
(SEM_SMST_SECURITY_ID or SECURITY_ID or SCRIP_CODE; SEM_TRADING_SYMBOL or
TRADING_SYMBOL or SYMBOL; etc.) so Dhan’s column renames do not break the cache. The
cached row model is CachedInstrument(ExchangeSegment, SecurityId, TradingSymbol, SymbolName, Instrument, Isin).
Examples
Section titled “Examples”dhan instruments download --segment NSE_EQ --json --no-colordhan instruments search INFY --segment NSE_EQ --json --no-colordhan instruments search 1333 --json --no-color # by security IDThe search text matches security id / trading symbol / symbol name / ISIN (case-insensitive
contains). Omitting --segment searches across all cached segments.
See also
Section titled “See also”dhan quoteconsumes the numeric security ID returned here.