kite-cli icon indicating copy to clipboard operation
kite-cli copied to clipboard

Orders place: dry run accepts orders that are incomplete as written

Open azeeb opened this issue 2 weeks ago • 0 comments

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 0 and --quantity=-75
  • --variety iceberg with no --iceberg-legs
  • --validity TTL with 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.

azeeb avatar Nov 12 '26 10:11 azeeb