dhan portfolio
Read portfolio state and convert or exit positions. Live action
on convert and exit-all — both require a static-IP whitelist on the Dhan side and the
--yes flag.
Commands
Section titled “Commands”| Subcommand | Dhan endpoint | Purpose | Flags |
|---|---|---|---|
dhan portfolio holdings |
GET holdings |
Show holdings. | — |
dhan portfolio positions |
GET positions |
Show positions. | — |
dhan portfolio convert --file <json> --yes Live action |
POST positions/convert |
Convert a position between product types. Requires static IP whitelisting. | --file (req), --yes (req) |
dhan portfolio exit-all --yes Live action |
DELETE positions |
Exit all open positions at market price. Requires static IP whitelisting. | --yes (req) |
Read-only
Section titled “Read-only”dhan portfolio holdings --json --no-colordhan portfolio positions --json --no-colorConvert a position Live action
Section titled “Convert a position Live action”The conversion payload is a JSON object sent as the request body. The CLI auto-injects
dhanClientId into the top-level JSON body if it isn’t already present.
dhan portfolio convert --file convert.json --yes --json --no-color(Schema is per DhanHQ v2 positions/convert. Refer to Dhan’s API docs for the full field
set.)
Exit all open positions Live action
Section titled “Exit all open positions Live action”dhan portfolio exit-all --yes --json --no-colorSends DELETE positions to Dhan, which exits every open position at market price. This is
irreversible — only run from explicit operator intent.
See also
Section titled “See also”dhan ip— static-IP whitelisting is required before live conversion / exit.- Concepts › Live-trading guardrails