Orders place: dry run accepts orders that are incomplete as written
Summary
kite orders place prints a dry run and exits 0 for orders that cannot be placed as written, such as an SL order with no trigger price. The TUI order ticket refuses the same inputs. A script or agent that relies on the dry run as its check gets a pass for an order that cannot succeed.
Steps to reproduce
No login is needed. On main at ee3bf08f86db7866df632192fe0140744d76dae9 (v0.2.2):
kite orders place --exchange NFO --tradingsymbol NIFTY26NOVFUT \
--transaction-type BUY --product NRML --order-type SL --quantity 75
Expected
The command fails before the dry run with a clear error and a non-zero exit code, as the TUI ticket does ("trigger price must be a positive number").
Actual
Exit code 0, and no price or trigger_price in the request:
DRY RUN nothing was sent to Kite
BUY 75 NFO:NIFTY26NOVFUT SL NRML
POST /orders/regular
exchange NFO
tradingsymbol NIFTY26NOVFUT
transaction_type BUY
order_type SL
quantity 75
product NRML
hint: add --confirm to place the order
The same happens for:
- LIMIT with no
--price --quantity 0and--quantity=-75--variety icebergwith no--iceberg-legs--validity TTLwith no--validity-ttl
Cause
order_place_params in src/util.rs (line 153) copies each flag into the request without checking the flags against each other. The TUI ticket does check them in src/tui/ticket.rs: regular_prices (line 1444), parse_qty (line 970) and the iceberg leg rule (line 1405).
Notes
I have not confirmed how the Kite API responds to these orders, and no live order was placed. Fix proposed in #8.