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

`orders place --autoslice` shows ✓ and hides slices that Kite rejected

Open jay-tau opened this issue 2 weeks ago • 0 comments

Summary

kite orders place --autoslice --confirm prints ✓ Order submitted and the parent order ID even when Kite rejected some of the slices. The failed slices and their errors aren't shown, so it looks as if the full quantity was placed.

Steps to reproduce

  1. Serve autoslice_response.json from a mock Kite API for POST /orders/regular, as tests/cli_output.rs does. In that response, the third of four children is an error: MarginException, "Insufficient funds. Required margin is 228365.92 but available margin is 228358.50." For the command below, export KITE_API_ROOT with that server's base URL, KITE_API_KEY=test-key, and KITE_ACCESS_TOKEN=test-token.
  2. Run kite orders place --exchange NSE --tradingsymbol INFY --transaction-type BUY --order-type LIMIT --quantity 1 --product CNC --price 1500 --validity DAY --autoslice --confirm.

Expected

The output shows each slice's order ID, or the reason it failed. It doesn't show a plain ✓ when a slice failed.

Actual

✓ Order submitted  BUY 1 NSE:INFY  LIMIT @ 1500  CNC  DAY
  Order ID  1914227164488687616
hint: check its status with `kite orders get 1914227164488687616`

The command exits 0. Only --json output includes children.

Cause

write_result prints order_id and returns, so children is never read. Its caller is send_unless_dry_run.

This issue covers the CLI only. The TUI has a similar gap: spawn_place_order keeps only order_id, and the order ticket turns autoslice on by itself above the freeze quantity.

Found using the kiteconnect-mocks fixtures only. I haven't placed a live autoslice order.

jay-tau avatar Nov 12 '26 07:11 jay-tau