Skip to content

fix(orders): split iceberg legs like Kite web when no leg quantity is given - #11

Merged
mr-karan merged 1 commit into
mainfrom
fix/orders-iceberg-quantity
Nov 16, 2026
Merged

mr-karan merged 1 commit into
mainfrom
fix/orders-iceberg-quantity

Conversation

@mr-karan

Copy link
Copy Markdown
Member

Why

kite orders place --variety iceberg should send the same order Kite web sends. Kite web always sends iceberg_quantity, computed as ceil(quantity / legs / lot_size) * lot_size (OrderWindow.vue, icebergQty). The TUI ticket does the same. The CLI sent nothing unless the caller passed --iceberg-quantity. This was flagged while reviewing #8.

What changed

  • Without --iceberg-quantity, orders place looks up the instrument's lot size in the cached instrument master and sends Kite web's per-leg quantity. Dry runs show it.
  • An explicit --iceberg-quantity still wins.
  • If the instrument is not in the master, the command fails and asks for --iceberg-quantity rather than guessing.

Verification

  • Unit test for the split: 101 over 4 legs of lot 1 gives 26, and 750 over 4 legs of lot 75 gives 225.
  • An integration test runs the binary against a cached master, checks the dry-run form for NSE and NFO instruments, and checks the not-found error. No request reaches /orders.
  • cargo clippy -D warnings and the full cargo test pass locally.

No live iceberg order was placed.

… given

kite orders place --variety iceberg sent no iceberg_quantity unless the
caller passed one. Kite web always sends it, computed as the quantity
over the legs rounded up to whole lots, and so does the TUI ticket.

The CLI now looks up the instrument's lot size in the cached instrument
master and sends the same value. An explicit --iceberg-quantity still
wins, and an instrument missing from the master is an error that asks
for the flag.
@mr-karan
mr-karan force-pushed the fix/orders-iceberg-quantity branch from e3c910f to de40bc4 Compare November 16, 2026 08:37
@mr-karan
mr-karan merged commit 2d8143d into main Nov 16, 2026
3 checks passed
@mr-karan
mr-karan deleted the fix/orders-iceberg-quantity branch November 16, 2026 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant