Purpose
Translate a user query in plain English into one exact zerodha CLI command.
Do not invent commands or flags. Use only commands defined here.
Bootstrap: CLI Installation
If the user asks to install/setup the CLI, or reports zerodha: command not found, route to an installer command first.
This is the only exception to "commands must start with zerodha".
Install commands:
- Linux/macOS (
curl): curl -fsSL https://raw.githubusercontent.com/jatinbansal1998/zerodha-kite-cli/main/scripts/install.sh | sh
- Linux/macOS (
wget): wget -qO- https://raw.githubusercontent.com/jatinbansal1998/zerodha-kite-cli/main/scripts/install.sh | sh
- Windows PowerShell:
irm https://raw.githubusercontent.com/jatinbansal1998/zerodha-kite-cli/main/scripts/install.ps1 | iex
- Windows CMD:
powershell -NoProfile -ExecutionPolicy Bypass -Command "irm https://raw.githubusercontent.com/jatinbansal1998/zerodha-kite-cli/main/scripts/install.ps1 | iex"
Post-install verification command:
Global Rules
- Always start commands with
zerodha (except install/bootstrap commands in "Bootstrap: CLI Installation").
- Prefer
--json when the user asks for machine-readable output.
- Respect global flags when provided:
--profile <name>
--config <path>
--json
--debug
- Profile selection:
- Most commands require an active profile (or explicit
--profile).
- If no profile is selected, use:
zerodha config profile use <name>
- Auth/session:
- API data/order commands require an access token.
- If missing, run
zerodha auth login ....
- CLI auto-refreshes access token when refresh token exists.
- Never guess missing required fields for write actions; ask for the missing values.
- If OS is required for installation routing and missing, ask for only the OS (
linux, macos, or windows).
Login Flow (Multi-Message)
Use this flow when the user wants to authenticate and provides api_key, api_secret, and token across one or more messages.
Collected auth fields (can arrive in any order):
profile_name (default to default if user does not specify)
api_key
api_secret
- one login mode:
request_token_or_redirect_url, or
callback (optional callback_port)
Rules:
- Persist auth fields provided in earlier user messages during the same login task.
- Ask only for missing required auth inputs for the next step.
- Do not emit
zerodha auth login ... until profile credentials are configured.
- If
api_key + api_secret are available and profile setup is needed, emit:
zerodha config profile add <profile_name> --api-key <key> --api-secret <secret> --set-active
- If user explicitly wants to update only one credential on an existing profile, emit:
zerodha config profile set-api-key <profile_name> --api-key <key>
zerodha config profile set-api-secret <profile_name> --api-secret <secret>
- For token mode, emit:
zerodha auth login --request-token <token_or_redirect_url>
- For callback mode, emit:
zerodha auth login --callback [--callback-port <1-65535>]
- If multiple commands are needed, output only the next runnable command.
Command Catalog
Root utilities
zerodha version
zerodha help [command]
zerodha completion <shell>
Config profile
zerodha config profile add <name> --api-key <key> --api-secret <secret> [--set-active]
- Constraints:
<name> required; --api-key and --api-secret required.
zerodha config profile set-api-key <name> --api-key <key>
- Constraints:
<name>, --api-key required.
zerodha config profile set-api-secret <name> --api-secret <secret>
- Constraints:
<name>, --api-secret required.
zerodha config profile list
zerodha config profile use <name>
- Constraints:
<name> must exist.
zerodha config profile remove <name>
- Constraints:
<name> must exist.
Auth
zerodha auth login --request-token <token_or_redirect_url>
zerodha auth login --callback [--callback-port <1-65535>]
- Constraints:
- Exactly one mode is required:
--request-token OR --callback.
--request-token cannot be combined with --callback.
--callback-port allowed only with --callback.
--callback-port range: 1..65535.
zerodha auth renew
- Constraints: refresh token must exist in profile.
zerodha auth logout
zerodha auth revoke-refresh [--refresh-token <token>]
- If omitted, uses stored refresh token.
Profile
zerodha profile show
zerodha profile full
Quotes
zerodha quote get <EXCHANGE:SYMBOL> [EXCHANGE:SYMBOL...]
- Constraints: at least 1 instrument.
zerodha quote ltp <EXCHANGE:SYMBOL> [EXCHANGE:SYMBOL...]
- Constraints: at least 1 instrument.
zerodha quote ohlc <EXCHANGE:SYMBOL> [EXCHANGE:SYMBOL...]
- Constraints: at least 1 instrument.
zerodha quote historical --instrument-token <int> --interval <value> --from <time> --to <time> [--continuous] [--oi]
- Constraints:
--instrument-token > 0
--interval required
--from and --to required
- time format:
YYYY-MM-DD or YYYY-MM-DD HH:MM:SS or RFC3339
--from <= --to
Instruments
zerodha instruments list [--exchange <EXCHANGE> | --all]
- Default (no flags): summary by exchange/type.
- Constraints:
--exchange and --all are mutually exclusive.
zerodha instruments mf
Orders (single order operations)
zerodha order place --exchange <EX> --symbol <SYM> --txn <BUY|SELL> --type <MARKET|LIMIT|SL|SL-M> --product <CNC|MIS|NRML|MTF> --qty <n> [--price <p>] [--trigger-price <p>] [--validity <DAY|IOC|TTL>] [--validity-ttl <min>] [--variety <v>] [--tag <t>]
- Constraints:
- required:
--exchange --symbol --txn --type --product --qty
--qty > 0
- LIMIT requires
--price > 0
- SL requires both
--price > 0 and --trigger-price > 0
- SL-M requires
--trigger-price > 0
- TTL validity requires
--validity-ttl > 0
zerodha order modify --order-id <id> [fields...]
- Constraints:
--order-id required
- At least one modifiable field required.
- If provided,
--txn must be BUY/SELL; --type must be MARKET/LIMIT/SL/SL-M; --validity must be DAY/IOC/TTL.
zerodha order cancel --order-id <id> [--variety <v>] [--parent-order-id <id>]
- Constraints:
--order-id required.
zerodha order exit --order-id <id> [--variety <v>] [--parent-order-id <id>]
- Constraints:
--order-id required.
Orders (orderbook/trades)
zerodha orders list
zerodha orders show --order-id <id>
- Constraints:
--order-id required.
zerodha orders trades [--order-id <id>]
Positions
zerodha positions
zerodha positions convert --exchange <EX> --symbol <SYM> --old-product <CNC|MIS|NRML|MTF> --new-product <CNC|MIS|NRML|MTF> --position-type <day|overnight> --txn <BUY|SELL> --qty <n>
- Constraints:
- all flags above required
--qty > 0
Holdings
zerodha holdings
zerodha holdings auctions
zerodha holdings auth-initiate [--type <equity|mf>] [--transfer-type <pre|post|off|gift>] [--exec-date YYYY-MM-DD] [--isin <isin> ...] [--qty <float> ...]
- Constraints:
- if
--type set, must be equity|mf
- if
--transfer-type set, must be pre|post|off|gift
- if
--exec-date set, format must be YYYY-MM-DD
--isin and --qty must have matching counts
- each
--qty must be > 0
Margins
zerodha margins [--segment <all|equity|commodity>]
zerodha margins order --exchange <EX> --symbol <SYM> --txn <BUY|SELL> --type <MARKET|LIMIT|SL|SL-M> --product <CNC|MIS|NRML|MTF> --qty <n> [--price <p>] [--trigger-price <p>] [--variety <v>] [--compact]
zerodha margins basket --exchange <EX> --symbol <SYM> --txn <BUY|SELL> --type <MARKET|LIMIT|SL|SL-M> --product <CNC|MIS|NRML|MTF> --qty <n> [--price <p>] [--trigger-price <p>] [--variety <v>] [--compact] [--consider-positions]
zerodha margins charges --exchange <EX> --symbol <SYM> --txn <BUY|SELL> --type <MARKET|LIMIT|SL|SL-M> --product <CNC|MIS|NRML|MTF> --qty <n> --avg-price <p> [--price <p>] [--trigger-price <p>] [--variety <v>] [--order-id <id>]
- Shared constraints for order/basket/charges:
- required:
--exchange --symbol --txn --type --product --qty
--qty > 0
- LIMIT requires
--price > 0
- SL requires both
--price > 0 and --trigger-price > 0
- SL-M requires
--trigger-price > 0
- Additional charges constraint:
GTT
zerodha gtt place [gtt flags]
zerodha gtt modify --trigger-id <id> [gtt flags]
zerodha gtt list
zerodha gtt show --trigger-id <id>
zerodha gtt delete --trigger-id <id>
GTT common flags:
--exchange <EX> --symbol <SYM> --last-price <p> --txn <BUY|SELL> [--product <CNC|MIS|NRML|MTF>] [--type <single|two-leg>]
- For
single type:
--trigger <p> --limit-price <p> --qty <q>
- For
two-leg type:
--lower-trigger <p> --lower-limit-price <p> --lower-qty <q>
--upper-trigger <p> --upper-limit-price <p> --upper-qty <q>
GTT constraints:
--exchange --symbol --txn required
--last-price > 0
--txn in BUY|SELL
--product in CNC|MIS|NRML|MTF
--trigger-id > 0 for show/modify/delete
Mutual Funds
MF Orders
zerodha mf orders place --symbol <SYM> --txn <BUY|SELL> [--qty <q>] [--amount <amt>] [--tag <t>]
- Constraints:
--symbol and --txn required
- at least one of
--qty or --amount must be > 0
--qty and --amount cannot be negative
zerodha mf orders list [--from YYYY-MM-DD --to YYYY-MM-DD]
- Constraints:
--from and --to must be provided together
- date format:
YYYY-MM-DD
zerodha mf orders show --order-id <id>
- Constraints:
--order-id required
zerodha mf orders cancel --order-id <id>
- Constraints:
--order-id required
MF SIPs
zerodha mf sips place --symbol <SYM> --amount <amt> --instalments <n> --frequency <f> [--instalment-day <1..31>] [--initial-amount <amt>] [--trigger-price <p>] [--step-up <v>] [--sip-type <v>] [--tag <t>]
- Constraints:
- required:
--symbol --amount --instalments --frequency
--amount > 0, --instalments > 0
--instalment-day if provided must be in 1..31 (0 means not set)
--initial-amount and --trigger-price cannot be negative
zerodha mf sips modify --sip-id <id> [--amount <amt>] [--frequency <f>] [--instalment-day <1..31>] [--instalments <n>] [--step-up <v>] [--status <v>]
- Constraints:
--sip-id required
- at least one modifiable field required
- numeric fields cannot be negative
zerodha mf sips cancel --sip-id <id>
- Constraints:
--sip-id required
zerodha mf sips list
zerodha mf sips show --sip-id <id>
- Constraints:
--sip-id required
MF Holdings
zerodha mf holdings
zerodha mf holdings show --isin <isin>
- Constraints:
--isin required
zerodha mf holdings isins
Synonym Map
Use these mappings during intent parsing.
Market data
quote synonyms: price, live price, current price, quote, snapshot
ltp synonyms: ltp, last traded price, last price, tick
ohlc synonyms: open high low close, ohlc, candle snapshot
historical synonyms: history, candles, chart data, time series
Account and auth
profile synonyms: account details, user profile, my account
login synonyms: authenticate, sign in, connect kite
renew synonyms: refresh access token, renew token
logout synonyms: sign out, clear session
Bootstrap
install cli synonyms: install zerodha cli, setup zerodha cli, command not found, zerodha not installed
Orders and tradebook
order place synonyms: buy, sell, place order, new order, execute trade
order modify synonyms: edit order, change order, update order
order cancel synonyms: cancel order, delete order
order exit synonyms: square off order, exit order
orders list synonyms: orderbook, all orders
orders trades synonyms: tradebook, fills, executed trades
Portfolio
positions synonyms: open positions, net positions
positions convert synonyms: convert position, change product type
holdings synonyms: portfolio holdings, stocks held, demat holdings
holdings auctions synonyms: auction holdings, auction eligible
Risk/margins
margins synonyms: available margin, used margin, funds
margins order synonyms: margin required, order margin estimate
margins basket synonyms: basket margin, combined margin
margins charges synonyms: brokerage estimate, charges, fees
GTT
gtt synonyms: good till trigger, trigger order, price alert order
gtt two-leg synonyms: oco, one cancels other, bracket trigger
Mutual funds
mf orders synonyms: mutual fund order, fund buy/sell
mf sips synonyms: sip, systematic investment plan
mf holdings synonyms: mutual fund portfolio, fund holdings
Routing Procedure
- Detect whether this is an install/bootstrap request, login/auth bootstrap request, or a normal
zerodha command request.
- For install/bootstrap: pick the OS-specific installer command.
- For login/auth bootstrap: follow "Login Flow (Multi-Message)" and emit only the next runnable command.
- Otherwise detect intent domain using synonyms.
- Pick the narrowest command path.
- Extract required entities/flags.
- Validate against constraints above.
- If fields are missing, ask for only missing required inputs.
- Output one runnable command string.
Intent to Command Defaults
- If user asks generic "install zerodha cli":
- Linux/macOS:
curl -fsSL https://raw.githubusercontent.com/jatinbansal1998/zerodha-kite-cli/main/scripts/install.sh | sh
- Windows:
irm https://raw.githubusercontent.com/jatinbansal1998/zerodha-kite-cli/main/scripts/install.ps1 | iex
- If user asks generic "login" and no auth fields are provided:
- ask for
api_key and api_secret first (profile defaults to default unless specified)
- If user provides
api_key + api_secret but no token/mode:
- emit profile setup command first, then ask for token mode (
--request-token or --callback)
- If user asks generic "show my profile": use
zerodha profile show.
- If user asks generic "show orders": use
zerodha orders list.
- If user asks generic "show trades": use
zerodha orders trades.
- If user asks generic "show positions": use
zerodha positions.
- If user asks generic "show holdings": use
zerodha holdings.
- If user asks generic "show margins": use
zerodha margins --segment all.
- If user asks "list instruments" without exchange: use
zerodha instruments list.
Output Contract For Downstream Agents
When responding with a routed command, return:
command: exact runnable command (installer command for bootstrap, otherwise zerodha ...)
why: one-line reason
missing: required fields still missing (empty if none)
1---
2name: zerodha-kite-cli-router
3description: Route natural-language trading/account queries to the correct `zerodha` CLI command with exact flags, validation constraints, and synonym mapping. Use when a user asks to view prices, place/modify/cancel orders, manage auth/profile/config, work with holdings/positions/margins/GTT/MF flows, or asks "which zerodha command should I run?"
4metadata:
5 source: https://skillmd.com/skills/modbender/zerodha-kite-cli-router
6---
7
8# Purpose
9
10Translate a user query in plain English into one exact `zerodha` CLI command.
11
12Do not invent commands or flags. Use only commands defined here.
13
14# Bootstrap: CLI Installation
15
16If the user asks to install/setup the CLI, or reports `zerodha: command not found`, route to an installer command first.
17
18This is the only exception to "commands must start with `zerodha`".
19
20Install commands:
21
22- Linux/macOS (`curl`): `curl -fsSL https://raw.githubusercontent.com/jatinbansal1998/zerodha-kite-cli/main/scripts/install.sh | sh`
23- Linux/macOS (`wget`): `wget -qO- https://raw.githubusercontent.com/jatinbansal1998/zerodha-kite-cli/main/scripts/install.sh | sh`
24- Windows PowerShell: `irm https://raw.githubusercontent.com/jatinbansal1998/zerodha-kite-cli/main/scripts/install.ps1 | iex`
25- Windows CMD: `powershell -NoProfile -ExecutionPolicy Bypass -Command "irm https://raw.githubusercontent.com/jatinbansal1998/zerodha-kite-cli/main/scripts/install.ps1 | iex"`
26
27Post-install verification command:
28
29- `zerodha version`
30
31# Global Rules
32
331. Always start commands with `zerodha` (except install/bootstrap commands in "Bootstrap: CLI Installation").
342. Prefer `--json` when the user asks for machine-readable output.
353. Respect global flags when provided:
36 - `--profile <name>`
37 - `--config <path>`
38 - `--json`
39 - `--debug`
404. Profile selection:
41 - Most commands require an active profile (or explicit `--profile`).
42 - If no profile is selected, use:
43 `zerodha config profile use <name>`
445. Auth/session:
45 - API data/order commands require an access token.
46 - If missing, run `zerodha auth login ...`.
47 - CLI auto-refreshes access token when refresh token exists.
486. Never guess missing required fields for write actions; ask for the missing values.
497. If OS is required for installation routing and missing, ask for only the OS (`linux`, `macos`, or `windows`).
50
51# Login Flow (Multi-Message)
52
53Use this flow when the user wants to authenticate and provides `api_key`, `api_secret`, and token across one or more messages.
54
55Collected auth fields (can arrive in any order):
56
57- `profile_name` (default to `default` if user does not specify)
58- `api_key`
59- `api_secret`
60- one login mode:
61 - `request_token_or_redirect_url`, or
62 - `callback` (optional `callback_port`)
63
64Rules:
65
661. Persist auth fields provided in earlier user messages during the same login task.
672. Ask only for missing required auth inputs for the next step.
683. Do not emit `zerodha auth login ...` until profile credentials are configured.
694. If `api_key` + `api_secret` are available and profile setup is needed, emit:
70 `zerodha config profile add <profile_name> --api-key <key> --api-secret <secret> --set-active`
715. If user explicitly wants to update only one credential on an existing profile, emit:
72 - `zerodha config profile set-api-key <profile_name> --api-key <key>`
73 - `zerodha config profile set-api-secret <profile_name> --api-secret <secret>`
746. For token mode, emit:
75 `zerodha auth login --request-token <token_or_redirect_url>`
767. For callback mode, emit:
77 `zerodha auth login --callback [--callback-port <1-65535>]`
788. If multiple commands are needed, output only the next runnable command.
79
80# Command Catalog
81
82## Root utilities
83
84- `zerodha version`
85- `zerodha help [command]`
86- `zerodha completion <shell>`
87
88## Config profile
89
90- `zerodha config profile add <name> --api-key <key> --api-secret <secret> [--set-active]`
91 - Constraints: `<name>` required; `--api-key` and `--api-secret` required.
92- `zerodha config profile set-api-key <name> --api-key <key>`
93 - Constraints: `<name>`, `--api-key` required.
94- `zerodha config profile set-api-secret <name> --api-secret <secret>`
95 - Constraints: `<name>`, `--api-secret` required.
96- `zerodha config profile list`
97- `zerodha config profile use <name>`
98 - Constraints: `<name>` must exist.
99- `zerodha config profile remove <name>`
100 - Constraints: `<name>` must exist.
101
102## Auth
103
104- `zerodha auth login --request-token <token_or_redirect_url>`
105- `zerodha auth login --callback [--callback-port <1-65535>]`
106 - Constraints:
107 - Exactly one mode is required: `--request-token` OR `--callback`.
108 - `--request-token` cannot be combined with `--callback`.
109 - `--callback-port` allowed only with `--callback`.
110 - `--callback-port` range: `1..65535`.
111- `zerodha auth renew`
112 - Constraints: refresh token must exist in profile.
113- `zerodha auth logout`
114- `zerodha auth revoke-refresh [--refresh-token <token>]`
115 - If omitted, uses stored refresh token.
116
117## Profile
118
119- `zerodha profile show`
120- `zerodha profile full`
121
122## Quotes
123
124- `zerodha quote get <EXCHANGE:SYMBOL> [EXCHANGE:SYMBOL...]`
125 - Constraints: at least 1 instrument.
126- `zerodha quote ltp <EXCHANGE:SYMBOL> [EXCHANGE:SYMBOL...]`
127 - Constraints: at least 1 instrument.
128- `zerodha quote ohlc <EXCHANGE:SYMBOL> [EXCHANGE:SYMBOL...]`
129 - Constraints: at least 1 instrument.
130- `zerodha quote historical --instrument-token <int> --interval <value> --from <time> --to <time> [--continuous] [--oi]`
131 - Constraints:
132 - `--instrument-token > 0`
133 - `--interval` required
134 - `--from` and `--to` required
135 - time format: `YYYY-MM-DD` or `YYYY-MM-DD HH:MM:SS` or RFC3339
136 - `--from <= --to`
137
138## Instruments
139
140- `zerodha instruments list [--exchange <EXCHANGE> | --all]`
141 - Default (no flags): summary by exchange/type.
142 - Constraints: `--exchange` and `--all` are mutually exclusive.
143- `zerodha instruments mf`
144
145## Orders (single order operations)
146
147- `zerodha order place --exchange <EX> --symbol <SYM> --txn <BUY|SELL> --type <MARKET|LIMIT|SL|SL-M> --product <CNC|MIS|NRML|MTF> --qty <n> [--price <p>] [--trigger-price <p>] [--validity <DAY|IOC|TTL>] [--validity-ttl <min>] [--variety <v>] [--tag <t>]`
148 - Constraints:
149 - required: `--exchange --symbol --txn --type --product --qty`
150 - `--qty > 0`
151 - LIMIT requires `--price > 0`
152 - SL requires both `--price > 0` and `--trigger-price > 0`
153 - SL-M requires `--trigger-price > 0`
154 - TTL validity requires `--validity-ttl > 0`
155- `zerodha order modify --order-id <id> [fields...]`
156 - Constraints:
157 - `--order-id` required
158 - At least one modifiable field required.
159 - If provided, `--txn` must be BUY/SELL; `--type` must be MARKET/LIMIT/SL/SL-M; `--validity` must be DAY/IOC/TTL.
160- `zerodha order cancel --order-id <id> [--variety <v>] [--parent-order-id <id>]`
161 - Constraints: `--order-id` required.
162- `zerodha order exit --order-id <id> [--variety <v>] [--parent-order-id <id>]`
163 - Constraints: `--order-id` required.
164
165## Orders (orderbook/trades)
166
167- `zerodha orders list`
168- `zerodha orders show --order-id <id>`
169 - Constraints: `--order-id` required.
170- `zerodha orders trades [--order-id <id>]`
171
172## Positions
173
174- `zerodha positions`
175- `zerodha positions convert --exchange <EX> --symbol <SYM> --old-product <CNC|MIS|NRML|MTF> --new-product <CNC|MIS|NRML|MTF> --position-type <day|overnight> --txn <BUY|SELL> --qty <n>`
176 - Constraints:
177 - all flags above required
178 - `--qty > 0`
179
180## Holdings
181
182- `zerodha holdings`
183- `zerodha holdings auctions`
184- `zerodha holdings auth-initiate [--type <equity|mf>] [--transfer-type <pre|post|off|gift>] [--exec-date YYYY-MM-DD] [--isin <isin> ...] [--qty <float> ...]`
185 - Constraints:
186 - if `--type` set, must be `equity|mf`
187 - if `--transfer-type` set, must be `pre|post|off|gift`
188 - if `--exec-date` set, format must be `YYYY-MM-DD`
189 - `--isin` and `--qty` must have matching counts
190 - each `--qty` must be `> 0`
191
192## Margins
193
194- `zerodha margins [--segment <all|equity|commodity>]`
195- `zerodha margins order --exchange <EX> --symbol <SYM> --txn <BUY|SELL> --type <MARKET|LIMIT|SL|SL-M> --product <CNC|MIS|NRML|MTF> --qty <n> [--price <p>] [--trigger-price <p>] [--variety <v>] [--compact]`
196- `zerodha margins basket --exchange <EX> --symbol <SYM> --txn <BUY|SELL> --type <MARKET|LIMIT|SL|SL-M> --product <CNC|MIS|NRML|MTF> --qty <n> [--price <p>] [--trigger-price <p>] [--variety <v>] [--compact] [--consider-positions]`
197- `zerodha margins charges --exchange <EX> --symbol <SYM> --txn <BUY|SELL> --type <MARKET|LIMIT|SL|SL-M> --product <CNC|MIS|NRML|MTF> --qty <n> --avg-price <p> [--price <p>] [--trigger-price <p>] [--variety <v>] [--order-id <id>]`
198 - Shared constraints for order/basket/charges:
199 - required: `--exchange --symbol --txn --type --product --qty`
200 - `--qty > 0`
201 - LIMIT requires `--price > 0`
202 - SL requires both `--price > 0` and `--trigger-price > 0`
203 - SL-M requires `--trigger-price > 0`
204 - Additional charges constraint:
205 - `--avg-price > 0`
206
207## GTT
208
209- `zerodha gtt place [gtt flags]`
210- `zerodha gtt modify --trigger-id <id> [gtt flags]`
211- `zerodha gtt list`
212- `zerodha gtt show --trigger-id <id>`
213- `zerodha gtt delete --trigger-id <id>`
214
215GTT common flags:
216- `--exchange <EX> --symbol <SYM> --last-price <p> --txn <BUY|SELL> [--product <CNC|MIS|NRML|MTF>] [--type <single|two-leg>]`
217- For `single` type:
218 - `--trigger <p> --limit-price <p> --qty <q>`
219- For `two-leg` type:
220 - `--lower-trigger <p> --lower-limit-price <p> --lower-qty <q>`
221 - `--upper-trigger <p> --upper-limit-price <p> --upper-qty <q>`
222
223GTT constraints:
224- `--exchange --symbol --txn` required
225- `--last-price > 0`
226- `--txn` in `BUY|SELL`
227- `--product` in `CNC|MIS|NRML|MTF`
228- `--trigger-id > 0` for show/modify/delete
229
230## Mutual Funds
231
232### MF Orders
233
234- `zerodha mf orders place --symbol <SYM> --txn <BUY|SELL> [--qty <q>] [--amount <amt>] [--tag <t>]`
235 - Constraints:
236 - `--symbol` and `--txn` required
237 - at least one of `--qty` or `--amount` must be `> 0`
238 - `--qty` and `--amount` cannot be negative
239- `zerodha mf orders list [--from YYYY-MM-DD --to YYYY-MM-DD]`
240 - Constraints:
241 - `--from` and `--to` must be provided together
242 - date format: `YYYY-MM-DD`
243- `zerodha mf orders show --order-id <id>`
244 - Constraints: `--order-id` required
245- `zerodha mf orders cancel --order-id <id>`
246 - Constraints: `--order-id` required
247
248### MF SIPs
249
250- `zerodha mf sips place --symbol <SYM> --amount <amt> --instalments <n> --frequency <f> [--instalment-day <1..31>] [--initial-amount <amt>] [--trigger-price <p>] [--step-up <v>] [--sip-type <v>] [--tag <t>]`
251 - Constraints:
252 - required: `--symbol --amount --instalments --frequency`
253 - `--amount > 0`, `--instalments > 0`
254 - `--instalment-day` if provided must be in `1..31` (0 means not set)
255 - `--initial-amount` and `--trigger-price` cannot be negative
256- `zerodha mf sips modify --sip-id <id> [--amount <amt>] [--frequency <f>] [--instalment-day <1..31>] [--instalments <n>] [--step-up <v>] [--status <v>]`
257 - Constraints:
258 - `--sip-id` required
259 - at least one modifiable field required
260 - numeric fields cannot be negative
261- `zerodha mf sips cancel --sip-id <id>`
262 - Constraints: `--sip-id` required
263- `zerodha mf sips list`
264- `zerodha mf sips show --sip-id <id>`
265 - Constraints: `--sip-id` required
266
267### MF Holdings
268
269- `zerodha mf holdings`
270- `zerodha mf holdings show --isin <isin>`
271 - Constraints: `--isin` required
272- `zerodha mf holdings isins`
273
274# Synonym Map
275
276Use these mappings during intent parsing.
277
278## Market data
279
280- `quote` synonyms: `price`, `live price`, `current price`, `quote`, `snapshot`
281- `ltp` synonyms: `ltp`, `last traded price`, `last price`, `tick`
282- `ohlc` synonyms: `open high low close`, `ohlc`, `candle snapshot`
283- `historical` synonyms: `history`, `candles`, `chart data`, `time series`
284
285## Account and auth
286
287- `profile` synonyms: `account details`, `user profile`, `my account`
288- `login` synonyms: `authenticate`, `sign in`, `connect kite`
289- `renew` synonyms: `refresh access token`, `renew token`
290- `logout` synonyms: `sign out`, `clear session`
291
292## Bootstrap
293
294- `install cli` synonyms: `install zerodha cli`, `setup zerodha cli`, `command not found`, `zerodha not installed`
295
296## Orders and tradebook
297
298- `order place` synonyms: `buy`, `sell`, `place order`, `new order`, `execute trade`
299- `order modify` synonyms: `edit order`, `change order`, `update order`
300- `order cancel` synonyms: `cancel order`, `delete order`
301- `order exit` synonyms: `square off order`, `exit order`
302- `orders list` synonyms: `orderbook`, `all orders`
303- `orders trades` synonyms: `tradebook`, `fills`, `executed trades`
304
305## Portfolio
306
307- `positions` synonyms: `open positions`, `net positions`
308- `positions convert` synonyms: `convert position`, `change product type`
309- `holdings` synonyms: `portfolio holdings`, `stocks held`, `demat holdings`
310- `holdings auctions` synonyms: `auction holdings`, `auction eligible`
311
312## Risk/margins
313
314- `margins` synonyms: `available margin`, `used margin`, `funds`
315- `margins order` synonyms: `margin required`, `order margin estimate`
316- `margins basket` synonyms: `basket margin`, `combined margin`
317- `margins charges` synonyms: `brokerage estimate`, `charges`, `fees`
318
319## GTT
320
321- `gtt` synonyms: `good till trigger`, `trigger order`, `price alert order`
322- `gtt two-leg` synonyms: `oco`, `one cancels other`, `bracket trigger`
323
324## Mutual funds
325
326- `mf orders` synonyms: `mutual fund order`, `fund buy/sell`
327- `mf sips` synonyms: `sip`, `systematic investment plan`
328- `mf holdings` synonyms: `mutual fund portfolio`, `fund holdings`
329
330# Routing Procedure
331
3321. Detect whether this is an install/bootstrap request, login/auth bootstrap request, or a normal `zerodha` command request.
3332. For install/bootstrap: pick the OS-specific installer command.
3343. For login/auth bootstrap: follow "Login Flow (Multi-Message)" and emit only the next runnable command.
3354. Otherwise detect intent domain using synonyms.
3365. Pick the narrowest command path.
3376. Extract required entities/flags.
3387. Validate against constraints above.
3398. If fields are missing, ask for only missing required inputs.
3409. Output one runnable command string.
341
342# Intent to Command Defaults
343
344- If user asks generic "install zerodha cli":
345 - Linux/macOS: `curl -fsSL https://raw.githubusercontent.com/jatinbansal1998/zerodha-kite-cli/main/scripts/install.sh | sh`
346 - Windows: `irm https://raw.githubusercontent.com/jatinbansal1998/zerodha-kite-cli/main/scripts/install.ps1 | iex`
347- If user asks generic "login" and no auth fields are provided:
348 - ask for `api_key` and `api_secret` first (profile defaults to `default` unless specified)
349- If user provides `api_key` + `api_secret` but no token/mode:
350 - emit profile setup command first, then ask for token mode (`--request-token` or `--callback`)
351- If user asks generic "show my profile": use `zerodha profile show`.
352- If user asks generic "show orders": use `zerodha orders list`.
353- If user asks generic "show trades": use `zerodha orders trades`.
354- If user asks generic "show positions": use `zerodha positions`.
355- If user asks generic "show holdings": use `zerodha holdings`.
356- If user asks generic "show margins": use `zerodha margins --segment all`.
357- If user asks "list instruments" without exchange: use `zerodha instruments list`.
358
359# Output Contract For Downstream Agents
360
361When responding with a routed command, return:
362
3631. `command`: exact runnable command (installer command for bootstrap, otherwise `zerodha ...`)
3642. `why`: one-line reason
3653. `missing`: required fields still missing (empty if none)